@@ -63,7 +63,7 @@ export class Messages extends APIResource {
63
63
* const betaMessage = await client.beta.messages.create({
64
64
* max_tokens: 1024,
65
65
* messages: [{ content: 'Hello, world', role: 'user' }],
66
- * model: 'claude-3-7- sonnet-20250219 ',
66
+ * model: 'claude-sonnet-4-20250514 ',
67
67
* });
68
68
* ```
69
69
*/
@@ -299,7 +299,8 @@ export interface BetaCitationsDelta {
299
299
| BetaCitationCharLocation
300
300
| BetaCitationPageLocation
301
301
| BetaCitationContentBlockLocation
302
- | BetaCitationsWebSearchResultLocation ;
302
+ | BetaCitationsWebSearchResultLocation
303
+ | BetaSearchResultLocationCitation ;
303
304
304
305
type : 'citations_delta' ;
305
306
}
@@ -460,32 +461,33 @@ export interface BetaContainerUploadBlockParam {
460
461
*/
461
462
export type BetaContentBlock =
462
463
| BetaTextBlock
464
+ | BetaThinkingBlock
465
+ | BetaRedactedThinkingBlock
463
466
| BetaToolUseBlock
464
467
| BetaServerToolUseBlock
465
468
| BetaWebSearchToolResultBlock
466
469
| BetaCodeExecutionToolResultBlock
467
470
| BetaMCPToolUseBlock
468
471
| BetaMCPToolResultBlock
469
- | BetaContainerUploadBlock
470
- | BetaThinkingBlock
471
- | BetaRedactedThinkingBlock ;
472
+ | BetaContainerUploadBlock ;
472
473
473
474
/**
474
475
* Regular text content.
475
476
*/
476
477
export type BetaContentBlockParam =
477
- | BetaServerToolUseBlockParam
478
- | BetaWebSearchToolResultBlockParam
479
- | BetaCodeExecutionToolResultBlockParam
480
- | BetaMCPToolUseBlockParam
481
- | BetaRequestMCPToolResultBlockParam
482
478
| BetaTextBlockParam
483
479
| BetaImageBlockParam
484
- | BetaToolUseBlockParam
485
- | BetaToolResultBlockParam
486
480
| BetaRequestDocumentBlock
481
+ | BetaSearchResultBlockParam
487
482
| BetaThinkingBlockParam
488
483
| BetaRedactedThinkingBlockParam
484
+ | BetaToolUseBlockParam
485
+ | BetaToolResultBlockParam
486
+ | BetaServerToolUseBlockParam
487
+ | BetaWebSearchToolResultBlockParam
488
+ | BetaCodeExecutionToolResultBlockParam
489
+ | BetaMCPToolUseBlockParam
490
+ | BetaRequestMCPToolResultBlockParam
489
491
| BetaContainerUploadBlockParam ;
490
492
491
493
export interface BetaContentBlockSource {
@@ -646,6 +648,10 @@ export interface BetaMessage {
646
648
* - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
647
649
* - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
648
650
* - `"tool_use"`: the model invoked one or more tools
651
+ * - `"pause_turn"`: we paused a long-running turn. You may provide the response
652
+ * back as-is in a subsequent request to let the model continue.
653
+ * - `"refusal"`: when streaming classifiers intervene to handle potential policy
654
+ * violations
649
655
*
650
656
* In non-streaming mode this value is always non-null. In streaming mode, it is
651
657
* null in the `message_start` event and non-null otherwise.
@@ -768,15 +774,15 @@ export interface BetaRawContentBlockStartEvent {
768
774
*/
769
775
content_block :
770
776
| BetaTextBlock
777
+ | BetaThinkingBlock
778
+ | BetaRedactedThinkingBlock
771
779
| BetaToolUseBlock
772
780
| BetaServerToolUseBlock
773
781
| BetaWebSearchToolResultBlock
774
782
| BetaCodeExecutionToolResultBlock
775
783
| BetaMCPToolUseBlock
776
784
| BetaMCPToolResultBlock
777
- | BetaContainerUploadBlock
778
- | BetaThinkingBlock
779
- | BetaRedactedThinkingBlock ;
785
+ | BetaContainerUploadBlock ;
780
786
781
787
index : number ;
782
788
@@ -913,6 +919,55 @@ export interface BetaRequestMCPToolResultBlockParam {
913
919
is_error ?: boolean ;
914
920
}
915
921
922
+ export interface BetaSearchResultBlockParam {
923
+ content : Array < BetaTextBlockParam > ;
924
+
925
+ source : string ;
926
+
927
+ title : string ;
928
+
929
+ type : 'search_result' ;
930
+
931
+ /**
932
+ * Create a cache control breakpoint at this content block.
933
+ */
934
+ cache_control ?: BetaCacheControlEphemeral | null ;
935
+
936
+ citations ?: BetaCitationsConfigParam ;
937
+ }
938
+
939
+ export interface BetaSearchResultLocationCitation {
940
+ cited_text : string ;
941
+
942
+ end_block_index : number ;
943
+
944
+ search_result_index : number ;
945
+
946
+ source : string ;
947
+
948
+ start_block_index : number ;
949
+
950
+ title : string | null ;
951
+
952
+ type : 'search_result_location' ;
953
+ }
954
+
955
+ export interface BetaSearchResultLocationCitationParam {
956
+ cited_text : string ;
957
+
958
+ end_block_index : number ;
959
+
960
+ search_result_index : number ;
961
+
962
+ source : string ;
963
+
964
+ start_block_index : number ;
965
+
966
+ title : string | null ;
967
+
968
+ type : 'search_result_location' ;
969
+ }
970
+
916
971
export interface BetaServerToolUsage {
917
972
/**
918
973
* The number of web search tool requests.
@@ -991,13 +1046,15 @@ export type BetaTextCitation =
991
1046
| BetaCitationCharLocation
992
1047
| BetaCitationPageLocation
993
1048
| BetaCitationContentBlockLocation
994
- | BetaCitationsWebSearchResultLocation ;
1049
+ | BetaCitationsWebSearchResultLocation
1050
+ | BetaSearchResultLocationCitation ;
995
1051
996
1052
export type BetaTextCitationParam =
997
1053
| BetaCitationCharLocationParam
998
1054
| BetaCitationPageLocationParam
999
1055
| BetaCitationContentBlockLocationParam
1000
- | BetaCitationWebSearchResultLocationParam ;
1056
+ | BetaCitationWebSearchResultLocationParam
1057
+ | BetaSearchResultLocationCitationParam ;
1001
1058
1002
1059
export interface BetaTextDelta {
1003
1060
text : string ;
@@ -1280,7 +1337,7 @@ export interface BetaToolResultBlockParam {
1280
1337
*/
1281
1338
cache_control ?: BetaCacheControlEphemeral | null ;
1282
1339
1283
- content ?: string | Array < BetaTextBlockParam | BetaImageBlockParam > ;
1340
+ content ?: string | Array < BetaTextBlockParam | BetaImageBlockParam | BetaSearchResultBlockParam > ;
1284
1341
1285
1342
is_error ?: boolean ;
1286
1343
}
@@ -1335,15 +1392,15 @@ export interface BetaToolTextEditor20250429 {
1335
1392
1336
1393
export type BetaToolUnion =
1337
1394
| BetaTool
1338
- | BetaToolComputerUse20241022
1339
1395
| BetaToolBash20241022
1340
- | BetaToolTextEditor20241022
1341
- | BetaToolComputerUse20250124
1342
1396
| BetaToolBash20250124
1397
+ | BetaCodeExecutionTool20250522
1398
+ | BetaToolComputerUse20241022
1399
+ | BetaToolComputerUse20250124
1400
+ | BetaToolTextEditor20241022
1343
1401
| BetaToolTextEditor20250124
1344
1402
| BetaToolTextEditor20250429
1345
- | BetaWebSearchTool20250305
1346
- | BetaCodeExecutionTool20250522 ;
1403
+ | BetaWebSearchTool20250305 ;
1347
1404
1348
1405
export interface BetaToolUseBlock {
1349
1406
id : string ;
@@ -1669,7 +1726,7 @@ export interface MessageCreateParamsBase {
1669
1726
* the top-level `system` parameter — there is no `"system"` role for input
1670
1727
* messages in the Messages API.
1671
1728
*
1672
- * There is a limit of 100000 messages in a single request.
1729
+ * There is a limit of 100,000 messages in a single request.
1673
1730
*/
1674
1731
messages : Array < BetaMessageParam > ;
1675
1732
@@ -1774,6 +1831,12 @@ export interface MessageCreateParamsBase {
1774
1831
* those tools using the tool input generated by the model and then optionally
1775
1832
* return results back to the model using `tool_result` content blocks.
1776
1833
*
1834
+ * There are two types of tools: **client tools** and **server tools**. The
1835
+ * behavior described below applies to client tools. For
1836
+ * [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
1837
+ * see their individual documentation as each has its own behavior (e.g., the
1838
+ * [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
1839
+ *
1777
1840
* Each tool definition includes:
1778
1841
*
1779
1842
* - `name`: Name of the tool.
@@ -1985,7 +2048,7 @@ export interface MessageCountTokensParams {
1985
2048
* the top-level `system` parameter — there is no `"system"` role for input
1986
2049
* messages in the Messages API.
1987
2050
*
1988
- * There is a limit of 100000 messages in a single request.
2051
+ * There is a limit of 100,000 messages in a single request.
1989
2052
*/
1990
2053
messages : Array < BetaMessageParam > ;
1991
2054
@@ -2037,6 +2100,12 @@ export interface MessageCountTokensParams {
2037
2100
* those tools using the tool input generated by the model and then optionally
2038
2101
* return results back to the model using `tool_result` content blocks.
2039
2102
*
2103
+ * There are two types of tools: **client tools** and **server tools**. The
2104
+ * behavior described below applies to client tools. For
2105
+ * [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
2106
+ * see their individual documentation as each has its own behavior (e.g., the
2107
+ * [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
2108
+ *
2040
2109
* Each tool definition includes:
2041
2110
*
2042
2111
* - `name`: Name of the tool.
@@ -2102,15 +2171,15 @@ export interface MessageCountTokensParams {
2102
2171
*/
2103
2172
tools ?: Array <
2104
2173
| BetaTool
2105
- | BetaToolComputerUse20241022
2106
2174
| BetaToolBash20241022
2107
- | BetaToolTextEditor20241022
2108
- | BetaToolComputerUse20250124
2109
2175
| BetaToolBash20250124
2176
+ | BetaCodeExecutionTool20250522
2177
+ | BetaToolComputerUse20241022
2178
+ | BetaToolComputerUse20250124
2179
+ | BetaToolTextEditor20241022
2110
2180
| BetaToolTextEditor20250124
2111
2181
| BetaToolTextEditor20250429
2112
2182
| BetaWebSearchTool20250305
2113
- | BetaCodeExecutionTool20250522
2114
2183
> ;
2115
2184
2116
2185
/**
@@ -2183,6 +2252,9 @@ export declare namespace Messages {
2183
2252
type BetaRequestMCPServerToolConfiguration as BetaRequestMCPServerToolConfiguration ,
2184
2253
type BetaRequestMCPServerURLDefinition as BetaRequestMCPServerURLDefinition ,
2185
2254
type BetaRequestMCPToolResultBlockParam as BetaRequestMCPToolResultBlockParam ,
2255
+ type BetaSearchResultBlockParam as BetaSearchResultBlockParam ,
2256
+ type BetaSearchResultLocationCitation as BetaSearchResultLocationCitation ,
2257
+ type BetaSearchResultLocationCitationParam as BetaSearchResultLocationCitationParam ,
2186
2258
type BetaServerToolUsage as BetaServerToolUsage ,
2187
2259
type BetaServerToolUseBlock as BetaServerToolUseBlock ,
2188
2260
type BetaServerToolUseBlockParam as BetaServerToolUseBlockParam ,
0 commit comments