The whole hunk
from line 1, old and new numbered
/
lines
from line 1
1---
2title: Count tokens in a Message
3url: https://platform.claude.com/docs/en/api/messages/count_tokens
4---
5
16# Count tokens in a Message
27
38**POST** `/v1/messages/count_tokens`
from line 19
1419
1520 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.
1621
22- `"anthropic-workspace-id": optional string`
23
1724## Body parameters
1825
1926- `messages: array of MessageParam`
from line 82
7582
7683 - `TextBlockParam object`
7784
85 - `type: "text"`
86
7887 - `text: string`
7988
8089 minLength: 1
8190
82 - `type: "text"`
83
8491 - `cache_control: optional CacheControlEphemeral or null`
8592
8693 Create a cache control breakpoint at this content block.
from line 113
106113
107114 - `CitationCharLocationParam object`
108115
116 - `type: "char_location"`
117
109118 - `cited_text: string`
110119
111120 - `document_index: number`
from line 131
122131
123132 minimum: 0
124133
125 - `type: "char_location"`
126
127134 - `CitationPageLocationParam object`
128135
136 - `type: "page_location"`
137
129138 - `cited_text: string`
130139
131140 - `document_index: number`
from line 151
142151
143152 minimum: 1
144153
145 - `type: "page_location"`
146
147154 - `CitationContentBlockLocationParam object`
148155
156 - `type: "content_block_location"`
157
149158 - `cited_text: string`
150159
151160 The full text of the cited block range, concatenated.
from line 181
172181
173182 minimum: 0
174183
175 - `type: "content_block_location"`
176
177184 - `CitationWebSearchResultLocationParam object`
178185
186 - `type: "web_search_result_location"`
187
179188 - `cited_text: string`
180189
181190 - `encrypted_index: string`
from line 193
184193
185194 maxLength: 512, minLength: 1
186195
187 - `type: "web_search_result_location"`
188
189196 - `url: string`
190197
191198 minLength: 1
from line 199
192199
193200 - `CitationSearchResultLocationParam object`
194201
202 - `type: "search_result_location"`
203
195204 - `cited_text: string`
196205
197206 The full text of the cited block range, concatenated.
from line 231
222231
223232 - `title: string or null`
224233
225 - `type: "search_result_location"`
226
227234 - `ImageBlockParam object`
228235
236 - `type: "image"`
237
229238 - `source: Base64ImageSource or URLImageSource or FileImageSource`
230239
231240 - `Base64ImageSource object`
232241
242 - `type: "base64"`
243
233244 - `data: string`
234245
235246 format: byte
from line 255
244255
245256 - `"image/webp"`
246257
247 - `type: "base64"`
248
249258 - `URLImageSource object`
250259
251260 - `type: "url"`
from line 263
254263
255264 - `FileImageSource object`
256265
257 - `file_id: string`
258
259266 - `type: "file"`
260267
261 - `type: "image"`
268 - `file_id: string`
262269
263270 - `cache_control: optional CacheControlEphemeral or null`
264271
from line 285
278285
279286 - `DocumentBlockParam object`
280287
288 - `type: "document"`
289
281290 - `source: Base64PDFSource or PlainTextSource or ContentBlockSource or 2 more`
282291
283292 - `Base64PDFSource object`
284293
294 - `type: "base64"`
295
285296 - `data: string`
286297
287298 format: byte
from line 299
288299
289300 - `media_type: "application/pdf"`
290301
291 - `type: "base64"`
292
293302 - `PlainTextSource object`
294303
304 - `type: "text"`
305
295306 - `data: string`
296307
297308 - `media_type: "text/plain"`
298309
299 - `type: "text"`
300
301310 - `ContentBlockSource object`
302311
312 - `type: "content"`
313
303314 - `content: string or array of ContentBlockSourceContent`
304315
305316 - `string`
from line 321
310321
311322 - `ImageBlockParam object`
312323
313 - `type: "content"`
314
315324 - `URLPDFSource object`
316325
317326 - `type: "url"`
from line 329
320329
321330 - `FileDocumentSource object`
322331
323 - `file_id: string`
324
325332 - `type: "file"`
326333
327 - `type: "document"`
334 - `file_id: string`
328335
329336 - `cache_control: optional CacheControlEphemeral or null`
330337
from line 351
344351
345352 - `SearchResultBlockParam object`
346353
354 - `type: "search_result"`
355
347356 - `content: array of TextBlockParam`
348357
358 - `type: "text"`
359
349360 - `text: string`
350361
351362 minLength: 1
352363
353 - `type: "text"`
354
355364 - `cache_control: optional CacheControlEphemeral or null`
356365
357366 Create a cache control breakpoint at this content block.
from line 371
362371
363372 - `title: string`
364373
365 - `type: "search_result"`
366
367374 - `cache_control: optional CacheControlEphemeral or null`
368375
369376 Create a cache control breakpoint at this content block.
from line 379
372379
373380 - `ThinkingBlockParam object`
374381
382 - `type: "thinking"`
383
375384 - `signature: string`
376385
377386 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.
from line 391
382391
383392 The `thinking` text of this block as returned by the API.
384393
385 - `type: "thinking"`
386
387394 - `RedactedThinkingBlockParam object`
388395
396 - `type: "redacted_thinking"`
397
389398 - `data: string`
390399
391400 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.
392401
393 - `type: "redacted_thinking"`
394
395402 - `ToolUseBlockParam object`
396403
404 - `type: "tool_use"`
405
397406 - `id: string`
398407
399408 pattern: ^[a-zA-Z0-9_-]+$
from line 413
404413
405414 maxLength: 200, minLength: 1
406415
407 - `type: "tool_use"`
408
409416 - `cache_control: optional CacheControlEphemeral or null`
410417
411418 Create a cache control breakpoint at this content block.
from line 431
424431
425432 Tool invocation generated by a server-side tool.
426433
434 - `type: "code_execution_20250825"`
435
427436 - `tool_id: string`
428437
429438 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
430439
431 - `type: "code_execution_20250825"`
432
433440 - `ServerToolCaller20260120 object`
434441
442 - `type: "code_execution_20260120"`
443
435444 - `tool_id: string`
436445
437446 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
438447
439 - `type: "code_execution_20260120"`
440
441448 - `toolset_name: optional string or null`
442449
443450 For a toolset member tool_use, the toolset family this member belongs to.
from line 453
446453
447454 - `ToolResultBlockParam object`
448455
456 - `type: "tool_result"`
457
449458 - `tool_use_id: string`
450459
451460 pattern: ^[a-zA-Z0-9_-]+$
452461
453 - `type: "tool_result"`
454
455462 - `cache_control: optional CacheControlEphemeral or null`
456463
457464 Create a cache control breakpoint at this content block.
from line 481
474481
475482 Tool reference block that can be included in tool_result content.
476483
484 - `type: "tool_reference"`
485
477486 - `tool_name: string`
478487
479488 maxLength: 256, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,256}$
480489
481 - `type: "tool_reference"`
482
483490 - `cache_control: optional CacheControlEphemeral or null`
484491
485492 Create a cache control breakpoint at this content block.
from line 501
494501 browser toolset member `tool_use`. The server renders the
495502 model-visible text from it; the model never sees the raw fields.
496503
504 - `type: "browser_state"`
505
497506 - `tabs: array of BrowserStateTabEntry`
498507
499508 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`.
from line 531
522531
523532 Whether this tab is the active tab after this call. Whenever `tabs` is non-empty, exactly one entry is marked `active: true`.
524533
525 - `type: "browser_state"`
526
527534 - `cache_control: optional CacheControlEphemeral or null`
528535
529536 Create a cache control breakpoint at this content block.
from line 551
544551 during a failed call gets no deferred `tab_opened`; it simply appears
545552 in the next result's `tabs` inventory.
546553
554 - `type: "tab_opened"`
555
547556 - `tab_id: string`
548557
549558 The `tab_id` of the opened tab, present in `tabs`.
from line 559
550559
551560 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
552561
553 - `type: "tab_opened"`
554
555562 - `BrowserStateChangeDownloadStarted object`
556563
557564 A file download that started during this call.
558565
566 - `type: "download_started"`
567
559568 - `download_id: string`
560569
561570 The caller-assigned identifier for this download, stable across the state changes reporting it.
from line 571
562571
563572 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
564573
565 - `type: "download_started"`
566
567574 - `url: string`
568575
569576 The final post-redirect URL the download was served from.
from line 584
577584 `download_started`, when the download finished during the call that
578585 started it (at most one state change per `download_id` per result).
579586
587 - `type: "download_completed"`
588
580589 - `download_id: string`
581590
582591 The caller-assigned identifier for this download, stable across the state changes reporting it.
from line 592
583592
584593 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
585594
586 - `type: "download_completed"`
587
588595 - `url: string`
589596
590597 The final post-redirect URL the download was served from.
from line 614
607614
608615 A file download that failed — or was cancelled — during this call.
609616
617 - `type: "download_failed"`
618
610619 - `download_id: string`
611620
612621 The caller-assigned identifier for this download, stable across the state changes reporting it.
from line 622
613622
614623 maxLength: 4096, minLength: 1, pattern: ^[^\x00-\x1f\x7f-\x9f\u2028\u2029]*$
615624
616 - `type: "download_failed"`
617
618625 - `url: string`
619626
620627 The final post-redirect URL the download was served from.
from line 644
637644
638645 - `ServerToolUseBlockParam object`
639646
647 - `type: "server_tool_use"`
648
640649 - `id: string`
641650
642651 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
from line 668
659668
660669 - `"tool_search_tool_bm25"`
661670
662 - `type: "server_tool_use"`
663
664671 - `cache_control: optional CacheControlEphemeral or null`
665672
666673 Create a cache control breakpoint at this content block.
from line 688
681688
682689 - `WebSearchToolResultBlockParam object`
683690
691 - `type: "web_search_tool_result"`
692
684693 - `content: WebSearchToolResultBlockParamContent`
685694
686695 - `WebSearchToolResultBlockItem = array of WebSearchResultBlockParam`
687696
697 - `type: "web_search_result"`
698
688699 - `encrypted_content: string`
689700
690701 - `title: string`
691702
692 - `type: "web_search_result"`
693
694703 - `url: string`
695704
696705 - `page_age: optional string or null`
from line 706
697706
698707 - `WebSearchToolRequestError object`
699708
709 - `type: "web_search_tool_result_error"`
710
700711 - `error_code: WebSearchToolResultErrorCode`
701712
702713 - `"invalid_tool_input"`
from line 722
711722
712723 - `"request_too_large"`
713724
714 - `type: "web_search_tool_result_error"`
715
716725 - `tool_use_id: string`
717726
718727 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
719728
720 - `type: "web_search_tool_result"`
721
722729 - `cache_control: optional CacheControlEphemeral or null`
723730
724731 Create a cache control breakpoint at this content block.
from line 746
739746
740747 - `WebFetchToolResultBlockParam object`
741748
749 - `type: "web_fetch_tool_result"`
750
742751 - `content: WebFetchToolResultErrorBlockParam or WebFetchBlockParam`
743752
744753 - `WebFetchToolResultErrorBlockParam object`
745754
755 - `type: "web_fetch_tool_result_error"`
756
746757 - `error_code: WebFetchToolResultErrorCode`
747758
748759 - `"invalid_tool_input"`
from line 774
763774
764775 - `"unavailable"`
765776
766 - `type: "web_fetch_tool_result_error"`
777 - `"content_too_large"`
767778
768779 - `WebFetchBlockParam object`
769780
770 - `content: DocumentBlockParam`
771
772781 - `type: "web_fetch_result"`
773782
783 - `content: DocumentBlockParam`
784
774785 - `url: string`
775786
776787 Fetched content URL
from line 794
783794
784795 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
785796
786 - `type: "web_fetch_tool_result"`
787
788797 - `cache_control: optional CacheControlEphemeral or null`
789798
790799 Create a cache control breakpoint at this content block.
from line 814
805814
806815 - `CodeExecutionToolResultBlockParam object`
807816
817 - `type: "code_execution_tool_result"`
818
808819 - `content: CodeExecutionToolResultBlockParamContent`
809820
810821 Code execution result with encrypted stdout for PFC + web_search results.
from line 822
811822
812823 - `CodeExecutionToolResultErrorParam object`
813824
825 - `type: "code_execution_tool_result_error"`
826
814827 - `error_code: CodeExecutionToolResultErrorCode`
815828
816829 - `"invalid_tool_input"`
from line 834
821834
822835 - `"execution_time_exceeded"`
823836
824 - `type: "code_execution_tool_result_error"`
825
826837 - `CodeExecutionResultBlockParam object`
827838
839 - `type: "code_execution_result"`
840
828841 - `content: array of CodeExecutionOutputBlockParam`
829842
830 - `file_id: string`
831
832843 - `type: "code_execution_output"`
833844
845 - `file_id: string`
846
834847 - `return_code: number`
835848
836849 - `stderr: string`
from line 850
837850
838851 - `stdout: string`
839852
840 - `type: "code_execution_result"`
841
842853 - `EncryptedCodeExecutionResultBlockParam object`
843854
844855 Code execution result with encrypted stdout for PFC + web_search results.
845856
857 - `type: "encrypted_code_execution_result"`
858
846859 - `content: array of CodeExecutionOutputBlockParam`
847860
848 - `file_id: string`
849
850861 - `type: "code_execution_output"`
851862
863 - `file_id: string`
864
852865 - `encrypted_stdout: string`
853866
854867 - `return_code: number`
from line 868
855868
856869 - `stderr: string`
857870
858 - `type: "encrypted_code_execution_result"`
859
860871 - `tool_use_id: string`
861872
862873 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
863874
864 - `type: "code_execution_tool_result"`
865
866875 - `cache_control: optional CacheControlEphemeral or null`
867876
868877 Create a cache control breakpoint at this content block.
from line 878
869878
870879 - `BashCodeExecutionToolResultBlockParam object`
871880
881 - `type: "bash_code_execution_tool_result"`
882
872883 - `content: BashCodeExecutionToolResultErrorParam or BashCodeExecutionResultBlockParam`
873884
874885 - `BashCodeExecutionToolResultErrorParam object`
875886
887 - `type: "bash_code_execution_tool_result_error"`
888
876889 - `error_code: BashCodeExecutionToolResultErrorCode`
877890
878891 - `"invalid_tool_input"`
from line 898
885898
886899 - `"output_file_too_large"`
887900
888 - `type: "bash_code_execution_tool_result_error"`
889
890901 - `BashCodeExecutionResultBlockParam object`
891902
903 - `type: "bash_code_execution_result"`
904
892905 - `content: array of BashCodeExecutionOutputBlockParam`
893906
894 - `file_id: string`
895
896907 - `type: "bash_code_execution_output"`
897908
909 - `file_id: string`
910
898911 - `return_code: number`
899912
900913 - `stderr: string`
from line 914
901914
902915 - `stdout: string`
903916
904 - `type: "bash_code_execution_result"`
905
906917 - `tool_use_id: string`
907918
908919 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
909920
910 - `type: "bash_code_execution_tool_result"`
911
912921 - `cache_control: optional CacheControlEphemeral or null`
913922
914923 Create a cache control breakpoint at this content block.
from line 924
915924
916925 - `TextEditorCodeExecutionToolResultBlockParam object`
917926
927 - `type: "text_editor_code_execution_tool_result"`
928
918929 - `content: TextEditorCodeExecutionToolResultErrorParam or TextEditorCodeExecutionViewResultBlockParam or TextEditorCodeExecutionCreateResultBlockParam or TextEditorCodeExecutionStrReplaceResultBlockParam`
919930
920931 - `TextEditorCodeExecutionToolResultErrorParam object`
921932
933 - `type: "text_editor_code_execution_tool_result_error"`
934
922935 - `error_code: TextEditorCodeExecutionToolResultErrorCode`
923936
924937 - `"invalid_tool_input"`
from line 944
931944
932945 - `"file_not_found"`
933946
934 - `type: "text_editor_code_execution_tool_result_error"`
935
936947 - `error_message: optional string or null`
937948
938949 - `TextEditorCodeExecutionViewResultBlockParam object`
939950
951 - `type: "text_editor_code_execution_view_result"`
952
940953 - `content: string`
941954
942955 - `file_type: "text" or "image" or "pdf"`
from line 960
947960
948961 - `"pdf"`
949962
950 - `type: "text_editor_code_execution_view_result"`
951
952963 - `num_lines: optional number or null`
953964
954965 - `start_line: optional number or null`
from line 968
957968
958969 - `TextEditorCodeExecutionCreateResultBlockParam object`
959970
960 - `is_file_update: boolean`
961
962971 - `type: "text_editor_code_execution_create_result"`
963972
973 - `is_file_update: boolean`
974
964975 - `TextEditorCodeExecutionStrReplaceResultBlockParam object`
965976
966977 - `type: "text_editor_code_execution_str_replace_result"`
from line 990
979990
980991 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
981992
982 - `type: "text_editor_code_execution_tool_result"`
983
984993 - `cache_control: optional CacheControlEphemeral or null`
985994
986995 Create a cache control breakpoint at this content block.
from line 996
987996
988997 - `ToolSearchToolResultBlockParam object`
989998
999 - `type: "tool_search_tool_result"`
1000
9901001 - `content: ToolSearchToolResultErrorParam or ToolSearchToolSearchResultBlockParam`
9911002
9921003 - `ToolSearchToolResultErrorParam object`
9931004
1005 - `type: "tool_search_tool_result_error"`
1006
9941007 - `error_code: ToolSearchToolResultErrorCode`
9951008
9961009 - `"invalid_tool_input"`
from line 1014
10011014
10021015 - `"execution_time_exceeded"`
10031016
1004 - `type: "tool_search_tool_result_error"`
1005
10061017 - `error_message: optional string or null`
10071018
10081019 - `ToolSearchToolSearchResultBlockParam object`
10091020
1021 - `type: "tool_search_tool_search_result"`
1022
10101023 - `tool_references: array of ToolReferenceBlockParam`
10111024
1025 - `type: "tool_reference"`
1026
10121027 - `tool_name: string`
10131028
10141029 maxLength: 256, minLength: 1, pattern: ^[a-zA-Z0-9_-]{1,256}$
10151030
1016 - `type: "tool_reference"`
1017
10181031 - `cache_control: optional CacheControlEphemeral or null`
10191032
10201033 Create a cache control breakpoint at this content block.
10211034
1022 - `type: "tool_search_tool_search_result"`
1023
10241035 - `tool_use_id: string`
10251036
10261037 pattern: ^srvtoolu_[a-zA-Z0-9_]+$
10271038
1028 - `type: "tool_search_tool_result"`
1029
10301039 - `cache_control: optional CacheControlEphemeral or null`
10311040
10321041 Create a cache control breakpoint at this content block.
from line 1045
10361045 A content block that represents a file to be uploaded to the container
10371046 Files uploaded via this block will be available in the container's input directory.
10381047
1039 - `file_id: string`
1040
10411048 - `type: "container_upload"`
10421049
1050 - `file_id: string`
1051
10431052 - `cache_control: optional CacheControlEphemeral or null`
10441053
10451054 Create a cache control breakpoint at this content block.
from line 1169
11601169
11611170 A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
11621171
1172 - `type: "json_schema"`
1173
11631174 - `schema: map[unknown]`
11641175
11651176 The JSON schema of the format
11661177
1167 - `type: "json_schema"`
1168
11691178- `system: optional string or array of TextBlockParam`
11701179
11711180 System prompt.
from line 1185
11761185
11771186 - `array of TextBlockParam`
11781187
1188 - `type: "text"`
1189
11791190 - `text: string`
11801191
11811192 minLength: 1
11821193
1183 - `type: "text"`
1184
11851194 - `cache_control: optional CacheControlEphemeral or null`
11861195
11871196 Create a cache control breakpoint at this content block.
from line 1207
11981207
11991208 - `ThinkingConfigEnabled object`
12001209
1210 - `type: "enabled"`
1211
12011212 - `budget_tokens: number`
12021213
12031214 Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.
from line 1219
12081219
12091220 minimum: 1024
12101221
1211 - `type: "enabled"`
1212
12131222 - `display: optional "summarized" or "omitted" or null`
12141223
12151224 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 1275
12661275
12671276 The model will use the specified tool with `tool_choice.name`.
12681277
1278 - `type: "tool"`
1279
12691280 - `name: string`
12701281
12711282 The name of the tool to use.
12721283
1273 - `type: "tool"`
1274
12751284 - `disable_parallel_tool_use: optional boolean`
12761285
12771286 Whether to disable parallel tool use.
from line 1359
13501359
13511360 - `Tool object`
13521361
1362 - `type: optional "custom" or null`
1363
13531364 - `input_schema: object`
13541365
13551366 [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
from line 1415
14041415
14051416 When true, guarantees schema validation on tool names and inputs
14061417
1407 - `type: optional "custom" or null`
1408
14091418 - `ToolBash20250124 object`
14101419
1420 - `type: "bash_20250124"`
1421
14111422 - `name: "bash"`
14121423
14131424 Name of the tool.
from line 1425
14141425
14151426 This is how the tool will be called by the model and in `tool_use` blocks.
14161427
1417 - `type: "bash_20250124"`
1418
14191428 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
14201429
14211430 - `"direct"`
from line 1451
14421451
14431452 - `CodeExecutionTool20250522 object`
14441453
1454 - `type: "code_execution_20250522"`
1455
14451456 - `name: "code_execution"`
14461457
14471458 Name of the tool.
from line 1459
14481459
14491460 This is how the tool will be called by the model and in `tool_use` blocks.
14501461
1451 - `type: "code_execution_20250522"`
1452
14531462 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
14541463
14551464 - `"direct"`
from line 1483
14741483
14751484 - `CodeExecutionTool20250825 object`
14761485
1486 - `type: "code_execution_20250825"`
1487
14771488 - `name: "code_execution"`
14781489
14791490 Name of the tool.
from line 1491
14801491
14811492 This is how the tool will be called by the model and in `tool_use` blocks.
14821493
1483 - `type: "code_execution_20250825"`
1484
14851494 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
14861495
14871496 - `"direct"`
from line 1517
15081517
15091518 Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint).
15101519
1520 - `type: "code_execution_20260120"`
1521
15111522 - `name: "code_execution"`
15121523
15131524 Name of the tool.
from line 1525
15141525
15151526 This is how the tool will be called by the model and in `tool_use` blocks.
15161527
1517 - `type: "code_execution_20260120"`
1518
15191528 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
15201529
15211530 - `"direct"`
from line 1551
15421551
15431552 Code execution tool with REPL state persistence.
15441553
1554 - `type: "code_execution_20260521"`
1555
15451556 - `name: "code_execution"`
15461557
15471558 Name of the tool.
from line 1559
15481559
15491560 This is how the tool will be called by the model and in `tool_use` blocks.
15501561
1551 - `type: "code_execution_20260521"`
1552
15531562 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
15541563
15551564 - `"direct"`
from line 1603
15941603 absent. Unknown keys are rejected: the field set is this toolset
15951604 version's complete member set.
15961605
1606 - `type: optional BrowserTypeConfig or null`
1607
1608 `type`'s config overrides.
1609
1610 - `defer_loading: optional boolean or null`
1611
1612 Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
1613
1614 - `enabled: optional boolean or null`
1615
1616 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.
1617
15971618 - `close_tab: optional BrowserCloseTabConfig or null`
15981619
15991620 `close_tab`'s config overrides.
from line 1951
19301951
19311952 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.
19321953
1933 - `type: optional BrowserTypeConfig or null`
1934
1935 `type`'s config overrides.
1936
1937 - `defer_loading: optional boolean or null`
1938
1939 Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
1940
1941 - `enabled: optional boolean or null`
1942
1943 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.
1944
19451954 - `wait: optional BrowserWaitConfig or null`
19461955
19471956 `wait`'s config overrides.
from line 1977
19681977
19691978 - `MemoryTool20250818 object`
19701979
1980 - `type: "memory_20250818"`
1981
19711982 - `name: "memory"`
19721983
19731984 Name of the tool.
from line 1985
19741985
19751986 This is how the tool will be called by the model and in `tool_use` blocks.
19761987
1977 - `type: "memory_20250818"`
1978
19791988 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
19801989
19811990 - `"direct"`
from line 2035
20262035 absent. Unknown keys are rejected: the field set is this toolset
20272036 version's complete member set.
20282037
2038 - `type: optional ComputerTypeConfig or null`
2039
2040 `type`'s config overrides.
2041
2042 - `defer_loading: optional boolean or null`
2043
2044 Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
2045
2046 - `enabled: optional boolean or null`
2047
2048 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.
2049
20292050 - `cursor_position: optional ComputerCursorPositionConfig or null`
20302051
20312052 `cursor_position`'s config overrides.
from line 2215
21942215
21952216 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.
21962217
2197 - `type: optional ComputerTypeConfig or null`
2198
2199 `type`'s config overrides.
2200
2201 - `defer_loading: optional boolean or null`
2202
2203 Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
2204
2205 - `enabled: optional boolean or null`
2206
2207 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.
2208
22092218 - `wait: optional ComputerWaitConfig or null`
22102219
22112220 `wait`'s config overrides.
from line 2241
22322241
22332242 - `ToolTextEditor20250124 object`
22342243
2244 - `type: "text_editor_20250124"`
2245
22352246 - `name: "str_replace_editor"`
22362247
22372248 Name of the tool.
from line 2249
22382249
22392250 This is how the tool will be called by the model and in `tool_use` blocks.
22402251
2241 - `type: "text_editor_20250124"`
2242
22432252 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
22442253
22452254 - `"direct"`
from line 2275
22662275
22672276 - `ToolTextEditor20250429 object`
22682277
2278 - `type: "text_editor_20250429"`
2279
22692280 - `name: "str_replace_based_edit_tool"`
22702281
22712282 Name of the tool.
from line 2283
22722283
22732284 This is how the tool will be called by the model and in `tool_use` blocks.
22742285
2275 - `type: "text_editor_20250429"`
2276
22772286 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
22782287
22792288 - `"direct"`
from line 2309
23002309
23012310 - `ToolTextEditor20250728 object`
23022311
2312 - `type: "text_editor_20250728"`
2313
23032314 - `name: "str_replace_based_edit_tool"`
23042315
23052316 Name of the tool.
from line 2317
23062317
23072318 This is how the tool will be called by the model and in `tool_use` blocks.
23082319
2309 - `type: "text_editor_20250728"`
2310
23112320 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
23122321
23132322 - `"direct"`
from line 2349
23402349
23412350 - `WebSearchTool20250305 object`
23422351
2352 - `type: "web_search_20250305"`
2353
23432354 - `name: "web_search"`
23442355
23452356 Name of the tool.
from line 2357
23462357
23472358 This is how the tool will be called by the model and in `tool_use` blocks.
23482359
2349 - `type: "web_search_20250305"`
2350
23512360 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
23522361
23532362 - `"direct"`
from line 2425
24162425
24172426 - `WebFetchTool20250910 object`
24182427
2428 - `type: "web_fetch_20250910"`
2429
24192430 - `name: "web_fetch"`
24202431
24212432 Name of the tool.
from line 2433
24222433
24232434 This is how the tool will be called by the model and in `tool_use` blocks.
24242435
2425 - `type: "web_fetch_20250910"`
2426
24272436 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
24282437
24292438 - `"direct"`
from line 2481
24722481
24732482 - `WebSearchTool20260209 object`
24742483
2484 - `type: "web_search_20260209"`
2485
24752486 - `name: "web_search"`
24762487
24772488 Name of the tool.
from line 2489
24782489
24792490 This is how the tool will be called by the model and in `tool_use` blocks.
24802491
2481 - `type: "web_search_20260209"`
2482
24832492 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
24842493
24852494 - `"direct"`
from line 2531
25222531
25232532 - `WebFetchTool20260209 object`
25242533
2534 - `type: "web_fetch_20260209"`
2535
25252536 - `name: "web_fetch"`
25262537
25272538 Name of the tool.
from line 2539
25282539
25292540 This is how the tool will be called by the model and in `tool_use` blocks.
25302541
2531 - `type: "web_fetch_20260209"`
2532
25332542 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
25342543
25352544 - `"direct"`
from line 2589
25802589
25812590 Web fetch tool with use_cache parameter for bypassing cached content.
25822591
2592 - `type: "web_fetch_20260309"`
2593
25832594 - `name: "web_fetch"`
25842595
25852596 Name of the tool.
from line 2597
25862597
25872598 This is how the tool will be called by the model and in `tool_use` blocks.
25882599
2589 - `type: "web_fetch_20260309"`
2590
25912600 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
25922601
25932602 - `"direct"`
from line 2649
26402649
26412650 - `WebSearchTool20260318 object`
26422651
2652 - `type: "web_search_20260318"`
2653
26432654 - `name: "web_search"`
26442655
26452656 Name of the tool.
from line 2657
26462657
26472658 This is how the tool will be called by the model and in `tool_use` blocks.
26482659
2649 - `type: "web_search_20260318"`
2650
26512660 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
26522661
26532662 - `"direct"`
from line 2707
26982707
26992708 - `WebFetchTool20260318 object`
27002709
2710 - `type: "web_fetch_20260318"`
2711
27012712 - `name: "web_fetch"`
27022713
27032714 Name of the tool.
from line 2715
27042715
27052716 This is how the tool will be called by the model and in `tool_use` blocks.
27062717
2707 - `type: "web_fetch_20260318"`
2708
27092718 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
27102719
27112720 - `"direct"`
from line 2775
27662775
27672776 - `ToolSearchToolBm25_20251119 object`
27682777
2769 - `name: "tool_search_tool_bm25"`
2770
2771 Name of the tool.
2772
2773 This is how the tool will be called by the model and in `tool_use` blocks.
2774
27752778 - `type: "tool_search_tool_bm25_20251119" or "tool_search_tool_bm25"`
27762779
27772780 - `"tool_search_tool_bm25_20251119"`
from line 2781
27782781
27792782 - `"tool_search_tool_bm25"`
27802783
2784 - `name: "tool_search_tool_bm25"`
2785
2786 Name of the tool.
2787
2788 This is how the tool will be called by the model and in `tool_use` blocks.
2789
27812790 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
27822791
27832792 - `"direct"`
from line 2811
28022811
28032812 - `ToolSearchToolRegex20251119 object`
28042813
2805 - `name: "tool_search_tool_regex"`
2806
2807 Name of the tool.
2808
2809 This is how the tool will be called by the model and in `tool_use` blocks.
2810
28112814 - `type: "tool_search_tool_regex_20251119" or "tool_search_tool_regex"`
28122815
28132816 - `"tool_search_tool_regex_20251119"`
28142817
28152818 - `"tool_search_tool_regex"`
2819
2820 - `name: "tool_search_tool_regex"`
2821
2822 Name of the tool.
2823
2824 This is how the tool will be called by the model and in `tool_use` blocks.
28162825
28172826 - `allowed_callers: optional array of "direct" or "code_execution_20250825" or "code_execution_20260120" or "code_execution_20260521"`
28182827