@anthropic-ai/sdk 0.105.0 → 0.107.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +16 -1
  3. package/client.d.mts +2 -2
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +2 -2
  6. package/client.d.ts.map +1 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs.map +1 -1
  9. package/core/streaming.d.mts.map +1 -1
  10. package/core/streaming.d.ts.map +1 -1
  11. package/core/streaming.js +2 -1
  12. package/core/streaming.js.map +1 -1
  13. package/core/streaming.mjs +2 -1
  14. package/core/streaming.mjs.map +1 -1
  15. package/helpers/beta/mcp.d.mts +1 -1
  16. package/helpers/beta/mcp.d.mts.map +1 -1
  17. package/helpers/beta/mcp.d.ts +1 -1
  18. package/helpers/beta/mcp.d.ts.map +1 -1
  19. package/helpers/beta/mcp.js +1 -1
  20. package/helpers/beta/mcp.js.map +1 -1
  21. package/helpers/beta/mcp.mjs +1 -1
  22. package/helpers/beta/mcp.mjs.map +1 -1
  23. package/internal/headers.d.mts +7 -0
  24. package/internal/headers.d.mts.map +1 -1
  25. package/internal/headers.d.ts +7 -0
  26. package/internal/headers.d.ts.map +1 -1
  27. package/internal/headers.js +45 -4
  28. package/internal/headers.js.map +1 -1
  29. package/internal/headers.mjs +43 -3
  30. package/internal/headers.mjs.map +1 -1
  31. package/internal/stainless-helper-header.d.mts +60 -0
  32. package/internal/stainless-helper-header.d.mts.map +1 -0
  33. package/internal/stainless-helper-header.d.ts +60 -0
  34. package/internal/stainless-helper-header.d.ts.map +1 -0
  35. package/{lib → internal}/stainless-helper-header.js +27 -6
  36. package/internal/stainless-helper-header.js.map +1 -0
  37. package/{lib → internal}/stainless-helper-header.mjs +25 -5
  38. package/internal/stainless-helper-header.mjs.map +1 -0
  39. package/lib/BetaMessageStream.d.mts.map +1 -1
  40. package/lib/BetaMessageStream.d.ts.map +1 -1
  41. package/lib/BetaMessageStream.js +2 -1
  42. package/lib/BetaMessageStream.js.map +1 -1
  43. package/lib/BetaMessageStream.mjs +2 -1
  44. package/lib/BetaMessageStream.mjs.map +1 -1
  45. package/lib/MessageStream.d.mts.map +1 -1
  46. package/lib/MessageStream.d.ts.map +1 -1
  47. package/lib/MessageStream.js +2 -1
  48. package/lib/MessageStream.js.map +1 -1
  49. package/lib/MessageStream.mjs +2 -1
  50. package/lib/MessageStream.mjs.map +1 -1
  51. package/lib/helper-client.d.mts +2 -20
  52. package/lib/helper-client.d.mts.map +1 -1
  53. package/lib/helper-client.d.ts +2 -20
  54. package/lib/helper-client.d.ts.map +1 -1
  55. package/lib/helper-client.js +2 -1
  56. package/lib/helper-client.js.map +1 -1
  57. package/lib/helper-client.mjs +2 -1
  58. package/lib/helper-client.mjs.map +1 -1
  59. package/lib/middleware.d.mts.map +1 -1
  60. package/lib/middleware.d.ts.map +1 -1
  61. package/lib/middleware.js +7 -5
  62. package/lib/middleware.js.map +1 -1
  63. package/lib/middleware.mjs +7 -5
  64. package/lib/middleware.mjs.map +1 -1
  65. package/lib/tools/BetaToolRunner.d.mts.map +1 -1
  66. package/lib/tools/BetaToolRunner.d.ts.map +1 -1
  67. package/lib/tools/BetaToolRunner.js +11 -5
  68. package/lib/tools/BetaToolRunner.js.map +1 -1
  69. package/lib/tools/BetaToolRunner.mjs +11 -5
  70. package/lib/tools/BetaToolRunner.mjs.map +1 -1
  71. package/lib/tools/SessionToolRunner.d.mts.map +1 -1
  72. package/lib/tools/SessionToolRunner.d.ts.map +1 -1
  73. package/lib/tools/SessionToolRunner.js +2 -3
  74. package/lib/tools/SessionToolRunner.js.map +1 -1
  75. package/lib/tools/SessionToolRunner.mjs +2 -3
  76. package/lib/tools/SessionToolRunner.mjs.map +1 -1
  77. package/package.json +1 -1
  78. package/resources/beta/agents/agents.d.mts +7 -2
  79. package/resources/beta/agents/agents.d.mts.map +1 -1
  80. package/resources/beta/agents/agents.d.ts +7 -2
  81. package/resources/beta/agents/agents.d.ts.map +1 -1
  82. package/resources/beta/agents/agents.js.map +1 -1
  83. package/resources/beta/agents/agents.mjs.map +1 -1
  84. package/resources/beta/beta.d.mts +2 -2
  85. package/resources/beta/beta.d.mts.map +1 -1
  86. package/resources/beta/beta.d.ts +2 -2
  87. package/resources/beta/beta.d.ts.map +1 -1
  88. package/resources/beta/beta.js.map +1 -1
  89. package/resources/beta/beta.mjs.map +1 -1
  90. package/resources/beta/deployments.d.mts +18 -6
  91. package/resources/beta/deployments.d.mts.map +1 -1
  92. package/resources/beta/deployments.d.ts +18 -6
  93. package/resources/beta/deployments.d.ts.map +1 -1
  94. package/resources/beta/deployments.js +18 -6
  95. package/resources/beta/deployments.js.map +1 -1
  96. package/resources/beta/deployments.mjs +18 -6
  97. package/resources/beta/deployments.mjs.map +1 -1
  98. package/resources/beta/files.js +1 -1
  99. package/resources/beta/files.js.map +1 -1
  100. package/resources/beta/files.mjs +1 -1
  101. package/resources/beta/files.mjs.map +1 -1
  102. package/resources/beta/index.d.mts +1 -1
  103. package/resources/beta/index.d.mts.map +1 -1
  104. package/resources/beta/index.d.ts +1 -1
  105. package/resources/beta/index.d.ts.map +1 -1
  106. package/resources/beta/index.js.map +1 -1
  107. package/resources/beta/index.mjs.map +1 -1
  108. package/resources/beta/messages/batches.d.mts +37 -26
  109. package/resources/beta/messages/batches.d.mts.map +1 -1
  110. package/resources/beta/messages/batches.d.ts +37 -26
  111. package/resources/beta/messages/batches.d.ts.map +1 -1
  112. package/resources/beta/messages/batches.js +11 -8
  113. package/resources/beta/messages/batches.js.map +1 -1
  114. package/resources/beta/messages/batches.mjs +11 -8
  115. package/resources/beta/messages/batches.mjs.map +1 -1
  116. package/resources/beta/messages/index.d.mts +1 -1
  117. package/resources/beta/messages/index.d.mts.map +1 -1
  118. package/resources/beta/messages/index.d.ts +1 -1
  119. package/resources/beta/messages/index.d.ts.map +1 -1
  120. package/resources/beta/messages/index.js.map +1 -1
  121. package/resources/beta/messages/index.mjs.map +1 -1
  122. package/resources/beta/messages/messages.d.mts +170 -39
  123. package/resources/beta/messages/messages.d.mts.map +1 -1
  124. package/resources/beta/messages/messages.d.ts +170 -39
  125. package/resources/beta/messages/messages.d.ts.map +1 -1
  126. package/resources/beta/messages/messages.js +12 -6
  127. package/resources/beta/messages/messages.js.map +1 -1
  128. package/resources/beta/messages/messages.mjs +12 -6
  129. package/resources/beta/messages/messages.mjs.map +1 -1
  130. package/resources/completions.d.mts +12 -7
  131. package/resources/completions.d.mts.map +1 -1
  132. package/resources/completions.d.ts +12 -7
  133. package/resources/completions.d.ts.map +1 -1
  134. package/resources/index.d.mts +1 -1
  135. package/resources/index.d.mts.map +1 -1
  136. package/resources/index.d.ts +1 -1
  137. package/resources/index.d.ts.map +1 -1
  138. package/resources/index.js.map +1 -1
  139. package/resources/index.mjs.map +1 -1
  140. package/resources/messages/batches.d.mts +19 -10
  141. package/resources/messages/batches.d.mts.map +1 -1
  142. package/resources/messages/batches.d.ts +19 -10
  143. package/resources/messages/batches.d.ts.map +1 -1
  144. package/resources/messages/batches.js +16 -8
  145. package/resources/messages/batches.js.map +1 -1
  146. package/resources/messages/batches.mjs +16 -8
  147. package/resources/messages/batches.mjs.map +1 -1
  148. package/resources/messages/index.d.mts +1 -1
  149. package/resources/messages/index.d.mts.map +1 -1
  150. package/resources/messages/index.d.ts +1 -1
  151. package/resources/messages/index.d.ts.map +1 -1
  152. package/resources/messages/index.js.map +1 -1
  153. package/resources/messages/index.mjs.map +1 -1
  154. package/resources/messages/messages.d.mts +209 -68
  155. package/resources/messages/messages.d.mts.map +1 -1
  156. package/resources/messages/messages.d.ts +209 -68
  157. package/resources/messages/messages.d.ts.map +1 -1
  158. package/resources/messages/messages.js +20 -7
  159. package/resources/messages/messages.js.map +1 -1
  160. package/resources/messages/messages.mjs +20 -7
  161. package/resources/messages/messages.mjs.map +1 -1
  162. package/src/client.ts +4 -0
  163. package/src/core/streaming.ts +2 -1
  164. package/src/helpers/beta/mcp.ts +1 -1
  165. package/src/internal/headers.ts +47 -4
  166. package/src/internal/stainless-helper-header.ts +122 -0
  167. package/src/lib/BetaMessageStream.ts +2 -1
  168. package/src/lib/MessageStream.ts +2 -1
  169. package/src/lib/helper-client.ts +6 -9
  170. package/src/lib/middleware.ts +10 -4
  171. package/src/lib/tools/BetaToolRunner.ts +15 -6
  172. package/src/lib/tools/SessionToolRunner.ts +2 -4
  173. package/src/resources/beta/agents/agents.ts +7 -2
  174. package/src/resources/beta/beta.ts +4 -0
  175. package/src/resources/beta/deployments.ts +18 -6
  176. package/src/resources/beta/files.ts +1 -1
  177. package/src/resources/beta/index.ts +2 -0
  178. package/src/resources/beta/messages/batches.ts +43 -29
  179. package/src/resources/beta/messages/index.ts +2 -0
  180. package/src/resources/beta/messages/messages.ts +213 -41
  181. package/src/resources/completions.ts +12 -7
  182. package/src/resources/index.ts +2 -0
  183. package/src/resources/messages/batches.ts +29 -11
  184. package/src/resources/messages/index.ts +2 -0
  185. package/src/resources/messages/messages.ts +260 -71
  186. package/src/tools/agent-toolset/fs-util.ts +7 -1
  187. package/src/tools/agent-toolset/node.ts +19 -3
  188. package/src/version.ts +1 -1
  189. package/tools/agent-toolset/fs-util.d.mts.map +1 -1
  190. package/tools/agent-toolset/fs-util.d.ts.map +1 -1
  191. package/tools/agent-toolset/fs-util.js +7 -1
  192. package/tools/agent-toolset/fs-util.js.map +1 -1
  193. package/tools/agent-toolset/fs-util.mjs +7 -1
  194. package/tools/agent-toolset/fs-util.mjs.map +1 -1
  195. package/tools/agent-toolset/node.d.mts.map +1 -1
  196. package/tools/agent-toolset/node.d.ts.map +1 -1
  197. package/tools/agent-toolset/node.js +21 -4
  198. package/tools/agent-toolset/node.js.map +1 -1
  199. package/tools/agent-toolset/node.mjs +21 -4
  200. package/tools/agent-toolset/node.mjs.map +1 -1
  201. package/version.d.mts +1 -1
  202. package/version.d.ts +1 -1
  203. package/version.js +1 -1
  204. package/version.mjs +1 -1
  205. package/lib/stainless-helper-header.d.mts +0 -34
  206. package/lib/stainless-helper-header.d.mts.map +0 -1
  207. package/lib/stainless-helper-header.d.ts +0 -34
  208. package/lib/stainless-helper-header.d.ts.map +0 -1
  209. package/lib/stainless-helper-header.js.map +0 -1
  210. package/lib/stainless-helper-header.mjs.map +0 -1
  211. package/src/lib/stainless-helper-header.ts +0 -80
@@ -164,6 +164,7 @@ export {
164
164
  type WebFetchTool20250910,
165
165
  type WebFetchTool20260209,
166
166
  type WebFetchTool20260309,
167
+ type WebFetchTool20260318,
167
168
  type WebFetchToolResultBlock,
168
169
  type WebFetchToolResultBlockParam,
169
170
  type WebFetchToolResultErrorBlock,
@@ -173,6 +174,7 @@ export {
173
174
  type WebSearchResultBlockParam,
174
175
  type WebSearchTool20250305,
175
176
  type WebSearchTool20260209,
177
+ type WebSearchTool20260318,
176
178
  type WebSearchToolRequestError,
177
179
  type WebSearchToolResultBlock,
178
180
  type WebSearchToolResultBlockContent,
@@ -5,7 +5,7 @@ import { APIResource } from '../../core/resource';
5
5
  import { Stream } from '../../core/streaming';
6
6
  import { buildHeaders } from '../../internal/headers';
7
7
  import { RequestOptions } from '../../internal/request-options';
8
- import { stainlessHelperHeader } from '../../lib/stainless-helper-header';
8
+ import { stainlessHelperHeader } from '../../internal/stainless-helper-header';
9
9
  import { MessageStream } from '../../lib/MessageStream';
10
10
  import {
11
11
  parseMessage,
@@ -44,7 +44,7 @@ export class Messages extends APIResource {
44
44
  * conversations.
45
45
  *
46
46
  * Learn more about the Messages API in our
47
- * [user guide](https://docs.claude.com/en/docs/initial-setup)
47
+ * [user guide](https://platform.claude.com/docs/en/get-started)
48
48
  *
49
49
  * @example
50
50
  * ```ts
@@ -55,19 +55,20 @@ export class Messages extends APIResource {
55
55
  * });
56
56
  * ```
57
57
  */
58
- create(body: MessageCreateParamsNonStreaming, options?: RequestOptions): APIPromise<Message>;
58
+ create(params: MessageCreateParamsNonStreaming, options?: RequestOptions): APIPromise<Message>;
59
59
  create(
60
- body: MessageCreateParamsStreaming,
60
+ params: MessageCreateParamsStreaming,
61
61
  options?: RequestOptions,
62
62
  ): APIPromise<Stream<RawMessageStreamEvent>>;
63
63
  create(
64
- body: MessageCreateParamsBase,
64
+ params: MessageCreateParamsBase,
65
65
  options?: RequestOptions,
66
66
  ): APIPromise<Stream<RawMessageStreamEvent> | Message>;
67
67
  create(
68
- body: MessageCreateParams,
68
+ params: MessageCreateParams,
69
69
  options?: RequestOptions,
70
70
  ): APIPromise<Message> | APIPromise<Stream<RawMessageStreamEvent>> {
71
+ const { user_profile_id, ...body } = params;
71
72
  if (body.model in DEPRECATED_MODELS) {
72
73
  console.warn(
73
74
  `The model '${body.model}' is deprecated and will reach end-of-life on ${
@@ -93,13 +94,16 @@ export class Messages extends APIResource {
93
94
 
94
95
  // Collect helper info from tools and messages
95
96
  const helperHeader = stainlessHelperHeader(body.tools, body.messages);
96
-
97
97
  return this._client.post('/v1/messages', {
98
98
  body,
99
99
  timeout: timeout ?? 600000,
100
100
  ...options,
101
- headers: buildHeaders([helperHeader, options?.headers]),
102
- stream: body.stream ?? false,
101
+ headers: buildHeaders([
102
+ { ...(user_profile_id != null ? { 'anthropic-user-profile-id': user_profile_id } : undefined) },
103
+ helperHeader,
104
+ options?.headers,
105
+ ]),
106
+ stream: params.stream ?? false,
103
107
  }) as APIPromise<Message> | APIPromise<Stream<RawMessageStreamEvent>>;
104
108
  }
105
109
 
@@ -170,7 +174,7 @@ export class Messages extends APIResource {
170
174
  * including tools, images, and documents, without creating it.
171
175
  *
172
176
  * Learn more about token counting in our
173
- * [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting)
177
+ * [user guide](https://platform.claude.com/docs/en/build-with-claude/token-counting)
174
178
  *
175
179
  * @example
176
180
  * ```ts
@@ -181,8 +185,16 @@ export class Messages extends APIResource {
181
185
  * });
182
186
  * ```
183
187
  */
184
- countTokens(body: MessageCountTokensParams, options?: RequestOptions): APIPromise<MessageTokensCount> {
185
- return this._client.post('/v1/messages/count_tokens', { body, ...options });
188
+ countTokens(params: MessageCountTokensParams, options?: RequestOptions): APIPromise<MessageTokensCount> {
189
+ const { user_profile_id, ...body } = params;
190
+ return this._client.post('/v1/messages/count_tokens', {
191
+ body,
192
+ ...options,
193
+ headers: buildHeaders([
194
+ { ...(user_profile_id != null ? { 'anthropic-user-profile-id': user_profile_id } : undefined) },
195
+ options?.headers,
196
+ ]),
197
+ });
186
198
  }
187
199
  }
188
200
 
@@ -289,7 +301,9 @@ export interface CacheControlEphemeral {
289
301
  * - `5m`: 5 minutes
290
302
  * - `1h`: 1 hour
291
303
  *
292
- * Defaults to `5m`.
304
+ * Defaults to `5m`. See
305
+ * [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching)
306
+ * for details.
293
307
  */
294
308
  ttl?: '5m' | '1h';
295
309
  }
@@ -1147,6 +1161,8 @@ export type MessageCountTokensTool =
1147
1161
  | WebSearchTool20260209
1148
1162
  | WebFetchTool20260209
1149
1163
  | WebFetchTool20260309
1164
+ | WebSearchTool20260318
1165
+ | WebFetchTool20260318
1150
1166
  | ToolSearchToolBm25_20251119
1151
1167
  | ToolSearchToolRegex20251119;
1152
1168
 
@@ -1443,7 +1459,7 @@ export interface RefusalStopDetails {
1443
1459
  /**
1444
1460
  * The policy category that triggered a refusal.
1445
1461
  */
1446
- category: 'cyber' | 'bio' | 'frontier_llm' | 'reasoning_extraction' | null;
1462
+ category: 'cyber' | 'bio' | 'frontier_llm' | 'reasoning_extraction' | 'military_weapons' | null;
1447
1463
 
1448
1464
  /**
1449
1465
  * Human-readable explanation of the refusal.
@@ -1766,7 +1782,7 @@ export interface ThinkingConfigEnabled {
1766
1782
  * Must be ≥1024 and less than `max_tokens`.
1767
1783
  *
1768
1784
  * See
1769
- * [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
1785
+ * [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
1770
1786
  * for details.
1771
1787
  */
1772
1788
  budget_tokens: number;
@@ -1790,7 +1806,7 @@ export interface ThinkingConfigEnabled {
1790
1806
  * tokens and counts towards your `max_tokens` limit.
1791
1807
  *
1792
1808
  * See
1793
- * [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
1809
+ * [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
1794
1810
  * for details.
1795
1811
  */
1796
1812
  export type ThinkingConfigParam = ThinkingConfigEnabled | ThinkingConfigDisabled | ThinkingConfigAdaptive;
@@ -2260,6 +2276,8 @@ export type ToolUnion =
2260
2276
  | WebSearchTool20260209
2261
2277
  | WebFetchTool20260209
2262
2278
  | WebFetchTool20260309
2279
+ | WebSearchTool20260318
2280
+ | WebFetchTool20260318
2263
2281
  | ToolSearchToolBm25_20251119
2264
2282
  | ToolSearchToolRegex20251119;
2265
2283
 
@@ -2604,6 +2622,81 @@ export interface WebFetchTool20260309 {
2604
2622
  use_cache?: boolean;
2605
2623
  }
2606
2624
 
2625
+ export interface WebFetchTool20260318 {
2626
+ /**
2627
+ * Name of the tool.
2628
+ *
2629
+ * This is how the tool will be called by the model and in `tool_use` blocks.
2630
+ */
2631
+ name: 'web_fetch';
2632
+
2633
+ type: 'web_fetch_20260318';
2634
+
2635
+ allowed_callers?: Array<
2636
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2637
+ >;
2638
+
2639
+ /**
2640
+ * List of domains to allow fetching from
2641
+ */
2642
+ allowed_domains?: Array<string> | null;
2643
+
2644
+ /**
2645
+ * List of domains to block fetching from
2646
+ */
2647
+ blocked_domains?: Array<string> | null;
2648
+
2649
+ /**
2650
+ * Create a cache control breakpoint at this content block.
2651
+ */
2652
+ cache_control?: CacheControlEphemeral | null;
2653
+
2654
+ /**
2655
+ * Citations configuration for fetched documents. Citations are disabled by
2656
+ * default.
2657
+ */
2658
+ citations?: CitationsConfigParam | null;
2659
+
2660
+ /**
2661
+ * If true, tool will not be included in initial system prompt. Only loaded when
2662
+ * returned via tool_reference from tool search.
2663
+ */
2664
+ defer_loading?: boolean;
2665
+
2666
+ /**
2667
+ * Maximum number of tokens used by including web page text content in the context.
2668
+ * The limit is approximate and does not apply to binary content such as PDFs.
2669
+ */
2670
+ max_content_tokens?: number | null;
2671
+
2672
+ /**
2673
+ * Maximum number of times the tool can be used in the API request.
2674
+ */
2675
+ max_uses?: number | null;
2676
+
2677
+ /**
2678
+ * How this tool's result blocks appear in the API response when the result was
2679
+ * consumed by a completed code_execution call in the same turn. 'full' returns the
2680
+ * complete content (default). 'excluded' drops the nested server_tool_use and
2681
+ * result block pair entirely. Results from direct calls, or from code_execution
2682
+ * calls that paused before completing, are always returned in full so they can be
2683
+ * sent back on the next turn.
2684
+ */
2685
+ response_inclusion?: 'full' | 'excluded';
2686
+
2687
+ /**
2688
+ * When true, guarantees schema validation on tool names and inputs
2689
+ */
2690
+ strict?: boolean;
2691
+
2692
+ /**
2693
+ * Whether to use cached content. Set to false to bypass the cache and fetch fresh
2694
+ * content. Only set to false when the user explicitly requests fresh content or
2695
+ * when fetching rapidly-changing sources.
2696
+ */
2697
+ use_cache?: boolean;
2698
+ }
2699
+
2607
2700
  export interface WebFetchToolResultBlock {
2608
2701
  /**
2609
2702
  * Tool invocation directly from the model.
@@ -2808,6 +2901,70 @@ export namespace WebSearchTool20260209 {
2808
2901
  export type UserLocation = Messages.UserLocation;
2809
2902
  }
2810
2903
 
2904
+ export interface WebSearchTool20260318 {
2905
+ /**
2906
+ * Name of the tool.
2907
+ *
2908
+ * This is how the tool will be called by the model and in `tool_use` blocks.
2909
+ */
2910
+ name: 'web_search';
2911
+
2912
+ type: 'web_search_20260318';
2913
+
2914
+ allowed_callers?: Array<
2915
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
2916
+ >;
2917
+
2918
+ /**
2919
+ * If provided, only these domains will be included in results. Cannot be used
2920
+ * alongside `blocked_domains`.
2921
+ */
2922
+ allowed_domains?: Array<string> | null;
2923
+
2924
+ /**
2925
+ * If provided, these domains will never appear in results. Cannot be used
2926
+ * alongside `allowed_domains`.
2927
+ */
2928
+ blocked_domains?: Array<string> | null;
2929
+
2930
+ /**
2931
+ * Create a cache control breakpoint at this content block.
2932
+ */
2933
+ cache_control?: CacheControlEphemeral | null;
2934
+
2935
+ /**
2936
+ * If true, tool will not be included in initial system prompt. Only loaded when
2937
+ * returned via tool_reference from tool search.
2938
+ */
2939
+ defer_loading?: boolean;
2940
+
2941
+ /**
2942
+ * Maximum number of times the tool can be used in the API request.
2943
+ */
2944
+ max_uses?: number | null;
2945
+
2946
+ /**
2947
+ * How this tool's result blocks appear in the API response when the result was
2948
+ * consumed by a completed code_execution call in the same turn. 'full' returns the
2949
+ * complete content (default). 'excluded' drops the nested server_tool_use and
2950
+ * result block pair entirely. Results from direct calls, or from code_execution
2951
+ * calls that paused before completing, are always returned in full so they can be
2952
+ * sent back on the next turn.
2953
+ */
2954
+ response_inclusion?: 'full' | 'excluded';
2955
+
2956
+ /**
2957
+ * When true, guarantees schema validation on tool names and inputs
2958
+ */
2959
+ strict?: boolean;
2960
+
2961
+ /**
2962
+ * Parameters for the user's location. Used to provide more relevant search
2963
+ * results.
2964
+ */
2965
+ user_location?: UserLocation | null;
2966
+ }
2967
+
2811
2968
  export interface WebSearchToolRequestError {
2812
2969
  error_code: WebSearchToolResultErrorCode;
2813
2970
 
@@ -2883,22 +3040,23 @@ export type MessageCreateParams = MessageCreateParamsNonStreaming | MessageCreat
2883
3040
 
2884
3041
  export interface MessageCreateParamsBase {
2885
3042
  /**
2886
- * The maximum number of tokens to generate before stopping.
3043
+ * Body param: The maximum number of tokens to generate before stopping.
2887
3044
  *
2888
3045
  * Note that our models may stop _before_ reaching this maximum. This parameter
2889
3046
  * only specifies the absolute maximum number of tokens to generate.
2890
3047
  *
2891
3048
  * Set to `0` to populate the
2892
- * [prompt cache](https://docs.claude.com/en/docs/build-with-claude/prompt-caching#pre-warming-the-cache)
3049
+ * [prompt cache](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pre-warming-the-cache)
2893
3050
  * without generating a response.
2894
3051
  *
2895
3052
  * Different models have different maximum values for this parameter. See
2896
- * [models](https://docs.claude.com/en/docs/models-overview) for details.
3053
+ * [models](https://platform.claude.com/docs/en/about-claude/models/overview) for
3054
+ * details.
2897
3055
  */
2898
3056
  max_tokens: number;
2899
3057
 
2900
3058
  /**
2901
- * Input messages.
3059
+ * Body param: Input messages.
2902
3060
  *
2903
3061
  * Our models are trained to operate on alternating `user` and `assistant`
2904
3062
  * conversational turns. When creating a new `Message`, you specify the prior
@@ -2955,19 +3113,20 @@ export interface MessageCreateParamsBase {
2955
3113
  * { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
2956
3114
  * ```
2957
3115
  *
2958
- * See [input examples](https://docs.claude.com/en/api/messages-examples).
3116
+ * See
3117
+ * [input examples](https://platform.claude.com/docs/en/build-with-claude/working-with-messages).
2959
3118
  *
2960
3119
  * Note that if you want to include a
2961
- * [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the
2962
- * top-level `system` parameter — there is no `"system"` role for input messages in
2963
- * the Messages API.
3120
+ * [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role),
3121
+ * you can use the top-level `system` parameter — there is no `"system"` role for
3122
+ * input messages in the Messages API.
2964
3123
  *
2965
3124
  * There is a limit of 100,000 messages in a single request.
2966
3125
  */
2967
3126
  messages: Array<MessageParam>;
2968
3127
 
2969
3128
  /**
2970
- * The model that will complete your prompt.
3129
+ * Body param: The model that will complete your prompt.
2971
3130
  *
2972
3131
  * See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
2973
3132
  * details and options.
@@ -2975,43 +3134,45 @@ export interface MessageCreateParamsBase {
2975
3134
  model: Model;
2976
3135
 
2977
3136
  /**
2978
- * Top-level cache control automatically applies a cache_control marker to the last
2979
- * cacheable block in the request.
3137
+ * Body param: Top-level cache control automatically applies a cache_control marker
3138
+ * to the last cacheable block in the request.
2980
3139
  */
2981
3140
  cache_control?: CacheControlEphemeral | null;
2982
3141
 
2983
3142
  /**
2984
- * Container identifier for reuse across requests.
3143
+ * Body param: Container identifier for reuse across requests.
2985
3144
  */
2986
3145
  container?: string | null;
2987
3146
 
2988
3147
  /**
2989
- * Specifies the geographic region for inference processing. If not specified, the
2990
- * workspace's `default_inference_geo` is used.
3148
+ * Body param: Specifies the geographic region for inference processing. If not
3149
+ * specified, the workspace's `default_inference_geo` is used.
2991
3150
  */
2992
3151
  inference_geo?: string | null;
2993
3152
 
2994
3153
  /**
2995
- * An object describing metadata about the request.
3154
+ * Body param: An object describing metadata about the request.
2996
3155
  */
2997
3156
  metadata?: Metadata;
2998
3157
 
2999
3158
  /**
3000
- * Configuration options for the model's output, such as the output format.
3159
+ * Body param: Configuration options for the model's output, such as the output
3160
+ * format.
3001
3161
  */
3002
3162
  output_config?: OutputConfig;
3003
3163
 
3004
3164
  /**
3005
- * Determines whether to use priority capacity (if available) or standard capacity
3006
- * for this request.
3165
+ * Body param: Determines whether to use priority capacity (if available) or
3166
+ * standard capacity for this request.
3007
3167
  *
3008
3168
  * Anthropic offers different levels of service for your API requests. See
3009
- * [service-tiers](https://docs.claude.com/en/api/service-tiers) for details.
3169
+ * [service-tiers](https://platform.claude.com/docs/en/api/service-tiers) for
3170
+ * details.
3010
3171
  */
3011
3172
  service_tier?: 'auto' | 'standard_only';
3012
3173
 
3013
3174
  /**
3014
- * Custom text sequences that will cause the model to stop generating.
3175
+ * Body param: Custom text sequences that will cause the model to stop generating.
3015
3176
  *
3016
3177
  * Our models will normally stop when they have naturally completed their turn,
3017
3178
  * which will result in a response `stop_reason` of `"end_turn"`.
@@ -3024,18 +3185,20 @@ export interface MessageCreateParamsBase {
3024
3185
  stop_sequences?: Array<string>;
3025
3186
 
3026
3187
  /**
3027
- * Whether to incrementally stream the response using server-sent events.
3188
+ * Body param: Whether to incrementally stream the response using server-sent
3189
+ * events.
3028
3190
  *
3029
- * See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
3191
+ * See [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming)
3192
+ * for details.
3030
3193
  */
3031
3194
  stream?: boolean;
3032
3195
 
3033
3196
  /**
3034
- * System prompt.
3197
+ * Body param: System prompt.
3035
3198
  *
3036
3199
  * A system prompt is a way of providing context and instructions to Claude, such
3037
3200
  * as specifying a particular goal or role. See our
3038
- * [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).
3201
+ * [guide to system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role).
3039
3202
  */
3040
3203
  system?: string | Array<TextBlockParam>;
3041
3204
 
@@ -3047,26 +3210,26 @@ export interface MessageCreateParamsBase {
3047
3210
  temperature?: number;
3048
3211
 
3049
3212
  /**
3050
- * Configuration for enabling Claude's extended thinking.
3213
+ * Body param: Configuration for enabling Claude's extended thinking.
3051
3214
  *
3052
3215
  * When enabled, responses include `thinking` content blocks showing Claude's
3053
3216
  * thinking process before the final answer. Requires a minimum budget of 1,024
3054
3217
  * tokens and counts towards your `max_tokens` limit.
3055
3218
  *
3056
3219
  * See
3057
- * [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
3220
+ * [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
3058
3221
  * for details.
3059
3222
  */
3060
3223
  thinking?: ThinkingConfigParam;
3061
3224
 
3062
3225
  /**
3063
- * How the model should use the provided tools. The model can use a specific tool,
3064
- * any available tool, decide by itself, or not use tools at all.
3226
+ * Body param: How the model should use the provided tools. The model can use a
3227
+ * specific tool, any available tool, decide by itself, or not use tools at all.
3065
3228
  */
3066
3229
  tool_choice?: ToolChoice;
3067
3230
 
3068
3231
  /**
3069
- * Definitions of tools that the model may use.
3232
+ * Body param: Definitions of tools that the model may use.
3070
3233
  *
3071
3234
  * If you include `tools` in your API request, the model may return `tool_use`
3072
3235
  * content blocks that represent the model's use of those tools. You can then run
@@ -3075,9 +3238,9 @@ export interface MessageCreateParamsBase {
3075
3238
  *
3076
3239
  * There are two types of tools: **client tools** and **server tools**. The
3077
3240
  * behavior described below applies to client tools. For
3078
- * [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
3241
+ * [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools),
3079
3242
  * see their individual documentation as each has its own behavior (e.g., the
3080
- * [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
3243
+ * [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool)).
3081
3244
  *
3082
3245
  * Each tool definition includes:
3083
3246
  *
@@ -3140,7 +3303,9 @@ export interface MessageCreateParamsBase {
3140
3303
  * functions, or more generally whenever you want the model to produce a particular
3141
3304
  * JSON structure of output.
3142
3305
  *
3143
- * See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.
3306
+ * See our
3307
+ * [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview)
3308
+ * for more details.
3144
3309
  */
3145
3310
  tools?: Array<ToolUnion>;
3146
3311
 
@@ -3156,6 +3321,13 @@ export interface MessageCreateParamsBase {
3156
3321
  * other values will be rejected with a 400 error.
3157
3322
  */
3158
3323
  top_p?: number;
3324
+
3325
+ /**
3326
+ * Header param: The user profile ID to attribute this request to. Use when acting
3327
+ * on behalf of a party other than your organization. Requires the `user-profiles`
3328
+ * beta header.
3329
+ */
3330
+ user_profile_id?: string;
3159
3331
  }
3160
3332
 
3161
3333
  export namespace MessageCreateParams {
@@ -3165,18 +3337,22 @@ export namespace MessageCreateParams {
3165
3337
 
3166
3338
  export interface MessageCreateParamsNonStreaming extends MessageCreateParamsBase {
3167
3339
  /**
3168
- * Whether to incrementally stream the response using server-sent events.
3340
+ * Body param: Whether to incrementally stream the response using server-sent
3341
+ * events.
3169
3342
  *
3170
- * See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
3343
+ * See [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming)
3344
+ * for details.
3171
3345
  */
3172
3346
  stream?: false;
3173
3347
  }
3174
3348
 
3175
3349
  export interface MessageCreateParamsStreaming extends MessageCreateParamsBase {
3176
3350
  /**
3177
- * Whether to incrementally stream the response using server-sent events.
3351
+ * Body param: Whether to incrementally stream the response using server-sent
3352
+ * events.
3178
3353
  *
3179
- * See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
3354
+ * See [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming)
3355
+ * for details.
3180
3356
  */
3181
3357
  stream: true;
3182
3358
  }
@@ -3185,7 +3361,7 @@ export type MessageStreamParams = ParseableMessageCreateParams;
3185
3361
 
3186
3362
  export interface MessageCountTokensParams {
3187
3363
  /**
3188
- * Input messages.
3364
+ * Body param: Input messages.
3189
3365
  *
3190
3366
  * Our models are trained to operate on alternating `user` and `assistant`
3191
3367
  * conversational turns. When creating a new `Message`, you specify the prior
@@ -3242,19 +3418,20 @@ export interface MessageCountTokensParams {
3242
3418
  * { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
3243
3419
  * ```
3244
3420
  *
3245
- * See [input examples](https://docs.claude.com/en/api/messages-examples).
3421
+ * See
3422
+ * [input examples](https://platform.claude.com/docs/en/build-with-claude/working-with-messages).
3246
3423
  *
3247
3424
  * Note that if you want to include a
3248
- * [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the
3249
- * top-level `system` parameter — there is no `"system"` role for input messages in
3250
- * the Messages API.
3425
+ * [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role),
3426
+ * you can use the top-level `system` parameter — there is no `"system"` role for
3427
+ * input messages in the Messages API.
3251
3428
  *
3252
3429
  * There is a limit of 100,000 messages in a single request.
3253
3430
  */
3254
3431
  messages: Array<MessageParam>;
3255
3432
 
3256
3433
  /**
3257
- * The model that will complete your prompt.
3434
+ * Body param: The model that will complete your prompt.
3258
3435
  *
3259
3436
  * See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
3260
3437
  * details and options.
@@ -3262,46 +3439,47 @@ export interface MessageCountTokensParams {
3262
3439
  model: Model;
3263
3440
 
3264
3441
  /**
3265
- * Top-level cache control automatically applies a cache_control marker to the last
3266
- * cacheable block in the request.
3442
+ * Body param: Top-level cache control automatically applies a cache_control marker
3443
+ * to the last cacheable block in the request.
3267
3444
  */
3268
3445
  cache_control?: CacheControlEphemeral | null;
3269
3446
 
3270
3447
  /**
3271
- * Configuration options for the model's output, such as the output format.
3448
+ * Body param: Configuration options for the model's output, such as the output
3449
+ * format.
3272
3450
  */
3273
3451
  output_config?: OutputConfig;
3274
3452
 
3275
3453
  /**
3276
- * System prompt.
3454
+ * Body param: System prompt.
3277
3455
  *
3278
3456
  * A system prompt is a way of providing context and instructions to Claude, such
3279
3457
  * as specifying a particular goal or role. See our
3280
- * [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).
3458
+ * [guide to system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role).
3281
3459
  */
3282
3460
  system?: string | Array<TextBlockParam>;
3283
3461
 
3284
3462
  /**
3285
- * Configuration for enabling Claude's extended thinking.
3463
+ * Body param: Configuration for enabling Claude's extended thinking.
3286
3464
  *
3287
3465
  * When enabled, responses include `thinking` content blocks showing Claude's
3288
3466
  * thinking process before the final answer. Requires a minimum budget of 1,024
3289
3467
  * tokens and counts towards your `max_tokens` limit.
3290
3468
  *
3291
3469
  * See
3292
- * [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
3470
+ * [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
3293
3471
  * for details.
3294
3472
  */
3295
3473
  thinking?: ThinkingConfigParam;
3296
3474
 
3297
3475
  /**
3298
- * How the model should use the provided tools. The model can use a specific tool,
3299
- * any available tool, decide by itself, or not use tools at all.
3476
+ * Body param: How the model should use the provided tools. The model can use a
3477
+ * specific tool, any available tool, decide by itself, or not use tools at all.
3300
3478
  */
3301
3479
  tool_choice?: ToolChoice;
3302
3480
 
3303
3481
  /**
3304
- * Definitions of tools that the model may use.
3482
+ * Body param: Definitions of tools that the model may use.
3305
3483
  *
3306
3484
  * If you include `tools` in your API request, the model may return `tool_use`
3307
3485
  * content blocks that represent the model's use of those tools. You can then run
@@ -3310,9 +3488,9 @@ export interface MessageCountTokensParams {
3310
3488
  *
3311
3489
  * There are two types of tools: **client tools** and **server tools**. The
3312
3490
  * behavior described below applies to client tools. For
3313
- * [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
3491
+ * [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools),
3314
3492
  * see their individual documentation as each has its own behavior (e.g., the
3315
- * [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
3493
+ * [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool)).
3316
3494
  *
3317
3495
  * Each tool definition includes:
3318
3496
  *
@@ -3375,9 +3553,18 @@ export interface MessageCountTokensParams {
3375
3553
  * functions, or more generally whenever you want the model to produce a particular
3376
3554
  * JSON structure of output.
3377
3555
  *
3378
- * See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.
3556
+ * See our
3557
+ * [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview)
3558
+ * for more details.
3379
3559
  */
3380
3560
  tools?: Array<MessageCountTokensTool>;
3561
+
3562
+ /**
3563
+ * Header param: The user profile ID to attribute this request to. Use when acting
3564
+ * on behalf of a party other than your organization. Requires the `user-profiles`
3565
+ * beta header.
3566
+ */
3567
+ user_profile_id?: string;
3381
3568
  }
3382
3569
 
3383
3570
  Messages.Batches = Batches;
@@ -3531,6 +3718,7 @@ export declare namespace Messages {
3531
3718
  type WebFetchTool20250910 as WebFetchTool20250910,
3532
3719
  type WebFetchTool20260209 as WebFetchTool20260209,
3533
3720
  type WebFetchTool20260309 as WebFetchTool20260309,
3721
+ type WebFetchTool20260318 as WebFetchTool20260318,
3534
3722
  type WebFetchToolResultBlock as WebFetchToolResultBlock,
3535
3723
  type WebFetchToolResultBlockParam as WebFetchToolResultBlockParam,
3536
3724
  type WebFetchToolResultErrorBlock as WebFetchToolResultErrorBlock,
@@ -3540,6 +3728,7 @@ export declare namespace Messages {
3540
3728
  type WebSearchResultBlockParam as WebSearchResultBlockParam,
3541
3729
  type WebSearchTool20250305 as WebSearchTool20250305,
3542
3730
  type WebSearchTool20260209 as WebSearchTool20260209,
3731
+ type WebSearchTool20260318 as WebSearchTool20260318,
3543
3732
  type WebSearchToolRequestError as WebSearchToolRequestError,
3544
3733
  type WebSearchToolResultBlock as WebSearchToolResultBlock,
3545
3734
  type WebSearchToolResultBlockContent as WebSearchToolResultBlockContent,