Follow Discord
Sweep 22 Oct 2026 · 21:04Z Build v2.1.309 528 read Stable v2.1.308 Latest v2.1.309 Next v2.1.309 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

Count tokens in a Message changedapi/messages/count_tokens

Nearest release: v2.1.309, published 2 hours after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+990added
Lines−966removed
From line 80 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits21to this page, all time

The whole hunk

from line 80, old and new numbered
/
lines

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 80
8080 
8181 See [input examples](https://platform.claude.com/docs/en/build-with-claude/working-with-messages?sdk_languages=http).
8282 
83 Note that if you want to include a [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices?sdk_languages=http#give-claude-a-role), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API.
83 Note that if you want to include a [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices?sdk_languages=http#give-claude-a-role), you can use the top-level `system` parameter.
8484 
8585 There is a limit of 100,000 messages in a single request.
8686 
87 - `content: string or array of ContentBlockParam`
88 
89 - `string`
90 
91 - `array of ContentBlockParam`
92 
93 - `TextBlockParam object`
87 - `UserMessageParam object`
88 
89 - `content: MessageContentParam`
90 
91 - `string`
92 
93 - `array of ContentBlockParam`
94 
95 - `TextBlockParam object`
96 
97 - `type: "text"`
98 
99 - `text: string`
100 
101 minLength: 1
102 
103 - `cache_control: optional CacheControlEphemeral or null`
104 
105 Create a cache control breakpoint at this content block.
106 
107 - `type: "ephemeral"`
108 
109 - `ttl: optional "5m" or "1h"`
110 
111 The time-to-live for the cache control breakpoint.
112 
113 This may be one the following values:
114 
115 - `5m`: 5 minutes
116 - `1h`: 1 hour
117 
118 Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching?sdk_languages=http) for details.
119 
120 - `"5m"`
121 
122 - `"1h"`
123 
124 - `citations: optional array of TextCitationParam or null`
125 
126 - `CitationCharLocationParam object`
127 
128 - `type: "char_location"`
129 
130 - `cited_text: string`
131 
132 - `document_index: number`
133 
134 minimum: 0
135 
136 - `document_title: string or null`
137 
138 minLength: 1, maxLength: 500
139 
140 - `end_char_index: number`
141 
142 - `start_char_index: number`
143 
144 minimum: 0
145 
146 - `CitationPageLocationParam object`
147 
148 - `type: "page_location"`
149 
150 - `cited_text: string`
151 
152 - `document_index: number`
153 
154 minimum: 0
155 
156 - `document_title: string or null`
157 
158 minLength: 1, maxLength: 500
159 
160 - `end_page_number: number`
161 
162 - `start_page_number: number`
163 
164 minimum: 1
165 
166 - `CitationContentBlockLocationParam object`
167 
168 - `type: "content_block_location"`
169 
170 - `cited_text: string`
171 
172 The full text of the cited block range, concatenated.
173 
174 Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.
175 
176 - `document_index: number`
177 
178 minimum: 0
179 
180 - `document_title: string or null`
181 
182 minLength: 1, maxLength: 500
183 
184 - `end_block_index: number`
185 
186 Exclusive 0-based end index of the cited block range in the source's `content` array.
187 
188 Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.
189 
190 - `start_block_index: number`
191 
192 0-based index of the first cited block in the source's `content` array.
193 
194 minimum: 0
195 
196 - `CitationWebSearchResultLocationParam object`
197 
198 - `type: "web_search_result_location"`
199 
200 - `cited_text: string`
201 
202 - `encrypted_index: string`
203 
204 - `title: string or null`
205 
206 minLength: 1, maxLength: 512
207 
208 - `url: string`
209 
210 minLength: 1
211 
212 - `CitationSearchResultLocationParam object`
213 
214 - `type: "search_result_location"`
215 
216 - `cited_text: string`
217 
218 The full text of the cited block range, concatenated.
219 
220 Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.
221 
222 - `end_block_index: number`
223 
224 Exclusive 0-based end index of the cited block range in the source's `content` array.
225 
226 Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.
227 
228 - `search_result_index: number`
229 
230 0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.
231 
232 Counted separately from `document_index`; server-side web search results are not included in this count.
233 
234 minimum: 0
235 
236 - `source: string`
237 
238 - `start_block_index: number`
239 
240 0-based index of the first cited block in the source's `content` array.
241 
242 minimum: 0
243 
244 - `title: string or null`
245 
246 - `ImageBlockParam object`
247 
248 - `type: "image"`
249 
250 - `source: Base64ImageSource or URLImageSource or FileImageSource`
251 
252 - `Base64ImageSource object`
253 
254 - `type: "base64"`
255 
256 - `data: string`
257 
258 format: byte
259 
260 - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"`
261 
262 - `"image/jpeg"`
263 
264 - `"image/png"`
265 
266 - `"image/gif"`
267 
268 - `"image/webp"`
269 
270 - `URLImageSource object`
271 
272 - `type: "url"`
273 
274 - `url: string`
275 
276 - `FileImageSource object`
277 
278 - `type: "file"`
279 
280 - `file_id: string`
281 
282 - `cache_control: optional CacheControlEphemeral or null`
283 
284 Create a cache control breakpoint at this content block.
285 
286 - `transformations: optional ImageTransformationsParam or null`
287 
288 Configures the transformations the server applies to this image before the model observes it. Each key names a condition the server transforms images for; its value selects the transformation applied. Omitted keys keep their default behavior, and an empty object is equivalent to omitting the field.
289 
290 - `oversized_image: optional "downsize" or "error"`
291 
292 What the server does when this image exceeds the model's maximum image size. `"downsize"` (the default) scales the image down to fit, which changes the dimensions the model observes without telling you. `"error"` instead rejects the request with a 400 error naming the image's dimensions and the largest dimensions that fit, so you can scale the image deliberately — your image is never silently scaled down.
293 
294 - `"downsize"`
295 
296 - `"error"`
297 
298 - `DocumentBlockParam object`
299 
300 - `type: "document"`
301 
302 - `source: Base64PDFSource or PlainTextSource or ContentBlockSource or 2 more`
303 
304 - `Base64PDFSource object`
305 
306 - `type: "base64"`
307 
308 - `data: string`
309 
310 format: byte
311 
312 - `media_type: "application/pdf"`
313 
314 - `PlainTextSource object`
315 
316 - `type: "text"`
317 
318 - `data: string`
319 
320 - `media_type: "text/plain"`
321 
322 - `ContentBlockSource object`
323 
324 - `type: "content"`
325 
326 - `content: string or array of ContentBlockSourceContent`
327 
328 - `string`
329 
330 - `ContentBlockSourceContent = array of ContentBlockSourceContent`
331 
332 - `TextBlockParam object`
333 
334 - `ImageBlockParam object`
335 
336 - `URLPDFSource object`
337 
338 - `type: "url"`
339 
340 - `url: string`
341 
342 - `FileDocumentSource object`
343 
344 - `type: "file"`
345 
346 - `file_id: string`
347 
348 - `cache_control: optional CacheControlEphemeral or null`
349 
350 Create a cache control breakpoint at this content block.
351 
352 - `citations: optional CitationsConfigParam or null`
353 
354 - `enabled: optional boolean`
355 
356 - `context: optional string or null`
357 
358 minLength: 1
359 
360 - `title: optional string or null`
361 
362 minLength: 1, maxLength: 500
363 
364 - `SearchResultBlockParam object`
365 
366 - `type: "search_result"`
367 
368 - `content: array of TextBlockParam`
369 
370 - `type: "text"`
371 
372 - `text: string`
373 
374 minLength: 1
375 
376 - `cache_control: optional CacheControlEphemeral or null`
377 
378 Create a cache control breakpoint at this content block.
379 
380 - `citations: optional array of TextCitationParam or null`
381 
382 - `source: string`
383 
384 - `title: string`
385 
386 - `cache_control: optional CacheControlEphemeral or null`
387 
388 Create a cache control breakpoint at this content block.
389 
390 - `citations: optional CitationsConfigParam`
391 
392 - `ThinkingBlockParam object`
393 
394 - `type: "thinking"`
395 
396 - `signature: string`
397 
398 The `signature` value of this thinking block, exactly as returned by the API in a previous response. Used to verify that the block was generated by Claude.
399 
400 Thinking blocks must be passed back unmodified and in their original order; a modified block results in a 400 `invalid_request_error`.
401 
402 - `thinking: string`
403 
404 The `thinking` text of this block as returned by the API.
405 
406 - `RedactedThinkingBlockParam object`
407 
408 - `type: "redacted_thinking"`
409 
410 - `data: string`
411 
412 The `data` value of this redacted thinking block, exactly as returned by the API in a previous response. Opaque and encrypted; pass it back unchanged.
413 
414 - `ToolUseBlockParam object`
415 
416 - `type: "tool_use"`
417 
418 - `id: string`
419 
420 pattern: ^[a-zA-Z0-9_-]+$
421 
422 - `input: map[unknown]`
423 
424 - `name: string`
425 
426 minLength: 1, maxLength: 200
427 
428 - `cache_control: optional CacheControlEphemeral or null`
429 
430 Create a cache control breakpoint at this content block.
431 
432 - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120`
433 
434 - `DirectCaller object`
435 
436 Tool invocation directly from the model.
437 
438 - `type: "direct"`
439 
440 - `ServerToolCaller object`
441 
442 Tool invocation generated by a server-side tool.
443 
444 - `type: "code_execution_20250825"`
445 
446 - `tool_id: string`
447 
448 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
449 
450 - `ServerToolCaller20260120 object`
451 
452 - `type: "code_execution_20260120"`
453 
454 - `tool_id: string`
455 
456 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
457 
458 - `toolset_name: optional string or null`
459 
460 For a toolset member tool_use, the toolset family this member belongs to.
461 
462 minLength: 1, maxLength: 64, pattern: ^[a-zA-Z0-9_-]+$
463 
464 - `ToolResultBlockParam object`
465 
466 - `type: "tool_result"`
467 
468 - `tool_use_id: string`
469 
470 pattern: ^[a-zA-Z0-9_-]+$
471 
472 - `cache_control: optional CacheControlEphemeral or null`
473 
474 Create a cache control breakpoint at this content block.
475 
476 - `content: optional string or array of TextBlockParam or ImageBlockParam or SearchResultBlockParam or 3 more`
477 
478 - `string`
479 
480 - `array of TextBlockParam or ImageBlockParam or SearchResultBlockParam or 3 more`
481 
482 - `TextBlockParam object`
483 
484 - `ImageBlockParam object`
485 
486 - `SearchResultBlockParam object`
487 
488 - `DocumentBlockParam object`
489 
490 - `ToolReferenceBlockParam object`
491 
492 Tool reference block that can be included in tool_result content.
493 
494 - `type: "tool_reference"`
495 
496 - `tool_name: string`
497 
498 minLength: 1, maxLength: 256, pattern: ^[a-zA-Z0-9_-]{1,256}$
499 
500 - `cache_control: optional CacheControlEphemeral or null`
501 
502 Create a cache control breakpoint at this content block.
503 
504 - `BrowserStateBlockParam object`
505 
506 The caller's browser state after a browser toolset member call —
507 the full inventory of open tabs, which tab is active, and any side
508 effects (tabs opened, download state changes) the call produced.
509 
510 At most one per `tool_result`, only on a non-error result answering a
511 browser toolset member `tool_use`. The server renders the
512 model-visible text from it; the model never sees the raw fields.
513 
514 - `type: "browser_state"`
515 
516 - `tabs: array of BrowserStateTabEntry`
517 
518 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`.
519 
520 maxItems: 100
521 
522 - `tab_id: string`
523 
524 The caller-assigned identifier for this tab, unique within the inventory.
525 
526 minLength: 1, maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
527 
528 - `title: string`
529 
530 The title of the page the tab is showing. May be empty.
531 
532 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
533 
534 - `url: string`
535 
536 The URL of the page the tab is showing. May be empty.
537 
538 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
539 
540 - `active: optional boolean`
541 
542 Whether this tab is the active tab after this call. Whenever `tabs` is non-empty, exactly one entry is marked `active: true`.
543 
544 - `cache_control: optional CacheControlEphemeral or null`
545 
546 Create a cache control breakpoint at this content block.
547 
548 - `state_changes: optional array of BrowserStateChange or null`
549 
550 Tabs opened and download state changes during this call. "Nothing to report" is expressed by omitting the field, never by an empty list.
551 
552 minItems: 1, maxItems: 200
553 
554 - `BrowserStateChangeTabOpened object`
555 
556 A tab this call's execution opened that remains open at its end —
557 the creation delta of the `tabs` inventory, not an event log.
558 
559 Carries only the `tab_id`; the tab's `title` and `url` live on its
560 `tabs` entry, which must include the same `tab_id`. A tab opened
561 during a failed call gets no deferred `tab_opened`; it simply appears
562 in the next result's `tabs` inventory.
563 
564 - `type: "tab_opened"`
565 
566 - `tab_id: string`
567 
568 The `tab_id` of the opened tab, present in `tabs`.
569 
570 minLength: 1, maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
571 
572 - `BrowserStateChangeDownloadStarted object`
573 
574 A file download that started during this call.
575 
576 - `type: "download_started"`
577 
578 - `download_id: string`
579 
580 The caller-assigned identifier for this download, stable across the state changes reporting it.
581 
582 minLength: 1, maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
583 
584 - `url: string`
585 
586 The final post-redirect URL the download was served from.
587 
588 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
589 
590 - `BrowserStateChangeDownloadCompleted object`
591 
592 A file download that finished during this call, reported with the
593 same `download_id` as its `download_started` — or without a prior
594 `download_started`, when the download finished during the call that
595 started it (at most one state change per `download_id` per result).
596 
597 - `type: "download_completed"`
598 
599 - `download_id: string`
600 
601 The caller-assigned identifier for this download, stable across the state changes reporting it.
602 
603 minLength: 1, maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
604 
605 - `url: string`
606 
607 The final post-redirect URL the download was served from.
608 
609 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
610 
611 - `path: optional string or null`
612 
613 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.
614 
615 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
616 
617 - `size_bytes: optional number or null`
618 
619 The completed download's size.
620 
621 minimum: 0
622 
623 - `BrowserStateChangeDownloadFailed object`
624 
625 A file download that failed — or was cancelled — during this call.
626 
627 - `type: "download_failed"`
628 
629 - `download_id: string`
630 
631 The caller-assigned identifier for this download, stable across the state changes reporting it.
632 
633 minLength: 1, maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
634 
635 - `url: string`
636 
637 The final post-redirect URL the download was served from.
638 
639 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
640 
641 - `error: optional string or null`
642 
643 The failure or cancellation detail, when known.
644 
645 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
646 
647 - `is_error: optional boolean`
648 
649 - `toolset_name: optional string or null`
650 
651 For a toolset member tool_result, the toolset family of the paired tool_use.
652 
653 minLength: 1, maxLength: 64, pattern: ^[a-zA-Z0-9_-]+$
654 
655 - `ServerToolUseBlockParam object`
656 
657 - `type: "server_tool_use"`
658 
659 - `id: string`
660 
661 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
662 
663 - `input: map[unknown]`
664 
665 - `name: "web_search" or "web_fetch" or "code_execution" or 4 more`
666 
667 - `"web_search"`
668 
669 - `"web_fetch"`
670 
671 - `"code_execution"`
672 
673 - `"bash_code_execution"`
674 
675 - `"text_editor_code_execution"`
676 
677 - `"tool_search_tool_regex"`
678 
679 - `"tool_search_tool_bm25"`
680 
681 - `cache_control: optional CacheControlEphemeral or null`
682 
683 Create a cache control breakpoint at this content block.
684 
685 - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120`
686 
687 - `DirectCaller object`
688 
689 Tool invocation directly from the model.
690 
691 - `ServerToolCaller object`
692 
693 Tool invocation generated by a server-side tool.
694 
695 - `ServerToolCaller20260120 object`
696 
697 - `WebSearchToolResultBlockParam object`
698 
699 - `type: "web_search_tool_result"`
700 
701 - `content: WebSearchToolResultBlockParamContent`
702 
703 - `WebSearchToolResultBlockItem = array of WebSearchResultBlockParam`
704 
705 - `type: "web_search_result"`
706 
707 - `encrypted_content: string`
708 
709 - `title: string`
710 
711 - `url: string`
712 
713 - `page_age: optional string or null`
714 
715 - `WebSearchToolRequestError object`
716 
717 - `type: "web_search_tool_result_error"`
718 
719 - `error_code: WebSearchToolResultErrorCode`
720 
721 - `"invalid_tool_input"`
722 
723 - `"unavailable"`
724 
725 - `"max_uses_exceeded"`
726 
727 - `"too_many_requests"`
728 
729 - `"query_too_long"`
730 
731 - `"request_too_large"`
732 
733 - `tool_use_id: string`
734 
735 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
736 
737 - `cache_control: optional CacheControlEphemeral or null`
738 
739 Create a cache control breakpoint at this content block.
740 
741 - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120`
742 
743 - `DirectCaller object`
744 
745 Tool invocation directly from the model.
746 
747 - `ServerToolCaller object`
748 
749 Tool invocation generated by a server-side tool.
750 
751 - `ServerToolCaller20260120 object`
752 
753 - `WebFetchToolResultBlockParam object`
754 
755 - `type: "web_fetch_tool_result"`
756 
757 - `content: WebFetchToolResultErrorBlockParam or WebFetchBlockParam`
758 
759 - `WebFetchToolResultErrorBlockParam object`
760 
761 - `type: "web_fetch_tool_result_error"`
762 
763 - `error_code: WebFetchToolResultErrorCode`
764 
765 - `"invalid_tool_input"`
766 
767 - `"url_too_long"`
768 
769 - `"url_not_allowed"`
770 
771 - `"url_not_in_prior_context"`
772 
773 - `"url_not_accessible"`
774 
775 - `"unsupported_content_type"`
776 
777 - `"too_many_requests"`
778 
779 - `"max_uses_exceeded"`
780 
781 - `"unavailable"`
782 
783 - `"content_too_large"`
784 
785 - `WebFetchBlockParam object`
786 
787 - `type: "web_fetch_result"`
788 
789 - `content: DocumentBlockParam`
790 
791 - `url: string`
792 
793 Fetched content URL
794 
795 - `retrieved_at: optional string or null`
796 
797 ISO 8601 timestamp when the content was retrieved
798 
799 - `tool_use_id: string`
800 
801 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
802 
803 - `cache_control: optional CacheControlEphemeral or null`
804 
805 Create a cache control breakpoint at this content block.
806 
807 - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120`
808 
809 - `DirectCaller object`
810 
811 Tool invocation directly from the model.
812 
813 - `ServerToolCaller object`
814 
815 Tool invocation generated by a server-side tool.
816 
817 - `ServerToolCaller20260120 object`
818 
819 - `CodeExecutionToolResultBlockParam object`
820 
821 - `type: "code_execution_tool_result"`
822 
823 - `content: CodeExecutionToolResultBlockParamContent`
824 
825 - `CodeExecutionToolResultErrorParam object`
826 
827 - `type: "code_execution_tool_result_error"`
828 
829 - `error_code: CodeExecutionToolResultErrorCode`
830 
831 - `"invalid_tool_input"`
832 
833 - `"unavailable"`
834 
835 - `"too_many_requests"`
836 
837 - `"execution_time_exceeded"`
838 
839 - `CodeExecutionResultBlockParam object`
840 
841 - `type: "code_execution_result"`
842 
843 - `content: array of CodeExecutionOutputBlockParam`
844 
845 - `type: "code_execution_output"`
846 
847 - `file_id: string`
848 
849 - `return_code: number`
850 
851 - `stderr: string`
852 
853 - `stdout: string`
854 
855 - `EncryptedCodeExecutionResultBlockParam object`
856 
857 Code execution result with encrypted stdout for PFC + web_search results.
858 
859 - `type: "encrypted_code_execution_result"`
860 
861 - `content: array of CodeExecutionOutputBlockParam`
862 
863 - `type: "code_execution_output"`
864 
865 - `file_id: string`
866 
867 - `encrypted_stdout: string`
868 
869 - `return_code: number`
870 
871 - `stderr: string`
872 
873 - `tool_use_id: string`
874 
875 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
876 
877 - `cache_control: optional CacheControlEphemeral or null`
878 
879 Create a cache control breakpoint at this content block.
880 
881 - `BashCodeExecutionToolResultBlockParam object`
882 
883 - `type: "bash_code_execution_tool_result"`
884 
885 - `content: BashCodeExecutionToolResultErrorParam or BashCodeExecutionResultBlockParam`
886 
887 - `BashCodeExecutionToolResultErrorParam object`
888 
889 - `type: "bash_code_execution_tool_result_error"`
890 
891 - `error_code: BashCodeExecutionToolResultErrorCode`
892 
893 - `"invalid_tool_input"`
894 
895 - `"unavailable"`
896 
897 - `"too_many_requests"`
898 
899 - `"execution_time_exceeded"`
900 
901 - `"output_file_too_large"`
902 
903 - `BashCodeExecutionResultBlockParam object`
904 
905 - `type: "bash_code_execution_result"`
906 
907 - `content: array of BashCodeExecutionOutputBlockParam`
908 
909 - `type: "bash_code_execution_output"`
910 
911 - `file_id: string`
912 
913 - `return_code: number`
914 
915 - `stderr: string`
916 
917 - `stdout: string`
918 
919 - `tool_use_id: string`
920 
921 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
922 
923 - `cache_control: optional CacheControlEphemeral or null`
924 
925 Create a cache control breakpoint at this content block.
926 
927 - `TextEditorCodeExecutionToolResultBlockParam object`
928 
929 - `type: "text_editor_code_execution_tool_result"`
930 
931 - `content: TextEditorCodeExecutionToolResultErrorParam or TextEditorCodeExecutionViewResultBlockParam or TextEditorCodeExecutionCreateResultBlockParam or TextEditorCodeExecutionStrReplaceResultBlockParam`
932 
933 - `TextEditorCodeExecutionToolResultErrorParam object`
934 
935 - `type: "text_editor_code_execution_tool_result_error"`
936 
937 - `error_code: TextEditorCodeExecutionToolResultErrorCode`
938 
939 - `"invalid_tool_input"`
940 
941 - `"unavailable"`
942 
943 - `"too_many_requests"`
944 
945 - `"execution_time_exceeded"`
946 
947 - `"file_not_found"`
948 
949 - `error_message: optional string or null`
950 
951 - `TextEditorCodeExecutionViewResultBlockParam object`
952 
953 - `type: "text_editor_code_execution_view_result"`
954 
955 - `content: string`
956 
957 - `file_type: "text" or "image" or "pdf"`
958 
959 - `"text"`
960 
961 - `"image"`
962 
963 - `"pdf"`
964 
965 - `num_lines: optional number or null`
966 
967 - `start_line: optional number or null`
968 
969 - `total_lines: optional number or null`
970 
971 - `TextEditorCodeExecutionCreateResultBlockParam object`
972 
973 - `type: "text_editor_code_execution_create_result"`
974 
975 - `is_file_update: boolean`
976 
977 - `TextEditorCodeExecutionStrReplaceResultBlockParam object`
978 
979 - `type: "text_editor_code_execution_str_replace_result"`
980 
981 - `lines: optional array of string or null`
982 
983 - `new_lines: optional number or null`
984 
985 - `new_start: optional number or null`
986 
987 - `old_lines: optional number or null`
988 
989 - `old_start: optional number or null`
990 
991 - `tool_use_id: string`
992 
993 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
994 
995 - `cache_control: optional CacheControlEphemeral or null`
996 
997 Create a cache control breakpoint at this content block.
998 
999 - `ToolSearchToolResultBlockParam object`
1000 
1001 - `type: "tool_search_tool_result"`
1002 
1003 - `content: ToolSearchToolResultErrorParam or ToolSearchToolSearchResultBlockParam`
1004 
1005 - `ToolSearchToolResultErrorParam object`
1006 
1007 - `type: "tool_search_tool_result_error"`
1008 
1009 - `error_code: ToolSearchToolResultErrorCode`
1010 
1011 - `"invalid_tool_input"`
1012 
1013 - `"unavailable"`
1014 
1015 - `"too_many_requests"`
1016 
1017 - `"execution_time_exceeded"`
1018 
1019 - `error_message: optional string or null`
1020 
1021 - `ToolSearchToolSearchResultBlockParam object`
1022 
1023 - `type: "tool_search_tool_search_result"`
1024 
1025 - `tool_references: array of ToolReferenceBlockParam`
1026 
1027 - `type: "tool_reference"`
1028 
1029 - `tool_name: string`
1030 
1031 minLength: 1, maxLength: 256, pattern: ^[a-zA-Z0-9_-]{1,256}$
1032 
1033 - `cache_control: optional CacheControlEphemeral or null`
1034 
1035 Create a cache control breakpoint at this content block.
1036 
1037 - `tool_use_id: string`
1038 
1039 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
1040 
1041 - `cache_control: optional CacheControlEphemeral or null`
1042 
1043 Create a cache control breakpoint at this content block.
1044 
1045 - `ContainerUploadBlockParam object`
1046 
1047 A content block that represents a file to be uploaded to the container
1048 Files uploaded via this block will be available in the container's input directory.
1049 
1050 - `type: "container_upload"`
1051 
1052 - `file_id: string`
1053 
1054 - `cache_control: optional CacheControlEphemeral or null`
1055 
1056 Create a cache control breakpoint at this content block.
1057 
1058 - `role: "user"`
1059 
1060 - `AssistantMessageParam object`
1061 
1062 - `content: MessageContentParam`
1063 
1064 - `role: "assistant"`
1065 
1066 - `SystemMessageParam object`
1067 
1068 - `content: string or array of TextBlockParam`
1069 
1070 - `string`
1071 
1072 - `Blocks = array of TextBlockParam`
941073 
951074 - `type: "text"`
961075 
from line 1081
1021081 
1031082 Create a cache control breakpoint at this content block.
1041083 
105 - `type: "ephemeral"`
106 
107 - `ttl: optional "5m" or "1h"`
108 
109 The time-to-live for the cache control breakpoint.
110 
111 This may be one the following values:
112 
113 - `5m`: 5 minutes
114 - `1h`: 1 hour
115 
116 Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching?sdk_languages=http) for details.
117 
118 - `"5m"`
119 
120 - `"1h"`
121 
1221084 - `citations: optional array of TextCitationParam or null`
1231085 
124 - `CitationCharLocationParam object`
125 
126 - `type: "char_location"`
127 
128 - `cited_text: string`
129 
130 - `document_index: number`
131 
132 minimum: 0
133 
134 - `document_title: string or null`
135 
136 minLength: 1, maxLength: 500
137 
138 - `end_char_index: number`
139 
140 - `start_char_index: number`
141 
142 minimum: 0
143 
144 - `CitationPageLocationParam object`
145 
146 - `type: "page_location"`
147 
148 - `cited_text: string`
149 
150 - `document_index: number`
151 
152 minimum: 0
153 
154 - `document_title: string or null`
155 
156 minLength: 1, maxLength: 500
157 
158 - `end_page_number: number`
159 
160 - `start_page_number: number`
161 
162 minimum: 1
163 
164 - `CitationContentBlockLocationParam object`
165 
166 - `type: "content_block_location"`
167 
168 - `cited_text: string`
169 
170 The full text of the cited block range, concatenated.
171 
172 Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.
173 
174 - `document_index: number`
175 
176 minimum: 0
177 
178 - `document_title: string or null`
179 
180 minLength: 1, maxLength: 500
181 
182 - `end_block_index: number`
183 
184 Exclusive 0-based end index of the cited block range in the source's `content` array.
185 
186 Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.
187 
188 - `start_block_index: number`
189 
190 0-based index of the first cited block in the source's `content` array.
191 
192 minimum: 0
193 
194 - `CitationWebSearchResultLocationParam object`
195 
196 - `type: "web_search_result_location"`
197 
198 - `cited_text: string`
199 
200 - `encrypted_index: string`
201 
202 - `title: string or null`
203 
204 minLength: 1, maxLength: 512
205 
206 - `url: string`
207 
208 minLength: 1
209 
210 - `CitationSearchResultLocationParam object`
211 
212 - `type: "search_result_location"`
213 
214 - `cited_text: string`
215 
216 The full text of the cited block range, concatenated.
217 
218 Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.
219 
220 - `end_block_index: number`
221 
222 Exclusive 0-based end index of the cited block range in the source's `content` array.
223 
224 Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.
225 
226 - `search_result_index: number`
227 
228 0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.
229 
230 Counted separately from `document_index`; server-side web search results are not included in this count.
231 
232 minimum: 0
233 
234 - `source: string`
235 
236 - `start_block_index: number`
237 
238 0-based index of the first cited block in the source's `content` array.
239 
240 minimum: 0
241 
242 - `title: string or null`
243 
244 - `ImageBlockParam object`
245 
246 - `type: "image"`
247 
248 - `source: Base64ImageSource or URLImageSource or FileImageSource`
249 
250 - `Base64ImageSource object`
251 
252 - `type: "base64"`
253 
254 - `data: string`
255 
256 format: byte
257 
258 - `media_type: "image/jpeg" or "image/png" or "image/gif" or "image/webp"`
259 
260 - `"image/jpeg"`
261 
262 - `"image/png"`
263 
264 - `"image/gif"`
265 
266 - `"image/webp"`
267 
268 - `URLImageSource object`
269 
270 - `type: "url"`
271 
272 - `url: string`
273 
274 - `FileImageSource object`
275 
276 - `type: "file"`
277 
278 - `file_id: string`
279 
280 - `cache_control: optional CacheControlEphemeral or null`
281 
282 Create a cache control breakpoint at this content block.
283 
284 - `transformations: optional ImageTransformationsParam or null`
285 
286 Configures the transformations the server applies to this image before the model observes it. Each key names a condition the server transforms images for; its value selects the transformation applied. Omitted keys keep their default behavior, and an empty object is equivalent to omitting the field.
287 
288 - `oversized_image: optional "downsize" or "error"`
289 
290 What the server does when this image exceeds the model's maximum image size. `"downsize"` (the default) scales the image down to fit, which changes the dimensions the model observes without telling you. `"error"` instead rejects the request with a 400 error naming the image's dimensions and the largest dimensions that fit, so you can scale the image deliberately — your image is never silently scaled down.
291 
292 - `"downsize"`
293 
294 - `"error"`
295 
296 - `DocumentBlockParam object`
297 
298 - `type: "document"`
299 
300 - `source: Base64PDFSource or PlainTextSource or ContentBlockSource or 2 more`
301 
302 - `Base64PDFSource object`
303 
304 - `type: "base64"`
305 
306 - `data: string`
307 
308 format: byte
309 
310 - `media_type: "application/pdf"`
311 
312 - `PlainTextSource object`
313 
314 - `type: "text"`
315 
316 - `data: string`
317 
318 - `media_type: "text/plain"`
319 
320 - `ContentBlockSource object`
321 
322 - `type: "content"`
323 
324 - `content: string or array of ContentBlockSourceContent`
325 
326 - `string`
327 
328 - `ContentBlockSourceContent = array of ContentBlockSourceContent`
329 
330 - `TextBlockParam object`
331 
332 - `ImageBlockParam object`
333 
334 - `URLPDFSource object`
335 
336 - `type: "url"`
337 
338 - `url: string`
339 
340 - `FileDocumentSource object`
341 
342 - `type: "file"`
343 
344 - `file_id: string`
345 
346 - `cache_control: optional CacheControlEphemeral or null`
347 
348 Create a cache control breakpoint at this content block.
349 
350 - `citations: optional CitationsConfigParam or null`
351 
352 - `enabled: optional boolean`
353 
354 - `context: optional string or null`
355 
356 minLength: 1
357 
358 - `title: optional string or null`
359 
360 minLength: 1, maxLength: 500
361 
362 - `SearchResultBlockParam object`
363 
364 - `type: "search_result"`
365 
366 - `content: array of TextBlockParam`
367 
368 - `type: "text"`
369 
370 - `text: string`
371 
372 minLength: 1
373 
374 - `cache_control: optional CacheControlEphemeral or null`
375 
376 Create a cache control breakpoint at this content block.
377 
378 - `citations: optional array of TextCitationParam or null`
379 
380 - `source: string`
381 
382 - `title: string`
383 
384 - `cache_control: optional CacheControlEphemeral or null`
385 
386 Create a cache control breakpoint at this content block.
387 
388 - `citations: optional CitationsConfigParam`
389 
390 - `ThinkingBlockParam object`
391 
392 - `type: "thinking"`
393 
394 - `signature: string`
395 
396 The `signature` value of this thinking block, exactly as returned by the API in a previous response. Used to verify that the block was generated by Claude.
397 
398 Thinking blocks must be passed back unmodified and in their original order; a modified block results in a 400 `invalid_request_error`.
399 
400 - `thinking: string`
401 
402 The `thinking` text of this block as returned by the API.
403 
404 - `RedactedThinkingBlockParam object`
405 
406 - `type: "redacted_thinking"`
407 
408 - `data: string`
409 
410 The `data` value of this redacted thinking block, exactly as returned by the API in a previous response. Opaque and encrypted; pass it back unchanged.
411 
412 - `ToolUseBlockParam object`
413 
414 - `type: "tool_use"`
415 
416 - `id: string`
417 
418 pattern: ^[a-zA-Z0-9_-]+$
419 
420 - `input: map[unknown]`
421 
422 - `name: string`
423 
424 minLength: 1, maxLength: 200
425 
426 - `cache_control: optional CacheControlEphemeral or null`
427 
428 Create a cache control breakpoint at this content block.
429 
430 - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120`
431 
432 - `DirectCaller object`
433 
434 Tool invocation directly from the model.
435 
436 - `type: "direct"`
437 
438 - `ServerToolCaller object`
439 
440 Tool invocation generated by a server-side tool.
441 
442 - `type: "code_execution_20250825"`
443 
444 - `tool_id: string`
445 
446 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
447 
448 - `ServerToolCaller20260120 object`
449 
450 - `type: "code_execution_20260120"`
451 
452 - `tool_id: string`
453 
454 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
455 
456 - `toolset_name: optional string or null`
457 
458 For a toolset member tool_use, the toolset family this member belongs to.
459 
460 minLength: 1, maxLength: 64, pattern: ^[a-zA-Z0-9_-]+$
461 
462 - `ToolResultBlockParam object`
463 
464 - `type: "tool_result"`
465 
466 - `tool_use_id: string`
467 
468 pattern: ^[a-zA-Z0-9_-]+$
469 
470 - `cache_control: optional CacheControlEphemeral or null`
471 
472 Create a cache control breakpoint at this content block.
473 
474 - `content: optional string or array of TextBlockParam or ImageBlockParam or SearchResultBlockParam or 3 more`
475 
476 - `string`
477 
478 - `array of TextBlockParam or ImageBlockParam or SearchResultBlockParam or 3 more`
479 
480 - `TextBlockParam object`
481 
482 - `ImageBlockParam object`
483 
484 - `SearchResultBlockParam object`
485 
486 - `DocumentBlockParam object`
487 
488 - `ToolReferenceBlockParam object`
489 
490 Tool reference block that can be included in tool_result content.
491 
492 - `type: "tool_reference"`
493 
494 - `tool_name: string`
495 
496 minLength: 1, maxLength: 256, pattern: ^[a-zA-Z0-9_-]{1,256}$
497 
498 - `cache_control: optional CacheControlEphemeral or null`
499 
500 Create a cache control breakpoint at this content block.
501 
502 - `BrowserStateBlockParam object`
503 
504 The caller's browser state after a browser toolset member call —
505 the full inventory of open tabs, which tab is active, and any side
506 effects (tabs opened, download state changes) the call produced.
507 
508 At most one per `tool_result`, only on a non-error result answering a
509 browser toolset member `tool_use`. The server renders the
510 model-visible text from it; the model never sees the raw fields.
511 
512 - `type: "browser_state"`
513 
514 - `tabs: array of BrowserStateTabEntry`
515 
516 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`.
517 
518 maxItems: 100
519 
520 - `tab_id: string`
521 
522 The caller-assigned identifier for this tab, unique within the inventory.
523 
524 minLength: 1, maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
525 
526 - `title: string`
527 
528 The title of the page the tab is showing. May be empty.
529 
530 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
531 
532 - `url: string`
533 
534 The URL of the page the tab is showing. May be empty.
535 
536 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
537 
538 - `active: optional boolean`
539 
540 Whether this tab is the active tab after this call. Whenever `tabs` is non-empty, exactly one entry is marked `active: true`.
541 
542 - `cache_control: optional CacheControlEphemeral or null`
543 
544 Create a cache control breakpoint at this content block.
545 
546 - `state_changes: optional array of BrowserStateChange or null`
547 
548 Tabs opened and download state changes during this call. "Nothing to report" is expressed by omitting the field, never by an empty list.
549 
550 minItems: 1, maxItems: 200
551 
552 - `BrowserStateChangeTabOpened object`
553 
554 A tab this call's execution opened that remains open at its end —
555 the creation delta of the `tabs` inventory, not an event log.
556 
557 Carries only the `tab_id`; the tab's `title` and `url` live on its
558 `tabs` entry, which must include the same `tab_id`. A tab opened
559 during a failed call gets no deferred `tab_opened`; it simply appears
560 in the next result's `tabs` inventory.
561 
562 - `type: "tab_opened"`
563 
564 - `tab_id: string`
565 
566 The `tab_id` of the opened tab, present in `tabs`.
567 
568 minLength: 1, maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
569 
570 - `BrowserStateChangeDownloadStarted object`
571 
572 A file download that started during this call.
573 
574 - `type: "download_started"`
575 
576 - `download_id: string`
577 
578 The caller-assigned identifier for this download, stable across the state changes reporting it.
579 
580 minLength: 1, maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
581 
582 - `url: string`
583 
584 The final post-redirect URL the download was served from.
585 
586 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
587 
588 - `BrowserStateChangeDownloadCompleted object`
589 
590 A file download that finished during this call, reported with the
591 same `download_id` as its `download_started` — or without a prior
592 `download_started`, when the download finished during the call that
593 started it (at most one state change per `download_id` per result).
594 
595 - `type: "download_completed"`
596 
597 - `download_id: string`
598 
599 The caller-assigned identifier for this download, stable across the state changes reporting it.
600 
601 minLength: 1, maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
602 
603 - `url: string`
604 
605 The final post-redirect URL the download was served from.
606 
607 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
608 
609 - `path: optional string or null`
610 
611 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.
612 
613 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
614 
615 - `size_bytes: optional number or null`
616 
617 The completed download's size.
618 
619 minimum: 0
620 
621 - `BrowserStateChangeDownloadFailed object`
622 
623 A file download that failed — or was cancelled — during this call.
624 
625 - `type: "download_failed"`
626 
627 - `download_id: string`
628 
629 The caller-assigned identifier for this download, stable across the state changes reporting it.
630 
631 minLength: 1, maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
632 
633 - `url: string`
634 
635 The final post-redirect URL the download was served from.
636 
637 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
638 
639 - `error: optional string or null`
640 
641 The failure or cancellation detail, when known.
642 
643 maxLength: 4096, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
644 
645 - `is_error: optional boolean`
646 
647 - `toolset_name: optional string or null`
648 
649 For a toolset member tool_result, the toolset family of the paired tool_use.
650 
651 minLength: 1, maxLength: 64, pattern: ^[a-zA-Z0-9_-]+$
652 
653 - `ServerToolUseBlockParam object`
654 
655 - `type: "server_tool_use"`
656 
657 - `id: string`
658 
659 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
660 
661 - `input: map[unknown]`
662 
663 - `name: "web_search" or "web_fetch" or "code_execution" or 4 more`
664 
665 - `"web_search"`
666 
667 - `"web_fetch"`
668 
669 - `"code_execution"`
670 
671 - `"bash_code_execution"`
672 
673 - `"text_editor_code_execution"`
674 
675 - `"tool_search_tool_regex"`
676 
677 - `"tool_search_tool_bm25"`
678 
679 - `cache_control: optional CacheControlEphemeral or null`
680 
681 Create a cache control breakpoint at this content block.
682 
683 - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120`
684 
685 - `DirectCaller object`
686 
687 Tool invocation directly from the model.
688 
689 - `ServerToolCaller object`
690 
691 Tool invocation generated by a server-side tool.
692 
693 - `ServerToolCaller20260120 object`
694 
695 - `WebSearchToolResultBlockParam object`
696 
697 - `type: "web_search_tool_result"`
698 
699 - `content: WebSearchToolResultBlockParamContent`
700 
701 - `WebSearchToolResultBlockItem = array of WebSearchResultBlockParam`
702 
703 - `type: "web_search_result"`
704 
705 - `encrypted_content: string`
706 
707 - `title: string`
708 
709 - `url: string`
710 
711 - `page_age: optional string or null`
712 
713 - `WebSearchToolRequestError object`
714 
715 - `type: "web_search_tool_result_error"`
716 
717 - `error_code: WebSearchToolResultErrorCode`
718 
719 - `"invalid_tool_input"`
720 
721 - `"unavailable"`
722 
723 - `"max_uses_exceeded"`
724 
725 - `"too_many_requests"`
726 
727 - `"query_too_long"`
728 
729 - `"request_too_large"`
730 
731 - `tool_use_id: string`
732 
733 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
734 
735 - `cache_control: optional CacheControlEphemeral or null`
736 
737 Create a cache control breakpoint at this content block.
738 
739 - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120`
740 
741 - `DirectCaller object`
742 
743 Tool invocation directly from the model.
744 
745 - `ServerToolCaller object`
746 
747 Tool invocation generated by a server-side tool.
748 
749 - `ServerToolCaller20260120 object`
750 
751 - `WebFetchToolResultBlockParam object`
752 
753 - `type: "web_fetch_tool_result"`
754 
755 - `content: WebFetchToolResultErrorBlockParam or WebFetchBlockParam`
756 
757 - `WebFetchToolResultErrorBlockParam object`
758 
759 - `type: "web_fetch_tool_result_error"`
760 
761 - `error_code: WebFetchToolResultErrorCode`
762 
763 - `"invalid_tool_input"`
764 
765 - `"url_too_long"`
766 
767 - `"url_not_allowed"`
768 
769 - `"url_not_in_prior_context"`
770 
771 - `"url_not_accessible"`
772 
773 - `"unsupported_content_type"`
774 
775 - `"too_many_requests"`
776 
777 - `"max_uses_exceeded"`
778 
779 - `"unavailable"`
780 
781 - `"content_too_large"`
782 
783 - `WebFetchBlockParam object`
784 
785 - `type: "web_fetch_result"`
786 
787 - `content: DocumentBlockParam`
788 
789 - `url: string`
790 
791 Fetched content URL
792 
793 - `retrieved_at: optional string or null`
794 
795 ISO 8601 timestamp when the content was retrieved
796 
797 - `tool_use_id: string`
798 
799 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
800 
801 - `cache_control: optional CacheControlEphemeral or null`
802 
803 Create a cache control breakpoint at this content block.
804 
805 - `caller: optional DirectCaller or ServerToolCaller or ServerToolCaller20260120`
806 
807 - `DirectCaller object`
808 
809 Tool invocation directly from the model.
810 
811 - `ServerToolCaller object`
812 
813 Tool invocation generated by a server-side tool.
814 
815 - `ServerToolCaller20260120 object`
816 
817 - `CodeExecutionToolResultBlockParam object`
818 
819 - `type: "code_execution_tool_result"`
820 
821 - `content: CodeExecutionToolResultBlockParamContent`
822 
823 - `CodeExecutionToolResultErrorParam object`
824 
825 - `type: "code_execution_tool_result_error"`
826 
827 - `error_code: CodeExecutionToolResultErrorCode`
828 
829 - `"invalid_tool_input"`
830 
831 - `"unavailable"`
832 
833 - `"too_many_requests"`
834 
835 - `"execution_time_exceeded"`
836 
837 - `CodeExecutionResultBlockParam object`
838 
839 - `type: "code_execution_result"`
840 
841 - `content: array of CodeExecutionOutputBlockParam`
842 
843 - `type: "code_execution_output"`
844 
845 - `file_id: string`
846 
847 - `return_code: number`
848 
849 - `stderr: string`
850 
851 - `stdout: string`
852 
853 - `EncryptedCodeExecutionResultBlockParam object`
854 
855 Code execution result with encrypted stdout for PFC + web_search results.
856 
857 - `type: "encrypted_code_execution_result"`
858 
859 - `content: array of CodeExecutionOutputBlockParam`
860 
861 - `type: "code_execution_output"`
862 
863 - `file_id: string`
864 
865 - `encrypted_stdout: string`
866 
867 - `return_code: number`
868 
869 - `stderr: string`
870 
871 - `tool_use_id: string`
872 
873 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
874 
875 - `cache_control: optional CacheControlEphemeral or null`
876 
877 Create a cache control breakpoint at this content block.
878 
879 - `BashCodeExecutionToolResultBlockParam object`
880 
881 - `type: "bash_code_execution_tool_result"`
882 
883 - `content: BashCodeExecutionToolResultErrorParam or BashCodeExecutionResultBlockParam`
884 
885 - `BashCodeExecutionToolResultErrorParam object`
886 
887 - `type: "bash_code_execution_tool_result_error"`
888 
889 - `error_code: BashCodeExecutionToolResultErrorCode`
890 
891 - `"invalid_tool_input"`
892 
893 - `"unavailable"`
894 
895 - `"too_many_requests"`
896 
897 - `"execution_time_exceeded"`
898 
899 - `"output_file_too_large"`
900 
901 - `BashCodeExecutionResultBlockParam object`
902 
903 - `type: "bash_code_execution_result"`
904 
905 - `content: array of BashCodeExecutionOutputBlockParam`
906 
907 - `type: "bash_code_execution_output"`
908 
909 - `file_id: string`
910 
911 - `return_code: number`
912 
913 - `stderr: string`
914 
915 - `stdout: string`
916 
917 - `tool_use_id: string`
918 
919 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
920 
921 - `cache_control: optional CacheControlEphemeral or null`
922 
923 Create a cache control breakpoint at this content block.
924 
925 - `TextEditorCodeExecutionToolResultBlockParam object`
926 
927 - `type: "text_editor_code_execution_tool_result"`
928 
929 - `content: TextEditorCodeExecutionToolResultErrorParam or TextEditorCodeExecutionViewResultBlockParam or TextEditorCodeExecutionCreateResultBlockParam or TextEditorCodeExecutionStrReplaceResultBlockParam`
930 
931 - `TextEditorCodeExecutionToolResultErrorParam object`
932 
933 - `type: "text_editor_code_execution_tool_result_error"`
934 
935 - `error_code: TextEditorCodeExecutionToolResultErrorCode`
936 
937 - `"invalid_tool_input"`
938 
939 - `"unavailable"`
940 
941 - `"too_many_requests"`
942 
943 - `"execution_time_exceeded"`
944 
945 - `"file_not_found"`
946 
947 - `error_message: optional string or null`
948 
949 - `TextEditorCodeExecutionViewResultBlockParam object`
950 
951 - `type: "text_editor_code_execution_view_result"`
952 
953 - `content: string`
954 
955 - `file_type: "text" or "image" or "pdf"`
956 
957 - `"text"`
958 
959 - `"image"`
960 
961 - `"pdf"`
962 
963 - `num_lines: optional number or null`
964 
965 - `start_line: optional number or null`
966 
967 - `total_lines: optional number or null`
968 
969 - `TextEditorCodeExecutionCreateResultBlockParam object`
970 
971 - `type: "text_editor_code_execution_create_result"`
972 
973 - `is_file_update: boolean`
974 
975 - `TextEditorCodeExecutionStrReplaceResultBlockParam object`
976 
977 - `type: "text_editor_code_execution_str_replace_result"`
978 
979 - `lines: optional array of string or null`
980 
981 - `new_lines: optional number or null`
982 
983 - `new_start: optional number or null`
984 
985 - `old_lines: optional number or null`
986 
987 - `old_start: optional number or null`
988 
989 - `tool_use_id: string`
990 
991 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
992 
993 - `cache_control: optional CacheControlEphemeral or null`
994 
995 Create a cache control breakpoint at this content block.
996 
997 - `ToolSearchToolResultBlockParam object`
998 
999 - `type: "tool_search_tool_result"`
1000 
1001 - `content: ToolSearchToolResultErrorParam or ToolSearchToolSearchResultBlockParam`
1002 
1003 - `ToolSearchToolResultErrorParam object`
1004 
1005 - `type: "tool_search_tool_result_error"`
1006 
1007 - `error_code: ToolSearchToolResultErrorCode`
1008 
1009 - `"invalid_tool_input"`
1010 
1011 - `"unavailable"`
1012 
1013 - `"too_many_requests"`
1014 
1015 - `"execution_time_exceeded"`
1016 
1017 - `error_message: optional string or null`
1018 
1019 - `ToolSearchToolSearchResultBlockParam object`
1020 
1021 - `type: "tool_search_tool_search_result"`
1022 
1023 - `tool_references: array of ToolReferenceBlockParam`
1024 
1025 - `type: "tool_reference"`
1026 
1027 - `tool_name: string`
1028 
1029 minLength: 1, maxLength: 256, pattern: ^[a-zA-Z0-9_-]{1,256}$
1030 
1031 - `cache_control: optional CacheControlEphemeral or null`
1032 
1033 Create a cache control breakpoint at this content block.
1034 
1035 - `tool_use_id: string`
1036 
1037 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
1038 
1039 - `cache_control: optional CacheControlEphemeral or null`
1040 
1041 Create a cache control breakpoint at this content block.
1042 
1043 - `ContainerUploadBlockParam object`
1044 
1045 A content block that represents a file to be uploaded to the container
1046 Files uploaded via this block will be available in the container's input directory.
1047 
1048 - `type: "container_upload"`
1049 
1050 - `file_id: string`
1051 
1052 - `cache_control: optional CacheControlEphemeral or null`
1053 
1054 Create a cache control breakpoint at this content block.
1055 
1056 - `role: "user" or "assistant" or "system"`
1057 
1058 - `"user"`
1059 
1060 - `"assistant"`
1061 
1062 - `"system"`
1086 - `role: "system"`
10631087 
10641088- `model: Model`
10651089 
from line 2994
29702994```bash
29712995curl https://api.anthropic.com/v1/messages/count_tokens \
29722996 -H 'Content-Type: application/json' \
2973 -H 'anthropic-version: 2023-06-01' \
2974 -H "X-Api-Key: $ANTHROPIC_API_KEY" \
2997 -H 'anthropic-version: 2026-10-21' \
2998 -H "Authorization: Bearer $ANTHROPIC_API_KEY" \
29752999 -d '{
29763000 "messages": [
29773001 {
29783002 
Feedback