One read of Claude Developer Platformapi-20260819T050708Z
1 pages moved out of 566 read.
Pages moved
1
significant first
Pages read
566
in this capture
Captured
05:07 UTC
Corpus hash
6e0c8558ac86
corpus-hash
What this read moved
1-1 of 1build-with-claude/prompt-caching Changed · +0 / -120 lines
from line 3310
33103310 ```python Python
33113311 client.beta.prompt_caching.messages.create(**params)
33123312 ```
3313
3314 ```typescript TypeScript
3315 const client = new Anthropic();
3316
3317 const response = await client.beta.promptCaching.messages.create({
3318 model: "claude-opus-5",
3319 max_tokens: 1024,
3320 system: [
3321 {
3322 type: "text",
3323 text: "You are an expert on this large document...",
3324 cache_control: { type: "ephemeral" }
3325 }
3326 ],
3327 messages: [{ role: "user", content: "Summarize the key points" }]
3328 });
3329
3330 console.log(response);
3331 ```
3332
3333 ```php PHP
3334 $client = new Client();
3335
3336 $message = $client->beta->promptCaching->messages->create(
3337 maxTokens: 1024,
3338 messages: [
3339 ['role' => 'user', 'content' => 'Summarize the key points']
3340 ],
3341 model: 'claude-opus-5',
3342 system: [
3343 [
3344 'type' => 'text',
3345 'text' => 'You are an expert on this large document...',
3346 'cache_control' => ['type' => 'ephemeral']
3347 ]
3348 ],
3349 );
3350
3351 echo json_encode($message, JSON_PRETTY_PRINT), PHP_EOL;
3352 ```
3353
3354 ```ruby Ruby
3355 client = Anthropic::Client.new
3356
3357 message = client.beta.prompt_caching.messages.create(
3358 model: "claude-opus-5",
3359 max_tokens: 1024,
3360 system: [
3361 {
3362 type: "text",
3363 text: "You are an expert on this large document...",
3364 cache_control: { type: "ephemeral" }
3365 }
3366 ],
3367 messages: [
3368 { role: "user", content: "Summarize the key points" }
3369 ]
3370 )
3371 puts message.content.find { it.type == :text }.text
3372 ```
33733313 </CodeGroup>
33743314
33753315 Use:
from line 3317
33773317 <CodeGroup>
33783318 ```python Python
33793319 client.messages.create(**params)
3380 ```
3381
3382 ```typescript TypeScript
3383 const client = new Anthropic();
3384
3385 const response = await client.messages.create({
3386 model: "claude-opus-5",
3387 max_tokens: 1024,
3388 system: [
3389 {
3390 type: "text",
3391 text: "You are an expert on this large document...",
3392 cache_control: { type: "ephemeral" }
3393 }
3394 ],
3395 messages: [{ role: "user", content: "Summarize the key points" }]
3396 });
3397
3398 console.log(response);
3399 ```
3400
3401 ```php PHP
3402 $client = new Client();
3403
3404 $message = $client->messages->create(
3405 maxTokens: 1024,
3406 messages: [
3407 ['role' => 'user', 'content' => 'Summarize the key points']
3408 ],
3409 model: 'claude-opus-5',
3410 system: [
3411 [
3412 'type' => 'text',
3413 'text' => 'You are an expert on this large document...',
3414 'cache_control' => ['type' => 'ephemeral']
3415 ]
3416 ],
3417 );
3418
3419 echo json_encode($message, JSON_PRETTY_PRINT), PHP_EOL;
3420 ```
3421
3422 ```ruby Ruby
3423 client = Anthropic::Client.new
3424
3425 message = client.messages.create(
3426 model: "claude-opus-5",
3427 max_tokens: 1024,
3428 system: [
3429 {
3430 type: "text",
3431 text: "You are an expert on this large document...",
3432 cache_control: { type: "ephemeral" }
3433 }
3434 ],
3435 messages: [
3436 { role: "user", content: "Summarize the key points" }
3437 ]
3438 )
3439 puts message
34403320 ```
34413321 </CodeGroup>
34423322 </Accordion>