The two sides of this change are more than 400 edits apart, too far apart to line up, so this is the differ's own diff of it and the words inside a line are not marked.
from line 1
1---
2title: Create a Message
3url: https://platform.claude.com/docs/en/api/messages/create
4---
5
6## Create a Message
7
8**post** `/v1/messages`
1# Create a Message
2
3**POST** `/v1/messages`
94
105Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
116
from line 8
138
149Learn more about the Messages API in our [user guide](https://platform.claude.com/docs/en/get-started)
1510
16### Header Parameters
11## Headers
1712
1813- `"anthropic-user-profile-id": optional string`
1914
2015 The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. Requires the `user-profiles` beta header.
2116
22### Body Parameters
17## Body parameters
2318
2419- `max_tokens: number`
2520
from line 25
3025 Set to `0` to populate the [prompt cache](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pre-warming-the-cache) without generating a response.
3126
3227 Different models have different maximum values for this parameter. See [models](https://platform.claude.com/docs/en/about-claude/models/overview) for details.
28
29 minimum: 0
3330
3431- `messages: array of MessageParam`
3532
from line 85
8885
8986 - `array of ContentBlockParam`
9087
91 - `TextBlockParam object { text, type, cache_control, citations }`
88 - `TextBlockParam object`
9289
9390 - `text: string`
9491
92 minLength: 1
93
9594 - `type: "text"`
9695
97 - `"text"`
98
9996 - `cache_control: optional CacheControlEphemeral or null`
10097
10198 Create a cache control breakpoint at this content block.
10299
103100 - `type: "ephemeral"`
104
105 - `"ephemeral"`
106101
107102 - `ttl: optional "5m" or "1h"`
108103
from line 116
121116
122117 - `citations: optional array of TextCitationParam or null`
123118
124 - `CitationCharLocationParam object { cited_text, document_index, document_title, 3 more }`
119 - `CitationCharLocationParam object`
125120
126121 - `cited_text: string`
127122
128123 - `document_index: number`
129124
125 minimum: 0
126
130127 - `document_title: string or null`
131128
129 maxLength: 500, minLength: 1
130
132131 - `end_char_index: number`
133132
134133 - `start_char_index: number`
135134
135 minimum: 0
136
136137 - `type: "char_location"`
137138
138 - `"char_location"`
139
140 - `CitationPageLocationParam object { cited_text, document_index, document_title, 3 more }`
139 - `CitationPageLocationParam object`
141140
142141 - `cited_text: string`
143142
144143 - `document_index: number`
145144
145 minimum: 0
146
146147 - `document_title: string or null`
147148
149 maxLength: 500, minLength: 1
150
148151 - `end_page_number: number`
149152
150153 - `start_page_number: number`
151154
155 minimum: 1
156
152157 - `type: "page_location"`
153158
154 - `"page_location"`
155
156 - `CitationContentBlockLocationParam object { cited_text, document_index, document_title, 3 more }`
159 - `CitationContentBlockLocationParam object`
157160
158161 - `cited_text: string`
159162
from line 166
163166
164167 - `document_index: number`
165168
169 minimum: 0
170
166171 - `document_title: string or null`
167172
173 maxLength: 500, minLength: 1
174
168175 - `end_block_index: number`
169176
170177 Exclusive 0-based end index of the cited block range in the source's `content` array.
from line 182
175182
176183 0-based index of the first cited block in the source's `content` array.
177184
185 minimum: 0
186
178187 - `type: "content_block_location"`
179188
180 - `"content_block_location"`
181
182 - `CitationWebSearchResultLocationParam object { cited_text, encrypted_index, title, 2 more }`
189 - `CitationWebSearchResultLocationParam object`
183190
184191 - `cited_text: string`
185192
from line 194
187194
188195 - `title: string or null`
189196
197 maxLength: 512, minLength: 1
198
190199 - `type: "web_search_result_location"`
191200
192 - `"web_search_result_location"`
193
194201 - `url: string`
195202
196 - `CitationSearchResultLocationParam object { cited_text, end_block_index, search_result_index, 4 more }`
203 minLength: 1
204
205 - `CitationSearchResultLocationParam object`
197206
198207 - `cited_text: string`
199208
from line 222
213222
214223 Counted separately from `document_index`; server-side web search results are not included in this count.
215224
225 minimum: 0
226
216227 - `source: string`
217228
218229 - `start_block_index: number`
219230
220231 0-based index of the first cited block in the source's `content` array.
221232
233 minimum: 0
234
222235 - `title: string or null`
223236
224237 - `type: "search_result_location"`
225238
226 - `"search_result_location"`
227
228 - `ImageBlockParam object { source, type, cache_control, transformations }`
239 - `ImageBlockParam object`
229240
230241 - `source: Base64ImageSource or URLImageSource or FileImageSource`
231242
232 - `Base64ImageSource object { data, media_type, type }`
243 - `Base64ImageSource object`
233244
234245 - `data: string`
235246
247 format: byte
248
236249 - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"`
237250
238251 - `"image/jpeg"`
from line 258
245258
246259 - `type: "base64"`
247260
248 - `"base64"`
249
250 - `URLImageSource object { type, url }`
261 - `URLImageSource object`
251262
252263 - `type: "url"`
253264
254 - `"url"`
255
256265 - `url: string`
257266
258 - `FileImageSource object { file_id, type }`
267 - `FileImageSource object`
259268
260269 - `file_id: string`
261270
262271 - `type: "file"`
263272
264 - `"file"`
265
266273 - `type: "image"`
267274
268 - `"image"`
269
270275 - `cache_control: optional CacheControlEphemeral or null`
271276
272277 Create a cache control breakpoint at this content block.
from line 288
283288
284289 - `"error"`
285290
286 - `DocumentBlockParam object { source, type, cache_control, 3 more }`
291 - `DocumentBlockParam object`
287292
288293 - `source: Base64PDFSource or PlainTextSource or ContentBlockSource or 2 more`
289294
290 - `Base64PDFSource object { data, media_type, type }`
295 - `Base64PDFSource object`
291296
292297 - `data: string`
293298
299 format: byte
300
294301 - `media_type: "application/pdf"`
295302
296 - `"application/pdf"`
297
298303 - `type: "base64"`
299304
300 - `"base64"`
301
302 - `PlainTextSource object { data, media_type, type }`
305 - `PlainTextSource object`
303306
304307 - `data: string`
305308
306309 - `media_type: "text/plain"`
307310
308 - `"text/plain"`
309
310311 - `type: "text"`
311312
312 - `"text"`
313
314 - `ContentBlockSource object { content, type }`
313 - `ContentBlockSource object`
315314
316315 - `content: string or array of ContentBlockSourceContent`
317316
from line 318
319318
320319 - `ContentBlockSourceContent = array of ContentBlockSourceContent`
321320
322 - `TextBlockParam object { text, type, cache_control, citations }`
323
324 - `ImageBlockParam object { source, type, cache_control, transformations }`
321 - `TextBlockParam object`
322
323 - `ImageBlockParam object`
325324
326325 - `type: "content"`
327326
328 - `"content"`
329
330 - `URLPDFSource object { type, url }`
327 - `URLPDFSource object`
331328
332329 - `type: "url"`
333330
334 - `"url"`
335
336331 - `url: string`
337332
338 - `FileDocumentSource object { file_id, type }`
333 - `FileDocumentSource object`
339334
340335 - `file_id: string`
341336
342337 - `type: "file"`
343338
344 - `"file"`
345
346339 - `type: "document"`
347340
348 - `"document"`
349
350341 - `cache_control: optional CacheControlEphemeral or null`
351342
352343 Create a cache control breakpoint at this content block.
from line 348
357348
358349 - `context: optional string or null`
359350
351 minLength: 1
352
360353 - `title: optional string or null`
361354
362 - `SearchResultBlockParam object { content, source, title, 3 more }`
355 maxLength: 500, minLength: 1
356
357 - `SearchResultBlockParam object`
363358
364359 - `content: array of TextBlockParam`
365360
366361 - `text: string`
367362
363 minLength: 1
364
368365 - `type: "text"`
369366
370367 - `cache_control: optional CacheControlEphemeral or null`
from line 376
379376
380377 - `type: "search_result"`
381378
382 - `"search_result"`
383
384379 - `cache_control: optional CacheControlEphemeral or null`
385380
386381 Create a cache control breakpoint at this content block.
387382
388383 - `citations: optional CitationsConfigParam`
389384
390 - `ThinkingBlockParam object { signature, thinking, type }`
385 - `ThinkingBlockParam object`
391386
392387 - `signature: string`
393388
from line 396
401396
402397 - `type: "thinking"`
403398
404 - `"thinking"`
405
406 - `RedactedThinkingBlockParam object { data, type }`
399 - `RedactedThinkingBlockParam object`
407400
408401 - `data: string`
409402
from line 404
411404
412405 - `type: "redacted_thinking"`
413406
414 - `"redacted_thinking"`
415
416 - `ToolUseBlockParam object { id, input, name, 4 more }`
407 - `ToolUseBlockParam object`
417408
418409 - `id: string`
419410
411 pattern: ^[a-zA-Z0-9_-]+$
412
420413 - `input: map[unknown]`
421414
422415 - `name: string`
423416
417 maxLength: 200, minLength: 1
418
424419 - `type: "tool_use"`
425420
426 - `"tool_use"`
427
428421 - `cache_control: optional CacheControlEphemeral or null`
429422
430423 Create a cache control breakpoint at this content block.
from line 426
433426
434427 Tool invocation directly from the model.
435428
436 - `DirectCaller object { type }`
429 - `DirectCaller object`
437430
438431 Tool invocation directly from the model.
439432
440433 - `type: "direct"`
441434
442 - `"direct"`
443
444 - `ServerToolCaller object { tool_id, type }`
435 - `ServerToolCaller object`
445436
446437 Tool invocation generated by a server-side tool.
447438
448439 - `tool_id: string`
449440
441 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
442
450443 - `type: "code_execution_20250825"`
451444
452 - `"code_execution_20250825"`
453
454 - `ServerToolCaller20260120 object { tool_id, type }`
445 - `ServerToolCaller20260120 object`
455446
456447 - `tool_id: string`
457448
449 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
450
458451 - `type: "code_execution_20260120"`
459452
460 - `"code_execution_20260120"`
461
462453 - `toolset_name: optional string or null`
463454
464455 For a toolset member tool_use, the toolset family this member belongs to.
465456
466 - `ToolResultBlockParam object { tool_use_id, type, cache_control, 3 more }`
457 maxLength: 64, minLength: 1, pattern: ^[a-zA-Z0-9_-]+$
458
459 - `ToolResultBlockParam object`
467460
468461 - `tool_use_id: string`
469462
463 pattern: ^[a-zA-Z0-9_-]+$
464
470465 - `type: "tool_result"`
471466
472 - `"tool_result"`
473
474467 - `cache_control: optional CacheControlEphemeral or null`
475468
476469 Create a cache control breakpoint at this content block.
from line 474
481474
482475 - `array of TextBlockParam or ImageBlockParam or SearchResultBlockParam or 3 more`
483476
484 - `TextBlockParam object { text, type, cache_control, citations }`
485
486 - `ImageBlockParam object { source, type, cache_control, transformations }`
487
488 - `SearchResultBlockParam object { content, source, title, 3 more }`
489
490 - `DocumentBlockParam object { source, type, cache_control, 3 more }`
491
492 - `ToolReferenceBlockParam object { tool_name, type, cache_control }`
477 - `TextBlockParam object`
478
479 - `ImageBlockParam object`
480
481 - `SearchResultBlockParam object`
482
483 - `DocumentBlockParam object`
484
485 - `ToolReferenceBlockParam object`
493486
494487 Tool reference block that can be included in tool_result content.
495488
496489 - `tool_name: string`
497490
491 maxLength: 256, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,256}$
492
498493 - `type: "tool_reference"`
499494
500 - `"tool_reference"`
501
502495 - `cache_control: optional CacheControlEphemeral or null`
503496
504497 Create a cache control breakpoint at this content block.
505498
506 - `BrowserStateBlockParam object { tabs, type, cache_control, state_changes }`
499 - `BrowserStateBlockParam object`
507500
508501 The caller's browser state after a browser toolset member call —
509502 the full inventory of open tabs, which tab is active, and any side
from line 510
517510
518511 All tabs open in the browser after this call — the full inventory, not a delta. May be empty. Whenever non-empty, exactly one entry carries `active: true`.
519512
513 maxItems: 100
514
520515 - `tab_id: string`
521516
522517 The caller-assigned identifier for this tab, unique within the inventory.
523518
519 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
520
524521 - `title: string`
525522
526523 The title of the page the tab is showing. May be empty.
527524
525 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
526
528527 - `url: string`
529528
530529 The URL of the page the tab is showing. May be empty.
531530
531 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
532
532533 - `active: optional boolean`
533534
534535 Whether this tab is the active tab after this call. Whenever `tabs` is non-empty, exactly one entry is marked `active: true`.
535536
536537 - `type: "browser_state"`
537538
538 - `"browser_state"`
539
540539 - `cache_control: optional CacheControlEphemeral or null`
541540
542541 Create a cache control breakpoint at this content block.
from line 544
545544
546545 Tabs opened and download state changes during this call. "Nothing to report" is expressed by omitting the field, never by an empty list.
547546
548 - `BrowserStateChangeTabOpened object { tab_id, type }`
547 maxItems: 200, minItems: 1
548
549 - `BrowserStateChangeTabOpened object`
549550
550551 A tab this call's execution opened that remains open at its end —
551552 the creation delta of the `tabs` inventory, not an event log.
from line 560
559560
560561 The `tab_id` of the opened tab, present in `tabs`.
561562
563 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
564
562565 - `type: "tab_opened"`
563566
564 - `"tab_opened"`
565
566 - `BrowserStateChangeDownloadStarted object { download_id, type, url }`
567 - `BrowserStateChangeDownloadStarted object`
567568
568569 A file download that started during this call.
569570
from line 572
571572
572573 The caller-assigned identifier for this download, stable across the state changes reporting it.
573574
575 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
576
574577 - `type: "download_started"`
575578
576 - `"download_started"`
577
578579 - `url: string`
579580
580581 The final post-redirect URL the download was served from.
581582
582 - `BrowserStateChangeDownloadCompleted object { download_id, type, url, 2 more }`
583 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
584
585 - `BrowserStateChangeDownloadCompleted object`
583586
584587 A file download that finished during this call, reported with the
585588 same `download_id` as its `download_started` — or without a prior
from line 593
590593
591594 The caller-assigned identifier for this download, stable across the state changes reporting it.
592595
596 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
597
593598 - `type: "download_completed"`
594599
595 - `"download_completed"`
596
597600 - `url: string`
598601
599602 The final post-redirect URL the download was served from.
600603
604 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
605
601606 - `path: optional string or null`
602607
603608 Where the executor saved the file, on the executor's filesystem. Only included when another tool in the same environment can read the file at that path.
604609
610 pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$, maxLength: 4096
611
605612 - `size_bytes: optional number or null`
606613
607614 The completed download's size.
608615
609 - `BrowserStateChangeDownloadFailed object { download_id, type, url, error }`
616 minimum: 0
617
618 - `BrowserStateChangeDownloadFailed object`
610619
611620 A file download that failed — or was cancelled — during this call.
612621
from line 623
614623
615624 The caller-assigned identifier for this download, stable across the state changes reporting it.
616625
626 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
627
617628 - `type: "download_failed"`
618629
619 - `"download_failed"`
620
621630 - `url: string`
622631
623632 The final post-redirect URL the download was served from.
624633
634 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
635
625636 - `error: optional string or null`
626637
627638 The failure or cancellation detail, when known.
628639
640 pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$, maxLength: 4096
641
629642 - `is_error: optional boolean`
630643
631644 - `toolset_name: optional string or null`
632645
633646 For a toolset member tool_result, the toolset family of the paired tool_use.
634647
635 - `ServerToolUseBlockParam object { id, input, name, 3 more }`
648 maxLength: 64, minLength: 1, pattern: ^[a-zA-Z0-9_-]+$
649
650 - `ServerToolUseBlockParam object`
636651
637652 - `id: string`
638653
654 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
655
639656 - `input: map[unknown]`
640657
641658 - `name: "web_search" or "web_fetch" or "code_execution" or 4 more`
from line 673
656673
657674 - `type: "server_tool_use"`
658675
659 - `"server_tool_use"`
660
661676 - `cache_control: optional CacheControlEphemeral or null`
662677
663678 Create a cache control breakpoint at this content block.
from line 681
666681
667682 Tool invocation directly from the model.
668683
669 - `DirectCaller object { type }`
684 - `DirectCaller object`
670685
671686 Tool invocation directly from the model.
672687
673 - `ServerToolCaller object { tool_id, type }`
688 - `ServerToolCaller object`
674689
675690 Tool invocation generated by a server-side tool.
676691
677 - `ServerToolCaller20260120 object { tool_id, type }`
678
679 - `WebSearchToolResultBlockParam object { content, tool_use_id, type, 2 more }`
692 - `ServerToolCaller20260120 object`
693
694 - `WebSearchToolResultBlockParam object`
680695
681696 - `content: WebSearchToolResultBlockParamContent`
682697
from line 703
688703
689704 - `type: "web_search_result"`
690705
691 - `"web_search_result"`
692
693706 - `url: string`
694707
695708 - `page_age: optional string or null`
696709
697 - `WebSearchToolRequestError object { error_code, type }`
710 - `WebSearchToolRequestError object`
698711
699712 - `error_code: WebSearchToolResultErrorCode`
700713
from line 725
712725
713726 - `type: "web_search_tool_result_error"`
714727
715 - `"web_search_tool_result_error"`
716
717728 - `tool_use_id: string`
718729
730 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
731
719732 - `type: "web_search_tool_result"`
720733
721 - `"web_search_tool_result"`
722
723734 - `cache_control: optional CacheControlEphemeral or null`
724735
725736 Create a cache control breakpoint at this content block.
from line 739
728739
729740 Tool invocation directly from the model.
730741
731 - `DirectCaller object { type }`
742 - `DirectCaller object`
732743
733744 Tool invocation directly from the model.
734745
735 - `ServerToolCaller object { tool_id, type }`
746 - `ServerToolCaller object`
736747
737748 Tool invocation generated by a server-side tool.
738749
739 - `ServerToolCaller20260120 object { tool_id, type }`
740
741 - `WebFetchToolResultBlockParam object { content, tool_use_id, type, 2 more }`
750 - `ServerToolCaller20260120 object`
751
752 - `WebFetchToolResultBlockParam object`
742753
743754 - `content: WebFetchToolResultErrorBlockParam or WebFetchBlockParam`
744755
745 - `WebFetchToolResultErrorBlockParam object { error_code, type }`
756 - `WebFetchToolResultErrorBlockParam object`
746757
747758 - `error_code: WebFetchToolResultErrorCode`
748759
from line 777
766777
767778 - `type: "web_fetch_tool_result_error"`
768779
769 - `"web_fetch_tool_result_error"`
770
771 - `WebFetchBlockParam object { content, type, url, retrieved_at }`
780 - `WebFetchBlockParam object`
772781
773782 - `content: DocumentBlockParam`
774783
775784 - `type: "web_fetch_result"`
776785
777 - `"web_fetch_result"`
778
779786 - `url: string`
780787
781788 Fetched content URL
from line 793
786793
787794 - `tool_use_id: string`
788795
796 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
797
789798 - `type: "web_fetch_tool_result"`
790799
791 - `"web_fetch_tool_result"`
792
793800 - `cache_control: optional CacheControlEphemeral or null`
794801
795802 Create a cache control breakpoint at this content block.
from line 805
798805
799806 Tool invocation directly from the model.
800807
801 - `DirectCaller object { type }`
808 - `DirectCaller object`
802809
803810 Tool invocation directly from the model.
804811
805 - `ServerToolCaller object { tool_id, type }`
812 - `ServerToolCaller object`
806813
807814 Tool invocation generated by a server-side tool.
808815
809 - `ServerToolCaller20260120 object { tool_id, type }`
810
811 - `CodeExecutionToolResultBlockParam object { content, tool_use_id, type, cache_control }`
816 - `ServerToolCaller20260120 object`
817
818 - `CodeExecutionToolResultBlockParam object`
812819
813820 - `content: CodeExecutionToolResultBlockParamContent`
814821
815822 Code execution result with encrypted stdout for PFC + web_search results.
816823
817 - `CodeExecutionToolResultErrorParam object { error_code, type }`
824 - `CodeExecutionToolResultErrorParam object`
818825
819826 - `error_code: CodeExecutionToolResultErrorCode`
820827
from line 835
828835
829836 - `type: "code_execution_tool_result_error"`
830837
831 - `"code_execution_tool_result_error"`
832
833 - `CodeExecutionResultBlockParam object { content, return_code, stderr, 2 more }`
838 - `CodeExecutionResultBlockParam object`
834839
835840 - `content: array of CodeExecutionOutputBlockParam`
836841
from line 843
838843
839844 - `type: "code_execution_output"`
840845
841 - `"code_execution_output"`
842
843846 - `return_code: number`
844847
845848 - `stderr: string`
from line 851
848851
849852 - `type: "code_execution_result"`
850853
851 - `"code_execution_result"`
852
853 - `EncryptedCodeExecutionResultBlockParam object { content, encrypted_stdout, return_code, 2 more }`
854 - `EncryptedCodeExecutionResultBlockParam object`
854855
855856 Code execution result with encrypted stdout for PFC + web_search results.
856857
from line 869
868869
869870 - `type: "encrypted_code_execution_result"`
870871
871 - `"encrypted_code_execution_result"`
872
873872 - `tool_use_id: string`
874873
874 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
875
875876 - `type: "code_execution_tool_result"`
876877
877 - `"code_execution_tool_result"`
878
879878 - `cache_control: optional CacheControlEphemeral or null`
880879
881880 Create a cache control breakpoint at this content block.
882881
883 - `BashCodeExecutionToolResultBlockParam object { content, tool_use_id, type, cache_control }`
882 - `BashCodeExecutionToolResultBlockParam object`
884883
885884 - `content: BashCodeExecutionToolResultErrorParam or BashCodeExecutionResultBlockParam`
886885
887 - `BashCodeExecutionToolResultErrorParam object { error_code, type }`
886 - `BashCodeExecutionToolResultErrorParam object`
888887
889888 - `error_code: BashCodeExecutionToolResultErrorCode`
890889
from line 899
900899
901900 - `type: "bash_code_execution_tool_result_error"`
902901
903 - `"bash_code_execution_tool_result_error"`
904
905 - `BashCodeExecutionResultBlockParam object { content, return_code, stderr, 2 more }`
902 - `BashCodeExecutionResultBlockParam object`
906903
907904 - `content: array of BashCodeExecutionOutputBlockParam`
908905
from line 907
910907
911908 - `type: "bash_code_execution_output"`
912909
913 - `"bash_code_execution_output"`
914
915910 - `return_code: number`
916911
917912 - `stderr: string`
from line 915
920915
921916 - `type: "bash_code_execution_result"`
922917
923 - `"bash_code_execution_result"`
924
925918 - `tool_use_id: string`
926919
920 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
921
927922 - `type: "bash_code_execution_tool_result"`
928923
929 - `"bash_code_execution_tool_result"`
930
931924 - `cache_control: optional CacheControlEphemeral or null`
932925
933926 Create a cache control breakpoint at this content block.
934927
935 - `TextEditorCodeExecutionToolResultBlockParam object { content, tool_use_id, type, cache_control }`
928 - `TextEditorCodeExecutionToolResultBlockParam object`
936929
937930 - `content: TextEditorCodeExecutionToolResultErrorParam or TextEditorCodeExecutionViewResultBlockParam or TextEditorCodeExecutionCreateResultBlockParam or TextEditorCodeExecutionStrReplaceResultBlockParam`
938931
939 - `TextEditorCodeExecutionToolResultErrorParam object { error_code, type, error_message }`
932 - `TextEditorCodeExecutionToolResultErrorParam object`
940933
941934 - `error_code: TextEditorCodeExecutionToolResultErrorCode`
942935
from line 945
952945
953946 - `type: "text_editor_code_execution_tool_result_error"`
954947
955 - `"text_editor_code_execution_tool_result_error"`
956
957948 - `error_message: optional string or null`
958949
959 - `TextEditorCodeExecutionViewResultBlockParam object { content, file_type, type, 3 more }`
950 - `TextEditorCodeExecutionViewResultBlockParam object`
960951
961952 - `content: string`
962953
from line 961
970961
971962 - `type: "text_editor_code_execution_view_result"`
972963
973 - `"text_editor_code_execution_view_result"`
974
975964 - `num_lines: optional number or null`
976965
977966 - `start_line: optional number or null`
978967
979968 - `total_lines: optional number or null`
980969
981 - `TextEditorCodeExecutionCreateResultBlockParam object { is_file_update, type }`
970 - `TextEditorCodeExecutionCreateResultBlockParam object`
982971
983972 - `is_file_update: boolean`
984973
985974 - `type: "text_editor_code_execution_create_result"`
986975
987 - `"text_editor_code_execution_create_result"`
988
989 - `TextEditorCodeExecutionStrReplaceResultBlockParam object { type, lines, new_lines, 3 more }`
976 - `TextEditorCodeExecutionStrReplaceResultBlockParam object`
990977
991978 - `type: "text_editor_code_execution_str_replace_result"`
992979
993 - `"text_editor_code_execution_str_replace_result"`
994
995980 - `lines: optional array of string or null`
996981
997982 - `new_lines: optional number or null`
from line 989
1004989
1005990 - `tool_use_id: string`
1006991
992 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
993
1007994 - `type: "text_editor_code_execution_tool_result"`
1008995
1009 - `"text_editor_code_execution_tool_result"`
1010
1011996 - `cache_control: optional CacheControlEphemeral or null`
1012997
1013998 Create a cache control breakpoint at this content block.
1014999
1015 - `ToolSearchToolResultBlockParam object { content, tool_use_id, type, cache_control }`
1000 - `ToolSearchToolResultBlockParam object`
10161001
10171002 - `content: ToolSearchToolResultErrorParam or ToolSearchToolSearchResultBlockParam`
10181003
1019 - `ToolSearchToolResultErrorParam object { error_code, type, error_message }`
1004 - `ToolSearchToolResultErrorParam object`
10201005
10211006 - `error_code: ToolSearchToolResultErrorCode`
10221007
from line 1015
10301015
10311016 - `type: "tool_search_tool_result_error"`
10321017
1033 - `"tool_search_tool_result_error"`
1034
10351018 - `error_message: optional string or null`
10361019
1037 - `ToolSearchToolSearchResultBlockParam object { tool_references, type }`
1020 - `ToolSearchToolSearchResultBlockParam object`
10381021
10391022 - `tool_references: array of ToolReferenceBlockParam`
10401023
10411024 - `tool_name: string`
10421025
1026 maxLength: 256, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,256}$
1027
10431028 - `type: "tool_reference"`
10441029
10451030 - `cache_control: optional CacheControlEphemeral or null`
from line 1033
10481033
10491034 - `type: "tool_search_tool_search_result"`
10501035
1051 - `"tool_search_tool_search_result"`
1052
10531036 - `tool_use_id: string`
10541037
1038 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
1039
10551040 - `type: "tool_search_tool_result"`
10561041
1057 - `"tool_search_tool_result"`
1058
10591042 - `cache_control: optional CacheControlEphemeral or null`
10601043
10611044 Create a cache control breakpoint at this content block.
10621045
1063 - `ContainerUploadBlockParam object { file_id, type, cache_control }`
1046 - `ContainerUploadBlockParam object`
10641047
10651048 A content block that represents a file to be uploaded to the container
10661049 Files uploaded via this block will be available in the container's input directory.
from line 1052
10691052
10701053 - `type: "container_upload"`
10711054
1072 - `"container_upload"`
1073
10741055 - `cache_control: optional CacheControlEphemeral or null`
10751056
10761057 Create a cache control breakpoint at this content block.
from line 1146
11651146
11661147 Container identifier for reuse across requests.
11671148
1168 - `ContainerParams object { id, skills }`
1149 - `ContainerParams object`
11691150
11701151 Container parameters with skills to be loaded.
11711152
from line 1158
11771158
11781159 List of skills to load in the container
11791160
1161 maxItems: 20
1162
11801163 - `skill_id: string`
11811164
11821165 Skill ID
11831166
1167 maxLength: 64, minLength: 1
1168
11841169 - `type: "anthropic" or "custom"`
11851170
11861171 Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
from line 1178
11931178
11941179 Skill version or 'latest' for most recent version
11951180
1181 maxLength: 64, minLength: 1
1182
11961183 - `string`
11971184
11981185- `inference_geo: optional string or null`
from line 1196
12091196
12101197 This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number.
12111198
1199 maxLength: 512
1200
12121201- `output_config: optional OutputConfig`
12131202
12141203 Configuration options for the model's output, such as the output format.
from line 1226
12371226
12381227 - `type: "json_schema"`
12391228
1240 - `"json_schema"`
1241
12421229- `service_tier: optional "auto" or "standard_only"`
12431230
12441231 Determines whether to use priority capacity (if available) or standard capacity for this request.
from line 1262
12751262
12761263 - `text: string`
12771264
1265 minLength: 1
1266
12781267 - `type: "text"`
12791268
12801269 - `cache_control: optional CacheControlEphemeral or null`
from line 1272
12831272
12841273 - `citations: optional array of TextCitationParam or null`
12851274
1286- `temperature: optional number`
1287
1288 Amount of randomness injected into the response.
1289
1290 Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
1291
1292 Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
1293
12941275- `thinking: optional ThinkingConfigParam`
12951276
12961277 Configuration for enabling Claude's extended thinking.
from line 1280
12991280
13001281 See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.
13011282
1302 - `ThinkingConfigEnabled object { budget_tokens, type, display }`
1283 - `ThinkingConfigEnabled object`
13031284
13041285 - `budget_tokens: number`
13051286
from line 1290
13091290
13101291 See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.
13111292
1293 minimum: 1024
1294
13121295 - `type: "enabled"`
13131296
1314 - `"enabled"`
1315
13161297 - `display: optional "summarized" or "omitted" or null`
13171298
13181299 Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.
from line 1302
13211302
13221303 - `"omitted"`
13231304
1324 - `ThinkingConfigDisabled object { type }`
1305 - `ThinkingConfigDisabled object`
13251306
13261307 - `type: "disabled"`
13271308
1328 - `"disabled"`
1329
1330 - `ThinkingConfigAdaptive object { type, display }`
1309 - `ThinkingConfigAdaptive object`
13311310
13321311 - `type: "adaptive"`
13331312
1334 - `"adaptive"`
1335
13361313 - `display: optional "summarized" or "omitted" or null`
13371314
13381315 Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.
from line 1322
13451322
13461323 How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.
13471324
1348 - `ToolChoiceAuto object { type, disable_parallel_tool_use }`
1325 - `ToolChoiceAuto object`
13491326
13501327 The model will automatically decide whether to use tools.
13511328
13521329 - `type: "auto"`
13531330
1354 - `"auto"`
1355
13561331 - `disable_parallel_tool_use: optional boolean`
13571332
13581333 Whether to disable parallel tool use.
13591334
13601335 Defaults to `false`. If set to `true`, the model will output at most one tool use.
13611336
1362 - `ToolChoiceAny object { type, disable_parallel_tool_use }`
1337 - `ToolChoiceAny object`
13631338
13641339 The model will use any available tools.
13651340
13661341 - `type: "any"`
13671342
1368 - `"any"`
1369
13701343 - `disable_parallel_tool_use: optional boolean`
13711344
13721345 Whether to disable parallel tool use.
13731346
13741347 Defaults to `false`. If set to `true`, the model will output exactly one tool use.
13751348
1376 - `ToolChoiceTool object { name, type, disable_parallel_tool_use }`
1349 - `ToolChoiceTool object`
13771350
13781351 The model will use the specified tool with `tool_choice.name`.
13791352
from line 1356
13831356
13841357 - `type: "tool"`
13851358
1386 - `"tool"`
1387
13881359 - `disable_parallel_tool_use: optional boolean`
13891360
13901361 Whether to disable parallel tool use.
13911362
13921363 Defaults to `false`. If set to `true`, the model will output exactly one tool use.
13931364
1394 - `ToolChoiceNone object { type }`
1365 - `ToolChoiceNone object`
13951366
13961367 The model will not be allowed to use tools.
13971368
13981369 - `type: "none"`
1399
1400 - `"none"`
14011370
14021371- `tools: optional array of ToolUnion`
14031372
from line 1432
14631432
14641433 See our [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview) for more details.
14651434
1466 - `Tool object { input_schema, name, allowed_callers, 7 more }`
1467
1468 - `input_schema: object { type, properties, required }`
1435 - `Tool object`
1436
1437 - `input_schema: object`
14691438
14701439 [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
14711440
from line 1442
14731442
14741443 - `type: "object"`
14751444
1476 - `"object"`
1477
14781445 - `properties: optional map[unknown] or null`
14791446
14801447 - `required: optional array of string or null`
from line 1452
14851452
14861453 This is how the tool will be called by the model and in `tool_use` blocks.
14871454
1455 maxLength: 128, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,128}$
1456
14881457 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
14891458
14901459 - `"direct"`
from line 1490
15211490
15221491 - `type: optional "custom" or null`
15231492
1524 - `"custom"`
1525
1526 - `ToolBash20250124 object { name, type, allowed_callers, 4 more }`
1493 - `ToolBash20250124 object`
15271494
15281495 - `name: "bash"`
15291496
from line 1498
15311498
15321499 This is how the tool will be called by the model and in `tool_use` blocks.
15331500
1534 - `"bash"`
1535
15361501 - `type: "bash_20250124"`
15371502
1538 - `"bash_20250124"`
1539
15401503 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
15411504
15421505 - `"direct"`
from line 1524
15611524
15621525 When true, guarantees schema validation on tool names and inputs
15631526
1564 - `CodeExecutionTool20250522 object { name, type, allowed_callers, 3 more }`
1527 - `CodeExecutionTool20250522 object`
15651528
15661529 - `name: "code_execution"`
15671530
from line 1532
15691532
15701533 This is how the tool will be called by the model and in `tool_use` blocks.
15711534
1572 - `"code_execution"`
1573
15741535 - `type: "code_execution_20250522"`
15751536
1576 - `"code_execution_20250522"`
1577
15781537 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
15791538
15801539 - `"direct"`
from line 1556
15971556
15981557 When true, guarantees schema validation on tool names and inputs
15991558
1600 - `CodeExecutionTool20250825 object { name, type, allowed_callers, 3 more }`
1559 - `CodeExecutionTool20250825 object`
16011560
16021561 - `name: "code_execution"`
16031562
from line 1564
16051564
16061565 This is how the tool will be called by the model and in `tool_use` blocks.
16071566
1608 - `"code_execution"`
1609
16101567 - `type: "code_execution_20250825"`
16111568
1569 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
1570
1571 - `"direct"`
1572
16121573 - `"code_execution_20250825"`
16131574
1575 - `"code_execution_20260120"`
1576
1577 - `"code_execution_20260521"`
1578
1579 - `cache_control: optional CacheControlEphemeral or null`
1580
1581 Create a cache control breakpoint at this content block.
1582
1583 - `defer_loading: optional boolean`
1584
1585 If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
1586
1587 - `strict: optional boolean`
1588
1589 When true, guarantees schema validation on tool names and inputs
1590
1591 - `CodeExecutionTool20260120 object`
1592
1593 Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
1594
1595 - `name: "code_execution"`
1596
1597 Name of the tool.
1598
1599 This is how the tool will be called by the model and in `tool_use` blocks.
1600
1601 - `type: "code_execution_20260120"`
1602
16141603 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
16151604
16161605 - `"direct"`
from line 1622
16331622
16341623 When true, guarantees schema validation on tool names and inputs
16351624
1636 - `CodeExecutionTool20260120 object { name, type, allowed_callers, 3 more }`
1637
1638 Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
1625 - `CodeExecutionTool20260521 object`
1626
1627 Code execution tool with REPL state persistence.
16391628
16401629 - `name: "code_execution"`
16411630
from line 1632
16431632
16441633 This is how the tool will be called by the model and in `tool_use` blocks.
16451634
1646 - `"code_execution"`
1647
1648 - `type: "code_execution_20260120"`
1635 - `type: "code_execution_20260521"`
1636
1637 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
1638
1639 - `"direct"`
1640
1641 - `"code_execution_20250825"`
16491642
16501643 - `"code_execution_20260120"`
16511644
1652 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
1653
1654 - `"direct"`
1655
1656 - `"code_execution_20250825"`
1657
1658 - `"code_execution_20260120"`
1659
16601645 - `"code_execution_20260521"`
16611646
16621647 - `cache_control: optional CacheControlEphemeral or null`
from line 1656
16711656
16721657 When true, guarantees schema validation on tool names and inputs
16731658
1674 - `CodeExecutionTool20260521 object { name, type, allowed_callers, 3 more }`
1675
1676 Code execution tool with REPL state persistence.
1677
1678 - `name: "code_execution"`
1679
1680 Name of the tool.
1681
1682 This is how the tool will be called by the model and in `tool_use` blocks.
1683
1684 - `"code_execution"`
1685
1686 - `type: "code_execution_20260521"`
1687
1688 - `"code_execution_20260521"`
1689
1690 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
1691
1692 - `"direct"`
1693
1694 - `"code_execution_20250825"`
1695
1696 - `"code_execution_20260120"`
1697
1698 - `"code_execution_20260521"`
1699
1700 - `cache_control: optional CacheControlEphemeral or null`
1701
1702 Create a cache control breakpoint at this content block.
1703
1704 - `defer_loading: optional boolean`
1705
1706 If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
1707
1708 - `strict: optional boolean`
1709
1710 When true, guarantees schema validation on tool names and inputs
1711
1712 - `BrowserToolset20260801 object { type, allowed_callers, cache_control, configs }`
1659 - `BrowserToolset20260801 object`
17131660
17141661 The browser toolset: a single `tools[]` entry (carrying no
17151662 `name`) that declares the browser tool family. The model is served
from line 1664
17171664 from its schema.
17181665
17191666 - `type: "browser_toolset_20260801"`
1720
1721 - `"browser_toolset_20260801"`
17221667
17231668 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
17241669
from line 2060
21152060
21162061 Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
21172062
2118 - `MemoryTool20250818 object { name, type, allowed_callers, 4 more }`
2063 - `MemoryTool20250818 object`
21192064
21202065 - `name: "memory"`
21212066
from line 2068
21232068
21242069 This is how the tool will be called by the model and in `tool_use` blocks.
21252070
2126 - `"memory"`
2127
21282071 - `type: "memory_20250818"`
21292072
2130 - `"memory_20250818"`
2131
21322073 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
21332074
21342075 - `"direct"`
from line 2094
21532094
21542095 When true, guarantees schema validation on tool names and inputs
21552096
2156 - `ComputerToolset20260801 object { type, allowed_callers, cache_control, configs }`
2097 - `ComputerToolset20260801 object`
21572098
21582099 The computer toolset: a single `tools[]` entry (carrying no
21592100 `name`) that declares the computer tool family. The model is
from line 2107
21662107
21672108 - `type: "computer_toolset_20260801"`
21682109
2169 - `"computer_toolset_20260801"`
2170
21712110 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
21722111
21732112 - `"direct"`
from line 2334
23952334
23962335 Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
23972336
2398 - `ToolTextEditor20250124 object { name, type, allowed_callers, 4 more }`
2337 - `ToolTextEditor20250124 object`
23992338
24002339 - `name: "str_replace_editor"`
24012340
from line 2342
24032342
24042343 This is how the tool will be called by the model and in `tool_use` blocks.
24052344
2406 - `"str_replace_editor"`
2407
24082345 - `type: "text_editor_20250124"`
24092346
2410 - `"text_editor_20250124"`
2411
24122347 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
24132348
24142349 - `"direct"`
from line 2368
24332368
24342369 When true, guarantees schema validation on tool names and inputs
24352370
2436 - `ToolTextEditor20250429 object { name, type, allowed_callers, 4 more }`
2371 - `ToolTextEditor20250429 object`
24372372
24382373 - `name: "str_replace_based_edit_tool"`
24392374
from line 2376
24412376
24422377 This is how the tool will be called by the model and in `tool_use` blocks.
24432378
2444 - `"str_replace_based_edit_tool"`
2445
24462379 - `type: "text_editor_20250429"`
24472380
2448 - `"text_editor_20250429"`
2449
24502381 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
24512382
24522383 - `"direct"`
from line 2402
24712402
24722403 When true, guarantees schema validation on tool names and inputs
24732404
2474 - `ToolTextEditor20250728 object { name, type, allowed_callers, 5 more }`
2405 - `ToolTextEditor20250728 object`
24752406
24762407 - `name: "str_replace_based_edit_tool"`
24772408
from line 2410
24792410
24802411 This is how the tool will be called by the model and in `tool_use` blocks.
24812412
2482 - `"str_replace_based_edit_tool"`
2483
24842413 - `type: "text_editor_20250728"`
24852414
2486 - `"text_editor_20250728"`
2487
24882415 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
24892416
24902417 - `"direct"`
from line 2436
25092436
25102437 Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.
25112438
2439 minimum: 1
2440
25122441 - `strict: optional boolean`
25132442
25142443 When true, guarantees schema validation on tool names and inputs
25152444
2516 - `WebSearchTool20250305 object { name, type, allowed_callers, 7 more }`
2445 - `WebSearchTool20250305 object`
25172446
25182447 - `name: "web_search"`
25192448
from line 2450
25212450
25222451 This is how the tool will be called by the model and in `tool_use` blocks.
25232452
2524 - `"web_search"`
2525
25262453 - `type: "web_search_20250305"`
25272454
2528 - `"web_search_20250305"`
2529
25302455 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
25312456
25322457 - `"direct"`
from line 2482
25572482
25582483 Maximum number of times the tool can be used in the API request.
25592484
2485 exclusiveMinimum: 0
2486
25602487 - `strict: optional boolean`
25612488
25622489 When true, guarantees schema validation on tool names and inputs
from line 2494
25672494
25682495 - `type: "approximate"`
25692496
2570 - `"approximate"`
2571
25722497 - `city: optional string or null`
25732498
25742499 The city of the user.
25752500
2501 maxLength: 255, minLength: 1
2502
25762503 - `country: optional string or null`
25772504
25782505 The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user.
25792506
2507 maxLength: 2, minLength: 2
2508
25802509 - `region: optional string or null`
25812510
25822511 The region of the user.
25832512
2513 maxLength: 255, minLength: 1
2514
25842515 - `timezone: optional string or null`
25852516
25862517 The [IANA timezone](https://nodatime.org/TimeZones) of the user.
25872518
2588 - `WebFetchTool20250910 object { name, type, allowed_callers, 8 more }`
2519 maxLength: 255, minLength: 1
2520
2521 - `WebFetchTool20250910 object`
25892522
25902523 - `name: "web_fetch"`
25912524
from line 2526
25932526
25942527 This is how the tool will be called by the model and in `tool_use` blocks.
25952528
2596 - `"web_fetch"`
2597
25982529 - `type: "web_fetch_20250910"`
25992530
2600 - `"web_fetch_20250910"`
2601
26022531 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
26032532
26042533 - `"direct"`
from line 2562
26332562
26342563 Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
26352564
2565 exclusiveMinimum: 0
2566
26362567 - `max_uses: optional number or null`
26372568
26382569 Maximum number of times the tool can be used in the API request.
26392570
2571 exclusiveMinimum: 0
2572
26402573 - `strict: optional boolean`
26412574
26422575 When true, guarantees schema validation on tool names and inputs
26432576
2644 - `WebSearchTool20260209 object { name, type, allowed_callers, 7 more }`
2577 - `WebSearchTool20260209 object`
26452578
26462579 - `name: "web_search"`
26472580
from line 2582
26492582
26502583 This is how the tool will be called by the model and in `tool_use` blocks.
26512584
2652 - `"web_search"`
2653
26542585 - `type: "web_search_20260209"`
26552586
2656 - `"web_search_20260209"`
2657
26582587 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
26592588
26602589 - `"direct"`
from line 2614
26852614
26862615 Maximum number of times the tool can be used in the API request.
26872616
2617 exclusiveMinimum: 0
2618
26882619 - `strict: optional boolean`
26892620
26902621 When true, guarantees schema validation on tool names and inputs
from line 2624
26932624
26942625 Parameters for the user's location. Used to provide more relevant search results.
26952626
2696 - `WebFetchTool20260209 object { name, type, allowed_callers, 8 more }`
2627 - `WebFetchTool20260209 object`
26972628
26982629 - `name: "web_fetch"`
26992630
from line 2632
27012632
27022633 This is how the tool will be called by the model and in `tool_use` blocks.
27032634
2704 - `"web_fetch"`
2705
27062635 - `type: "web_fetch_20260209"`
27072636
2708 - `"web_fetch_20260209"`
2709
27102637 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
27112638
27122639 - `"direct"`
from line 2668
27412668
27422669 Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
27432670
2671 exclusiveMinimum: 0
2672
27442673 - `max_uses: optional number or null`
27452674
27462675 Maximum number of times the tool can be used in the API request.
27472676
2677 exclusiveMinimum: 0
2678
27482679 - `strict: optional boolean`
27492680
27502681 When true, guarantees schema validation on tool names and inputs
27512682
2752 - `WebFetchTool20260309 object { name, type, allowed_callers, 9 more }`
2683 - `WebFetchTool20260309 object`
27532684
27542685 Web fetch tool with use_cache parameter for bypassing cached content.
27552686
from line 2690
27592690
27602691 This is how the tool will be called by the model and in `tool_use` blocks.
27612692
2762 - `"web_fetch"`
2763
27642693 - `type: "web_fetch_20260309"`
27652694
2766 - `"web_fetch_20260309"`
2767
27682695 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
27692696
27702697 - `"direct"`
from line 2726
27992726
28002727 Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
28012728
2729 exclusiveMinimum: 0
2730
28022731 - `max_uses: optional number or null`
28032732
28042733 Maximum number of times the tool can be used in the API request.
28052734
2735 exclusiveMinimum: 0
2736
28062737 - `strict: optional boolean`
28072738
28082739 When true, guarantees schema validation on tool names and inputs
from line 2742
28112742
28122743 Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources.
28132744
2814 - `WebSearchTool20260318 object { name, type, allowed_callers, 8 more }`
2745 - `WebSearchTool20260318 object`
28152746
28162747 - `name: "web_search"`
28172748
from line 2750
28192750
28202751 This is how the tool will be called by the model and in `tool_use` blocks.
28212752
2822 - `"web_search"`
2823
28242753 - `type: "web_search_20260318"`
28252754
2826 - `"web_search_20260318"`
2827
28282755 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
28292756
28302757 - `"direct"`
from line 2782
28552782
28562783 Maximum number of times the tool can be used in the API request.
28572784
2785 exclusiveMinimum: 0
2786
28582787 - `response_inclusion: optional "full" or "excluded"`
28592788
28602789 How this tool's result blocks appear in the API response when the result was consumed by a completed code_execution call in the same turn. 'full' returns the complete content (default). 'excluded' drops the nested server_tool_use and result block pair entirely. Results from direct calls, or from code_execution calls that paused before completing, are always returned in full so they can be sent back on the next turn.
from line 2800
28712800
28722801 Parameters for the user's location. Used to provide more relevant search results.
28732802
2874 - `WebFetchTool20260318 object { name, type, allowed_callers, 10 more }`
2803 - `WebFetchTool20260318 object`
28752804
28762805 - `name: "web_fetch"`
28772806
from line 2808
28792808
28802809 This is how the tool will be called by the model and in `tool_use` blocks.
28812810
2882 - `"web_fetch"`
2883
28842811 - `type: "web_fetch_20260318"`
28852812
2886 - `"web_fetch_20260318"`
2887
28882813 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
28892814
28902815 - `"direct"`
from line 2844
29192844
29202845 Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
29212846
2847 exclusiveMinimum: 0
2848
29222849 - `max_uses: optional number or null`
29232850
29242851 Maximum number of times the tool can be used in the API request.
29252852
2853 exclusiveMinimum: 0
2854
29262855 - `response_inclusion: optional "full" or "excluded"`
29272856
29282857 How this tool's result blocks appear in the API response when the result was consumed by a completed code_execution call in the same turn. 'full' returns the complete content (default). 'excluded' drops the nested server_tool_use and result block pair entirely. Results from direct calls, or from code_execution calls that paused before completing, are always returned in full so they can be sent back on the next turn.
from line 2868
29392868
29402869 Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources.
29412870
2942 - `ToolSearchToolBm25_20251119 object { name, type, allowed_callers, 3 more }`
2871 - `ToolSearchToolBm25_20251119 object`
29432872
29442873 - `name: "tool_search_tool_bm25"`
29452874
from line 2876
29472876
29482877 This is how the tool will be called by the model and in `tool_use` blocks.
29492878
2879 - `type: "tool_search_tool_bm25_20251119" or "tool_search_tool_bm25"`
2880
2881 - `"tool_search_tool_bm25_20251119"`
2882
29502883 - `"tool_search_tool_bm25"`
29512884
2952 - `type: "tool_search_tool_bm25_20251119" or "tool_search_tool_bm25"`
2953
2954 - `"tool_search_tool_bm25_20251119"`
2955
2956 - `"tool_search_tool_bm25"`
2957
29582885 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
29592886
29602887 - `"direct"`
from line 2904
29772904
29782905 When true, guarantees schema validation on tool names and inputs
29792906
2980 - `ToolSearchToolRegex20251119 object { name, type, allowed_callers, 3 more }`
2907 - `ToolSearchToolRegex20251119 object`
29812908
29822909 - `name: "tool_search_tool_regex"`
29832910
from line 2912
29852912
29862913 This is how the tool will be called by the model and in `tool_use` blocks.
29872914
2915 - `type: "tool_search_tool_regex_20251119" or "tool_search_tool_regex"`
2916
2917 - `"tool_search_tool_regex_20251119"`
2918
29882919 - `"tool_search_tool_regex"`
29892920
2990 - `type: "tool_search_tool_regex_20251119" or "tool_search_tool_regex"`
2991
2992 - `"tool_search_tool_regex_20251119"`
2993
2994 - `"tool_search_tool_regex"`
2995
29962921 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
29972922
29982923 - `"direct"`
from line 2940
30152940
30162941 When true, guarantees schema validation on tool names and inputs
30172942
2943- `temperature: optional number`
2944
2945 **Deprecated**: Deprecated. Models released after Claude Opus 4.6 do not support setting temperature. A value of 1.0 of will be accepted for backwards compatibility, all other values will be rejected with a 400 error.
2946
2947 Amount of randomness injected into the response.
2948
2949 Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.
2950
2951 Note that even with `temperature` of `0.0`, the results will not be fully deterministic.
2952
2953 maximum: 1, minimum: 0
2954
30182955- `top_k: optional number`
30192956
2957 **Deprecated**: Deprecated. Models released after Claude Opus 4.6 do not accept top_k; any value will be rejected with a 400 error.
2958
30202959 Only sample from the top K options for each subsequent token.
30212960
30222961 Used to remove "long tail" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
30232962
30242963 Recommended for advanced use cases only.
30252964
2965 minimum: 0
2966
30262967- `top_p: optional number`
30272968
2969 **Deprecated**: Deprecated. Models released after Claude Opus 4.6 do not support setting top_p. A value >= 0.99 will be accepted for backwards compatibility, all other values will be rejected with a 400 error.
2970
30282971 Use nucleus sampling.
30292972
30302973 In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`.
30312974
30322975 Recommended for advanced use cases only.
30332976
3034### Returns
3035
3036- `Message object { id, container, content, 7 more }`
2977 maximum: 1, minimum: 0
2978
2979## Returns
2980
2981- `Message object`
30372982
30382983 - `id: string`
30392984
from line 2998
30532998
30542999 The time at which the container will expire.
30553000
3001 format: date-time
3002
30563003 - `skills: array of ContainerSkill or null`
30573004
30583005 Skills loaded in the container
from line 3008
30613008
30623009 Skill ID
30633010
3011 maxLength: 64, minLength: 1
3012
30643013 - `type: "anthropic" or "custom"`
30653014
30663015 Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)
from line 3021
30723021 - `version: string`
30733022
30743023 The resolved version: a skill version ID for custom skills.
3024
3025 maxLength: 64, minLength: 1
30753026
30763027 - `content: array of ContentBlock`
30773028
from line 3053
31023053 [{"type": "text", "text": "B)"}]
31033054 ```
31043055
3105 - `TextBlock object { citations, text, type }`
3056 - `TextBlock object`
31063057
31073058 - `citations: array of TextCitation or null`
31083059
from line 3061
31103061
31113062 The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.
31123063
3113 - `CitationCharLocation object { cited_text, document_index, document_title, 4 more }`
3064 - `CitationCharLocation object`
31143065
31153066 - `cited_text: string`
31163067
31173068 - `document_index: number`
31183069
3070 minimum: 0
3071
31193072 - `document_title: string or null`
31203073
31213074 - `end_char_index: number`
from line 3077
31243077
31253078 - `start_char_index: number`
31263079
3080 minimum: 0
3081
31273082 - `type: "char_location"`
31283083
3129 - `"char_location"`
3130
3131 - `CitationPageLocation object { cited_text, document_index, document_title, 4 more }`
3084 default: char_location
3085
3086 - `CitationPageLocation object`
31323087
31333088 - `cited_text: string`
31343089
31353090 - `document_index: number`
31363091
3092 minimum: 0
3093
31373094 - `document_title: string or null`
31383095
31393096 - `end_page_number: number`
from line 3099
31423099
31433100 - `start_page_number: number`
31443101
3102 minimum: 1
3103
31453104 - `type: "page_location"`
31463105
3147 - `"page_location"`
3148
3149 - `CitationContentBlockLocation object { cited_text, document_index, document_title, 4 more }`
3106 default: page_location
3107
3108 - `CitationContentBlockLocation object`
31503109
31513110 - `cited_text: string`
31523111
from line 3115
31563115
31573116 - `document_index: number`
31583117
3118 minimum: 0
3119
31593120 - `document_title: string or null`
31603121
31613122 - `end_block_index: number`
from line 3131
31703131
31713132 0-based index of the first cited block in the source's `content` array.
31723133
3134 minimum: 0
3135
31733136 - `type: "content_block_location"`
31743137
3175 - `"content_block_location"`
3176
3177 - `CitationsWebSearchResultLocation object { cited_text, encrypted_index, title, 2 more }`
3138 default: content_block_location
3139
3140 - `CitationsWebSearchResultLocation object`
31783141
31793142 - `cited_text: string`
31803143
from line 3145
31823145
31833146 - `title: string or null`
31843147
3148 maxLength: 512
3149
31853150 - `type: "web_search_result_location"`
31863151
3187 - `"web_search_result_location"`
3152 default: web_search_result_location
31883153
31893154 - `url: string`
31903155
3191 - `CitationsSearchResultLocation object { cited_text, end_block_index, search_result_index, 4 more }`
3156 - `CitationsSearchResultLocation object`
31923157
31933158 - `cited_text: string`
31943159
from line 3173
32083173
32093174 Counted separately from `document_index`; server-side web search results are not included in this count.
32103175
3176 minimum: 0
3177
32113178 - `source: string`
32123179
32133180 - `start_block_index: number`
32143181
32153182 0-based index of the first cited block in the source's `content` array.
32163183
3184 minimum: 0
3185
32173186 - `title: string or null`
32183187
32193188 - `type: "search_result_location"`
32203189
3221 - `"search_result_location"`
3190 default: search_result_location
32223191
32233192 - `text: string`
32243193
3194 maxLength: 5000000, minLength: 0
3195
32253196 - `type: "text"`
32263197
3227 - `"text"`
3228
3229 - `ThinkingBlock object { signature, thinking, type }`
3198 default: text
3199
3200 - `ThinkingBlock object`
32303201
32313202 - `signature: string`
32323203
from line 3213
32423213
32433214 - `type: "thinking"`
32443215
3245 - `"thinking"`
3246
3247 - `RedactedThinkingBlock object { data, type }`
3216 default: thinking
3217
3218 - `RedactedThinkingBlock object`
32483219
32493220 - `data: string`
32503221
from line 3227
32563227
32573228 - `type: "redacted_thinking"`
32583229
3259 - `"redacted_thinking"`
3260
3261 - `ToolUseBlock object { id, caller, input, 3 more }`
3230 default: redacted_thinking
3231
3232 - `ToolUseBlock object`
32623233
32633234 - `id: string`
32643235
3236 pattern: ^[a-zA-Z0-9_-]+$
3237
32653238 - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120`
32663239
32673240 Tool invocation directly from the model.
32683241
3269 - `DirectCaller object { type }`
3242 default: {"type":"direct"}
3243
3244 - `DirectCaller object`
32703245
32713246 Tool invocation directly from the model.
32723247
32733248 - `type: "direct"`
32743249
3275 - `"direct"`
3276
3277 - `ServerToolCaller object { tool_id, type }`
3250 - `ServerToolCaller object`
32783251
32793252 Tool invocation generated by a server-side tool.
32803253
32813254 - `tool_id: string`
32823255
3256 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
3257
32833258 - `type: "code_execution_20250825"`
32843259
3285 - `"code_execution_20250825"`
3286
3287 - `ServerToolCaller20260120 object { tool_id, type }`
3260 - `ServerToolCaller20260120 object`
32883261
32893262 - `tool_id: string`
32903263
3264 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
3265
32913266 - `type: "code_execution_20260120"`
32923267
3293 - `"code_execution_20260120"`
3294
32953268 - `input: map[unknown]`
32963269
32973270 - `name: string`
32983271
3272 minLength: 1
3273
32993274 - `type: "tool_use"`
33003275
3301 - `"tool_use"`
3276 default: tool_use
33023277
33033278 - `toolset_name: optional string or null`
33043279
33053280 For a toolset member tool_use, the toolset family.
33063281
3307 - `ServerToolUseBlock object { id, caller, input, 2 more }`
3282 maxLength: 64, minLength: 1, pattern: ^[a-zA-Z0-9_-]+$
3283
3284 - `ServerToolUseBlock object`
33083285
33093286 - `id: string`
33103287
3288 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
3289
33113290 - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120`
33123291
33133292 Tool invocation directly from the model.
33143293
3315 - `DirectCaller object { type }`
3294 default: {"type":"direct"}
3295
3296 - `DirectCaller object`
33163297
33173298 Tool invocation directly from the model.
33183299
3319 - `ServerToolCaller object { tool_id, type }`
3300 - `ServerToolCaller object`
33203301
33213302 Tool invocation generated by a server-side tool.
33223303
3323 - `ServerToolCaller20260120 object { tool_id, type }`
3304 - `ServerToolCaller20260120 object`
33243305
33253306 - `input: map[unknown]`
33263307
from line 3323
33423323
33433324 - `type: "server_tool_use"`
33443325
3345 - `"server_tool_use"`
3346
3347 - `WebSearchToolResultBlock object { caller, content, tool_use_id, type }`
3326 default: server_tool_use
3327
3328 - `WebSearchToolResultBlock object`
33483329
33493330 - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120`
33503331
33513332 Tool invocation directly from the model.
33523333
3353 - `DirectCaller object { type }`
3334 default: {"type":"direct"}
3335
3336 - `DirectCaller object`
33543337
33553338 Tool invocation directly from the model.
33563339
3357 - `ServerToolCaller object { tool_id, type }`
3340 - `ServerToolCaller object`
33583341
33593342 Tool invocation generated by a server-side tool.
33603343
3361 - `ServerToolCaller20260120 object { tool_id, type }`
3344 - `ServerToolCaller20260120 object`
33623345
33633346 - `content: WebSearchToolResultBlockContent`
33643347
3365 - `WebSearchToolResultError object { error_code, type }`
3348 - `WebSearchToolResultError object`
33663349
33673350 - `error_code: WebSearchToolResultErrorCode`
33683351
from line 3363
33803363
33813364 - `type: "web_search_tool_result_error"`
33823365
3383 - `"web_search_tool_result_error"`
3366 default: web_search_tool_result_error
33843367
33853368 - `array of WebSearchResultBlock`
33863369
from line 3375
33923375
33933376 - `type: "web_search_result"`
33943377
3395 - `"web_search_result"`
3378 default: web_search_result
33963379
33973380 - `url: string`
33983381
33993382 - `tool_use_id: string`
34003383
3384 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
3385
34013386 - `type: "web_search_tool_result"`
34023387
3403 - `"web_search_tool_result"`
3404
3405 - `WebFetchToolResultBlock object { caller, content, tool_use_id, type }`
3388 default: web_search_tool_result
3389
3390 - `WebFetchToolResultBlock object`
34063391
34073392 - `caller: DirectCaller or ServerToolCaller or ServerToolCaller20260120`
34083393
34093394 Tool invocation directly from the model.
34103395
3411 - `DirectCaller object { type }`
3396 default: {"type":"direct"}
3397
3398 - `DirectCaller object`
34123399
34133400 Tool invocation directly from the model.
34143401
3415 - `ServerToolCaller object { tool_id, type }`
3402 - `ServerToolCaller object`
34163403
34173404 Tool invocation generated by a server-side tool.
34183405
3419 - `ServerToolCaller20260120 object { tool_id, type }`
3406 - `ServerToolCaller20260120 object`
34203407
34213408 - `content: WebFetchToolResultErrorBlock or WebFetchBlock`
34223409
3423 - `WebFetchToolResultErrorBlock object { error_code, type }`
3410 - `WebFetchToolResultErrorBlock object`
34243411
34253412 - `error_code: WebFetchToolResultErrorCode`
34263413
from line 3431
34443431
34453432 - `type: "web_fetch_tool_result_error"`
34463433
3447 - `"web_fetch_tool_result_error"`
3448
3449 - `WebFetchBlock object { content, retrieved_at, type, url }`
3434 default: web_fetch_tool_result_error
3435
3436 - `WebFetchBlock object`
34503437
34513438 - `content: DocumentBlock`
34523439
from line 3443
34563443
34573444 - `enabled: boolean`
34583445
3446 default: false
3447
34593448 - `source: Base64PDFSource or PlainTextSource`
34603449
3461 - `Base64PDFSource object { data, media_type, type }`
3450 - `Base64PDFSource object`
34623451
34633452 - `data: string`
34643453
3454 format: byte
3455
34653456 - `media_type: "application/pdf"`
34663457
3467 - `"application/pdf"`
3468
34693458 - `type: "base64"`
34703459
3471 - `"base64"`
3472
3473 - `PlainTextSource object { data, media_type, type }`
3460 - `PlainTextSource object`
34743461
34753462 - `data: string`
34763463
34773464 - `media_type: "text/plain"`
34783465
3479 - `"text/plain"`
3480
34813466 - `type: "text"`
34823467
3483 - `"text"`
3484
34853468 - `title: string or null`
34863469
34873470 The title of the document
34883471
34893472 - `type: "document"`
34903473
3491 - `"document"`
3474 default: document
34923475
34933476 - `retrieved_at: string or null`
34943477
from line 3479
34963479
34973480 - `type: "web_fetch_result"`
34983481
3499 - `"web_fetch_result"`
3482 default: web_fetch_result
35003483
35013484 - `url: string`
35023485
from line 3487
35043487
35053488 - `tool_use_id: string`
35063489
3490 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
3491
35073492 - `type: "web_fetch_tool_result"`
35083493
3509 - `"web_fetch_tool_result"`
3510
3511 - `CodeExecutionToolResultBlock object { content, tool_use_id, type }`
3494 default: web_fetch_tool_result
3495
3496 - `CodeExecutionToolResultBlock object`
35123497
35133498 - `content: CodeExecutionToolResultBlockContent`
35143499
35153500 Code execution result with encrypted stdout for PFC + web_search results.
35163501
3517 - `CodeExecutionToolResultError object { error_code, type }`
3502 - `CodeExecutionToolResultError object`
35183503
35193504 - `error_code: CodeExecutionToolResultErrorCode`
35203505
from line 3513
35283513
35293514 - `type: "code_execution_tool_result_error"`
35303515
3531 - `"code_execution_tool_result_error"`
3532
3533 - `CodeExecutionResultBlock object { content, return_code, stderr, 2 more }`
3516 default: code_execution_tool_result_error
3517
3518 - `CodeExecutionResultBlock object`
35343519
35353520 - `content: array of CodeExecutionOutputBlock`
35363521
from line 3523
35383523
35393524 - `type: "code_execution_output"`
35403525
3541 - `"code_execution_output"`
3526 default: code_execution_output
35423527
35433528 - `return_code: number`
35443529
from line 3533
35483533
35493534 - `type: "code_execution_result"`
35503535
3551 - `"code_execution_result"`
3552
3553 - `EncryptedCodeExecutionResultBlock object { content, encrypted_stdout, return_code, 2 more }`
3536 default: code_execution_result
3537
3538 - `EncryptedCodeExecutionResultBlock object`
35543539
35553540 Code execution result with encrypted stdout for PFC + web_search results.
35563541
from line 3545
35603545
35613546 - `type: "code_execution_output"`
35623547
3548 default: code_execution_output
3549
35633550 - `encrypted_stdout: string`
35643551
35653552 - `return_code: number`
from line 3555
35683555
35693556 - `type: "encrypted_code_execution_result"`
35703557
3571 - `"encrypted_code_execution_result"`
3558 default: encrypted_code_execution_result
35723559
35733560 - `tool_use_id: string`
35743561
3562 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
3563
35753564 - `type: "code_execution_tool_result"`
35763565
3577 - `"code_execution_tool_result"`
3578
3579 - `BashCodeExecutionToolResultBlock object { content, tool_use_id, type }`
3566 default: code_execution_tool_result
3567
3568 - `BashCodeExecutionToolResultBlock object`
35803569
35813570 - `content: BashCodeExecutionToolResultError or BashCodeExecutionResultBlock`
35823571
3583 - `BashCodeExecutionToolResultError object { error_code, type }`
3572 - `BashCodeExecutionToolResultError object`
35843573
35853574 - `error_code: BashCodeExecutionToolResultErrorCode`
35863575
from line 3585
35963585
35973586 - `type: "bash_code_execution_tool_result_error"`
35983587
3599 - `"bash_code_execution_tool_result_error"`
3600
3601 - `BashCodeExecutionResultBlock object { content, return_code, stderr, 2 more }`
3588 default: bash_code_execution_tool_result_error
3589
3590 - `BashCodeExecutionResultBlock object`
36023591
36033592 - `content: array of BashCodeExecutionOutputBlock`
36043593
from line 3595
36063595
36073596 - `type: "bash_code_execution_output"`
36083597
3609 - `"bash_code_execution_output"`
3598 default: bash_code_execution_output
36103599
36113600 - `return_code: number`
36123601
from line 3605
36163605
36173606 - `type: "bash_code_execution_result"`
36183607
3619 - `"bash_code_execution_result"`
3608 default: bash_code_execution_result
36203609
36213610 - `tool_use_id: string`
36223611
3612 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
3613
36233614 - `type: "bash_code_execution_tool_result"`
36243615
3625 - `"bash_code_execution_tool_result"`
3626
3627 - `TextEditorCodeExecutionToolResultBlock object { content, tool_use_id, type }`
3616 default: bash_code_execution_tool_result
3617
3618 - `TextEditorCodeExecutionToolResultBlock object`
36283619
36293620 - `content: TextEditorCodeExecutionToolResultError or TextEditorCodeExecutionViewResultBlock or TextEditorCodeExecutionCreateResultBlock or TextEditorCodeExecutionStrReplaceResultBlock`
36303621
3631 - `TextEditorCodeExecutionToolResultError object { error_code, error_message, type }`
3622 - `TextEditorCodeExecutionToolResultError object`
36323623
36333624 - `error_code: TextEditorCodeExecutionToolResultErrorCode`
36343625
from line 3637
36463637
36473638 - `type: "text_editor_code_execution_tool_result_error"`
36483639
3649 - `"text_editor_code_execution_tool_result_error"`
3650
3651 - `TextEditorCodeExecutionViewResultBlock object { content, file_type, num_lines, 3 more }`
3640 default: text_editor_code_execution_tool_result_error
3641
3642 - `TextEditorCodeExecutionViewResultBlock object`
36523643
36533644 - `content: string`
36543645
from line 3659
36683659
36693660 - `type: "text_editor_code_execution_view_result"`
36703661
3671 - `"text_editor_code_execution_view_result"`
3672
3673 - `TextEditorCodeExecutionCreateResultBlock object { is_file_update, type }`
3662 default: text_editor_code_execution_view_result
3663
3664 - `TextEditorCodeExecutionCreateResultBlock object`
36743665
36753666 - `is_file_update: boolean`
36763667
36773668 - `type: "text_editor_code_execution_create_result"`
36783669
3679 - `"text_editor_code_execution_create_result"`
3680
3681 - `TextEditorCodeExecutionStrReplaceResultBlock object { lines, new_lines, new_start, 3 more }`
3670 default: text_editor_code_execution_create_result
3671
3672 - `TextEditorCodeExecutionStrReplaceResultBlock object`
36823673
36833674 - `lines: array of string or null`
36843675
from line 3683
36923683
36933684 - `type: "text_editor_code_execution_str_replace_result"`
36943685
3695 - `"text_editor_code_execution_str_replace_result"`
3686 default: text_editor_code_execution_str_replace_result
36963687
36973688 - `tool_use_id: string`
36983689
3690 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
3691
36993692 - `type: "text_editor_code_execution_tool_result"`
37003693
3701 - `"text_editor_code_execution_tool_result"`
3702
3703 - `ToolSearchToolResultBlock object { content, tool_use_id, type }`
3694 default: text_editor_code_execution_tool_result
3695
3696 - `ToolSearchToolResultBlock object`
37043697
37053698 - `content: ToolSearchToolResultError or ToolSearchToolSearchResultBlock`
37063699
3707 - `ToolSearchToolResultError object { error_code, error_message, type }`
3700 - `ToolSearchToolResultError object`
37083701
37093702 - `error_code: ToolSearchToolResultErrorCode`
37103703
from line 3713
37203713
37213714 - `type: "tool_search_tool_result_error"`
37223715
3723 - `"tool_search_tool_result_error"`
3724
3725 - `ToolSearchToolSearchResultBlock object { tool_references, type }`
3716 default: tool_search_tool_result_error
3717
3718 - `ToolSearchToolSearchResultBlock object`
37263719
37273720 - `tool_references: array of ToolReferenceBlock`
37283721
37293722 - `tool_name: string`
37303723
3724 maxLength: 256, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,256}$
3725
37313726 - `type: "tool_reference"`
37323727
3733 - `"tool_reference"`
3728 default: tool_reference
37343729
37353730 - `type: "tool_search_tool_search_result"`
37363731
3737 - `"tool_search_tool_search_result"`
3732 default: tool_search_tool_search_result
37383733
37393734 - `tool_use_id: string`
37403735
3736 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
3737
37413738 - `type: "tool_search_tool_result"`
37423739
3743 - `"tool_search_tool_result"`
3744
3745 - `ContainerUploadBlock object { file_id, type }`
3740 default: tool_search_tool_result
3741
3742 - `ContainerUploadBlock object`
37463743
37473744 Response model for a file uploaded to the container.
37483745
from line 3747
37503747
37513748 - `type: "container_upload"`
37523749
3753 - `"container_upload"`
3750 default: container_upload
37543751
37553752 - `model: Model`
37563753
from line 3829
38323829
38333830 This will always be `"assistant"`.
38343831
3835 - `"assistant"`
3832 default: assistant
38363833
38373834 - `stop_details: RefusalStopDetails or null`
38383835
from line 3867
38703867
38713868 - `type: "refusal"`
38723869
3873 - `"refusal"`
3870 default: refusal
38743871
38753872 - `stop_reason: StopReason or null`
38763873
from line 3911
39143911
39153912 For Messages, this is always `"message"`.
39163913
3917 - `"message"`
3914 default: message
39183915
39193916 - `usage: Usage`
39203917
from line 3933
39363933
39373934 The number of input tokens used to create the 1 hour cache entry.
39383935
3936 default: 0, minimum: 0
3937
39393938 - `ephemeral_5m_input_tokens: number`
39403939
39413940 The number of input tokens used to create the 5 minute cache entry.
39423941
3942 default: 0, minimum: 0
3943
39433944 - `cache_creation_input_tokens: number or null`
39443945
39453946 The number of input tokens used to create the cache entry.
39463947
3948 minimum: 0
3949
39473950 - `cache_read_input_tokens: number or null`
39483951
39493952 The number of input tokens read from the cache.
39503953
3954 minimum: 0
3955
39513956 - `inference_geo: string or null`
39523957
39533958 The geographic region where inference was performed for this request.
from line 3961
39563961
39573962 The number of input tokens which were used.
39583963
3964 minimum: 0
3965
39593966 - `output_tokens: number`
39603967
39613968 The number of output tokens which were used.
3969
3970 minimum: 0
39623971
39633972 - `output_tokens_details: OutputTokensDetails or null`
39643973
from line 3989
39803989 generation count by a small number of tokens. Always ≤ `output_tokens`;
39813990 `output_tokens - thinking_tokens` approximates the non-reasoning output.
39823991
3992 default: 0, minimum: 0
3993
39833994 - `server_tool_use: ServerToolUsage or null`
39843995
39853996 The number of server tool requests.
from line 3999
39883999
39894000 The number of web fetch tool requests.
39904001
4002 default: 0, minimum: 0
4003
39914004 - `web_search_requests: number`
39924005
39934006 The number of web search tool requests.
39944007
4008 default: 0, minimum: 0
4009
39954010 - `service_tier: "standard" or "priority" or "batch" or null`
39964011
39974012 If the request used the priority, standard, or batch tier.
from line 4017
40024017
40034018 - `"batch"`
40044019
4005### Example
4006
4007```http
4020- `RawMessageStreamEvent = RawMessageStartEvent or RawMessageDeltaEvent or RawMessageStopEvent or 3 more`
4021
4022 - `RawMessageStartEvent object`
4023
4024 - `message: Message`
4025
4026 - `type: "message_start"`
4027
4028 default: message_start
4029
4030 - `RawMessageDeltaEvent object`
4031
4032 - `delta: object`
4033
4034 - `container: Container or null`
4035
4036 Information about the container used in the request (for the code execution tool)
4037
4038 - `stop_details: RefusalStopDetails or null`
4039
4040 Structured information about a refusal.
4041
4042 - `stop_reason: StopReason or null`
4043
4044 - `stop_sequence: string or null`
4045
4046 - `type: "message_delta"`
4047
4048 default: message_delta
4049
4050 - `usage: MessageDeltaUsage`
4051
4052 Billing and rate-limit usage.
4053
4054 Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.
4055
4056 Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.
4057
4058 For example, `output_tokens` will be non-zero, even for an empty string response from Claude.
4059
4060 Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.
4061
4062 - `cache_creation_input_tokens: number or null`
4063
4064 The cumulative number of input tokens used to create the cache entry.
4065
4066 minimum: 0
4067
4068 - `cache_read_input_tokens: number or null`
4069
4070 The cumulative number of input tokens read from the cache.
4071
4072 minimum: 0
4073
4074 - `input_tokens: number or null`
4075
4076 The cumulative number of input tokens which were used.
4077
4078 minimum: 0
4079
4080 - `output_tokens: number`
4081
4082 The cumulative number of output tokens which were used.
4083
4084 - `output_tokens_details: OutputTokensDetails or null`
4085
4086 Breakdown of output tokens by category.
4087
4088 `output_tokens` remains the inclusive, authoritative total used for billing.
4089 This object provides a read-only decomposition for observability — for example,
4090 how many of the billed output tokens were spent on internal reasoning that may
4091 have been summarized before being returned to you.
4092
4093 - `server_tool_use: ServerToolUsage or null`
4094
4095 The number of server tool requests.
4096
4097 - `RawMessageStopEvent object`
4098
4099 - `type: "message_stop"`
4100
4101 default: message_stop
4102
4103 - `RawContentBlockStartEvent object`
4104
4105 - `content_block: TextBlock or ThinkingBlock or RedactedThinkingBlock or 9 more`
4106
4107 Response model for a file uploaded to the container.
4108
4109 - `TextBlock object`
4110
4111 - `ThinkingBlock object`
4112
4113 - `RedactedThinkingBlock object`
4114
4115 - `ToolUseBlock object`
4116
4117 - `ServerToolUseBlock object`
4118
4119 - `WebSearchToolResultBlock object`
4120
4121 - `WebFetchToolResultBlock object`
4122
4123 - `CodeExecutionToolResultBlock object`
4124
4125 - `BashCodeExecutionToolResultBlock object`
4126
4127 - `TextEditorCodeExecutionToolResultBlock object`
4128
4129 - `ToolSearchToolResultBlock object`
4130
4131 - `ContainerUploadBlock object`
4132
4133 Response model for a file uploaded to the container.
4134
4135 - `index: number`
4136
4137 - `type: "content_block_start"`
4138
4139 default: content_block_start
4140
4141 - `RawContentBlockDeltaEvent object`
4142
4143 - `delta: RawContentBlockDelta`
4144
4145 - `TextDelta object`
4146
4147 - `text: string`
4148
4149 - `type: "text_delta"`
4150
4151 default: text_delta
4152
4153 - `InputJSONDelta object`
4154
4155 - `partial_json: string`
4156
4157 - `type: "input_json_delta"`
4158
4159 default: input_json_delta
4160
4161 - `CitationsDelta object`
4162
4163 - `citation: CitationCharLocation or CitationPageLocation or CitationContentBlockLocation or 2 more`
4164
4165 - `CitationCharLocation object`
4166
4167 - `CitationPageLocation object`
4168
4169 - `CitationContentBlockLocation object`
4170
4171 - `CitationsWebSearchResultLocation object`
4172
4173 - `CitationsSearchResultLocation object`
4174
4175 - `type: "citations_delta"`
4176
4177 default: citations_delta
4178
4179 - `ThinkingDelta object`
4180
4181 - `thinking: string`
4182
4183 The incremental `thinking` text for this content block. Concatenate the `thinking` values of successive `thinking_delta` events to assemble the block's full `thinking` value.
4184
4185 - `type: "thinking_delta"`
4186
4187 default: thinking_delta
4188
4189 - `SignatureDelta object`
4190
4191 - `signature: string`
4192
4193 The `signature` for this thinking block: an opaque value used to verify that the block was generated by Claude when it is passed back to the API. Delivered in a `signature_delta` event just before the block's `content_block_stop` event.
4194
4195 - `type: "signature_delta"`
4196
4197 default: signature_delta
4198
4199 - `index: number`
4200
4201 - `type: "content_block_delta"`
4202
4203 default: content_block_delta
4204
4205 - `RawContentBlockStopEvent object`
4206
4207 - `index: number`
4208
4209 - `type: "content_block_stop"`
4210
4211 default: content_block_stop
4212
4213## Example
4214
4215```bash
40084216curl https://api.anthropic.com/v1/messages \
40094217 -H 'Content-Type: application/json' \
40104218 -H 'anthropic-version: 2023-06-01' \
from line 4258
40504258 }'
40514259```
40524260
4053#### Response
4261### Response (200)
40544262
40554263```json
40564264{
40574265
No line in this hunk matches that.