@anthropic-ai/sdk 0.106.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 (110) hide show
  1. package/CHANGELOG.md +25 -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/package.json +1 -1
  10. package/resources/beta/beta.d.mts +2 -2
  11. package/resources/beta/beta.d.mts.map +1 -1
  12. package/resources/beta/beta.d.ts +2 -2
  13. package/resources/beta/beta.d.ts.map +1 -1
  14. package/resources/beta/beta.js.map +1 -1
  15. package/resources/beta/beta.mjs.map +1 -1
  16. package/resources/beta/deployments.d.mts +18 -6
  17. package/resources/beta/deployments.d.mts.map +1 -1
  18. package/resources/beta/deployments.d.ts +18 -6
  19. package/resources/beta/deployments.d.ts.map +1 -1
  20. package/resources/beta/deployments.js +18 -6
  21. package/resources/beta/deployments.js.map +1 -1
  22. package/resources/beta/deployments.mjs +18 -6
  23. package/resources/beta/deployments.mjs.map +1 -1
  24. package/resources/beta/index.d.mts +1 -1
  25. package/resources/beta/index.d.mts.map +1 -1
  26. package/resources/beta/index.d.ts +1 -1
  27. package/resources/beta/index.d.ts.map +1 -1
  28. package/resources/beta/index.js.map +1 -1
  29. package/resources/beta/index.mjs.map +1 -1
  30. package/resources/beta/messages/batches.d.mts +29 -21
  31. package/resources/beta/messages/batches.d.mts.map +1 -1
  32. package/resources/beta/messages/batches.d.ts +29 -21
  33. package/resources/beta/messages/batches.d.ts.map +1 -1
  34. package/resources/beta/messages/batches.js +6 -6
  35. package/resources/beta/messages/batches.mjs +6 -6
  36. package/resources/beta/messages/index.d.mts +1 -1
  37. package/resources/beta/messages/index.d.mts.map +1 -1
  38. package/resources/beta/messages/index.d.ts +1 -1
  39. package/resources/beta/messages/index.d.ts.map +1 -1
  40. package/resources/beta/messages/index.js.map +1 -1
  41. package/resources/beta/messages/index.mjs.map +1 -1
  42. package/resources/beta/messages/messages.d.mts +160 -32
  43. package/resources/beta/messages/messages.d.mts.map +1 -1
  44. package/resources/beta/messages/messages.d.ts +160 -32
  45. package/resources/beta/messages/messages.d.ts.map +1 -1
  46. package/resources/beta/messages/messages.js +6 -3
  47. package/resources/beta/messages/messages.js.map +1 -1
  48. package/resources/beta/messages/messages.mjs +6 -3
  49. package/resources/beta/messages/messages.mjs.map +1 -1
  50. package/resources/completions.d.mts +12 -7
  51. package/resources/completions.d.mts.map +1 -1
  52. package/resources/completions.d.ts +12 -7
  53. package/resources/completions.d.ts.map +1 -1
  54. package/resources/index.d.mts +1 -1
  55. package/resources/index.d.mts.map +1 -1
  56. package/resources/index.d.ts +1 -1
  57. package/resources/index.d.ts.map +1 -1
  58. package/resources/index.js.map +1 -1
  59. package/resources/index.mjs.map +1 -1
  60. package/resources/messages/batches.d.mts +8 -7
  61. package/resources/messages/batches.d.mts.map +1 -1
  62. package/resources/messages/batches.d.ts +8 -7
  63. package/resources/messages/batches.d.ts.map +1 -1
  64. package/resources/messages/batches.js +6 -6
  65. package/resources/messages/batches.mjs +6 -6
  66. package/resources/messages/index.d.mts +1 -1
  67. package/resources/messages/index.d.mts.map +1 -1
  68. package/resources/messages/index.d.ts +1 -1
  69. package/resources/messages/index.d.ts.map +1 -1
  70. package/resources/messages/index.js.map +1 -1
  71. package/resources/messages/index.mjs.map +1 -1
  72. package/resources/messages/messages.d.mts +172 -43
  73. package/resources/messages/messages.d.mts.map +1 -1
  74. package/resources/messages/messages.d.ts +172 -43
  75. package/resources/messages/messages.d.ts.map +1 -1
  76. package/resources/messages/messages.js +11 -3
  77. package/resources/messages/messages.js.map +1 -1
  78. package/resources/messages/messages.mjs +11 -3
  79. package/resources/messages/messages.mjs.map +1 -1
  80. package/src/client.ts +4 -0
  81. package/src/resources/beta/beta.ts +4 -0
  82. package/src/resources/beta/deployments.ts +18 -6
  83. package/src/resources/beta/index.ts +2 -0
  84. package/src/resources/beta/messages/batches.ts +29 -21
  85. package/src/resources/beta/messages/index.ts +2 -0
  86. package/src/resources/beta/messages/messages.ts +197 -31
  87. package/src/resources/completions.ts +12 -7
  88. package/src/resources/index.ts +2 -0
  89. package/src/resources/messages/batches.ts +8 -7
  90. package/src/resources/messages/index.ts +2 -0
  91. package/src/resources/messages/messages.ts +213 -41
  92. package/src/tools/agent-toolset/fs-util.ts +7 -1
  93. package/src/tools/agent-toolset/node.ts +19 -3
  94. package/src/version.ts +1 -1
  95. package/tools/agent-toolset/fs-util.d.mts.map +1 -1
  96. package/tools/agent-toolset/fs-util.d.ts.map +1 -1
  97. package/tools/agent-toolset/fs-util.js +7 -1
  98. package/tools/agent-toolset/fs-util.js.map +1 -1
  99. package/tools/agent-toolset/fs-util.mjs +7 -1
  100. package/tools/agent-toolset/fs-util.mjs.map +1 -1
  101. package/tools/agent-toolset/node.d.mts.map +1 -1
  102. package/tools/agent-toolset/node.d.ts.map +1 -1
  103. package/tools/agent-toolset/node.js +21 -4
  104. package/tools/agent-toolset/node.js.map +1 -1
  105. package/tools/agent-toolset/node.mjs +21 -4
  106. package/tools/agent-toolset/node.mjs.map +1 -1
  107. package/version.d.mts +1 -1
  108. package/version.d.ts +1 -1
  109. package/version.js +1 -1
  110. package/version.mjs +1 -1
@@ -84,7 +84,7 @@ export class Messages extends APIResource {
84
84
  * conversations.
85
85
  *
86
86
  * Learn more about the Messages API in our
87
- * [user guide](https://docs.claude.com/en/docs/initial-setup)
87
+ * [user guide](https://platform.claude.com/docs/en/get-started)
88
88
  *
89
89
  * @example
90
90
  * ```ts
@@ -206,7 +206,7 @@ export class Messages extends APIResource {
206
206
  * including tools, images, and documents, without creating it.
207
207
  *
208
208
  * Learn more about token counting in our
209
- * [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting)
209
+ * [user guide](https://platform.claude.com/docs/en/build-with-claude/token-counting)
210
210
  *
211
211
  * @example
212
212
  * ```ts
@@ -224,12 +224,15 @@ export class Messages extends APIResource {
224
224
  // Transform deprecated output_format to output_config.format
225
225
  const modifiedParams = transformOutputFormat(params);
226
226
 
227
- const { betas, ...body } = modifiedParams;
227
+ const { betas, user_profile_id, ...body } = modifiedParams;
228
228
  return this._client.post('/v1/messages/count_tokens?beta=true', {
229
229
  body,
230
230
  ...options,
231
231
  headers: buildHeaders([
232
- { 'anthropic-beta': [...(betas ?? []), 'token-counting-2024-11-01'].toString() },
232
+ {
233
+ 'anthropic-beta': [...(betas ?? []), 'token-counting-2024-11-01'].toString(),
234
+ ...(user_profile_id != null ? { 'anthropic-user-profile-id': user_profile_id } : undefined),
235
+ },
233
236
  options?.headers,
234
237
  ]),
235
238
  });
@@ -592,7 +595,7 @@ export interface BetaCacheControlEphemeral {
592
595
  * - `1h`: 1 hour
593
596
  *
594
597
  * Defaults to `5m`. See
595
- * [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching)
598
+ * [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching)
596
599
  * for details.
597
600
  */
598
601
  ttl?: '5m' | '1h';
@@ -2993,7 +2996,7 @@ export interface BetaThinkingConfigEnabled {
2993
2996
  * Must be ≥1024 and less than `max_tokens`.
2994
2997
  *
2995
2998
  * See
2996
- * [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
2999
+ * [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
2997
3000
  * for details.
2998
3001
  */
2999
3002
  budget_tokens: number;
@@ -3017,7 +3020,7 @@ export interface BetaThinkingConfigEnabled {
3017
3020
  * tokens and counts towards your `max_tokens` limit.
3018
3021
  *
3019
3022
  * See
3020
- * [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
3023
+ * [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
3021
3024
  * for details.
3022
3025
  */
3023
3026
  export type BetaThinkingConfigParam =
@@ -3745,6 +3748,8 @@ export type BetaToolUnion =
3745
3748
  | BetaWebSearchTool20260209
3746
3749
  | BetaWebFetchTool20260209
3747
3750
  | BetaWebFetchTool20260309
3751
+ | BetaWebSearchTool20260318
3752
+ | BetaWebFetchTool20260318
3748
3753
  | BetaAdvisorTool20260301
3749
3754
  | BetaToolSearchToolBm25_20251119
3750
3755
  | BetaToolSearchToolRegex20251119
@@ -4120,6 +4125,81 @@ export interface BetaWebFetchTool20260309 {
4120
4125
  use_cache?: boolean;
4121
4126
  }
4122
4127
 
4128
+ export interface BetaWebFetchTool20260318 {
4129
+ /**
4130
+ * Name of the tool.
4131
+ *
4132
+ * This is how the tool will be called by the model and in `tool_use` blocks.
4133
+ */
4134
+ name: 'web_fetch';
4135
+
4136
+ type: 'web_fetch_20260318';
4137
+
4138
+ allowed_callers?: Array<
4139
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
4140
+ >;
4141
+
4142
+ /**
4143
+ * List of domains to allow fetching from
4144
+ */
4145
+ allowed_domains?: Array<string> | null;
4146
+
4147
+ /**
4148
+ * List of domains to block fetching from
4149
+ */
4150
+ blocked_domains?: Array<string> | null;
4151
+
4152
+ /**
4153
+ * Create a cache control breakpoint at this content block.
4154
+ */
4155
+ cache_control?: BetaCacheControlEphemeral | null;
4156
+
4157
+ /**
4158
+ * Citations configuration for fetched documents. Citations are disabled by
4159
+ * default.
4160
+ */
4161
+ citations?: BetaCitationsConfigParam | null;
4162
+
4163
+ /**
4164
+ * If true, tool will not be included in initial system prompt. Only loaded when
4165
+ * returned via tool_reference from tool search.
4166
+ */
4167
+ defer_loading?: boolean;
4168
+
4169
+ /**
4170
+ * Maximum number of tokens used by including web page text content in the context.
4171
+ * The limit is approximate and does not apply to binary content such as PDFs.
4172
+ */
4173
+ max_content_tokens?: number | null;
4174
+
4175
+ /**
4176
+ * Maximum number of times the tool can be used in the API request.
4177
+ */
4178
+ max_uses?: number | null;
4179
+
4180
+ /**
4181
+ * How this tool's result blocks appear in the API response when the result was
4182
+ * consumed by a completed code_execution call in the same turn. 'full' returns the
4183
+ * complete content (default). 'excluded' drops the nested server_tool_use and
4184
+ * result block pair entirely. Results from direct calls, or from code_execution
4185
+ * calls that paused before completing, are always returned in full so they can be
4186
+ * sent back on the next turn.
4187
+ */
4188
+ response_inclusion?: 'full' | 'excluded';
4189
+
4190
+ /**
4191
+ * When true, guarantees schema validation on tool names and inputs
4192
+ */
4193
+ strict?: boolean;
4194
+
4195
+ /**
4196
+ * Whether to use cached content. Set to false to bypass the cache and fetch fresh
4197
+ * content. Only set to false when the user explicitly requests fresh content or
4198
+ * when fetching rapidly-changing sources.
4199
+ */
4200
+ use_cache?: boolean;
4201
+ }
4202
+
4123
4203
  export interface BetaWebFetchToolResultBlock {
4124
4204
  content: BetaWebFetchToolResultErrorBlock | BetaWebFetchBlock;
4125
4205
 
@@ -4306,6 +4386,70 @@ export interface BetaWebSearchTool20260209 {
4306
4386
  user_location?: BetaUserLocation | null;
4307
4387
  }
4308
4388
 
4389
+ export interface BetaWebSearchTool20260318 {
4390
+ /**
4391
+ * Name of the tool.
4392
+ *
4393
+ * This is how the tool will be called by the model and in `tool_use` blocks.
4394
+ */
4395
+ name: 'web_search';
4396
+
4397
+ type: 'web_search_20260318';
4398
+
4399
+ allowed_callers?: Array<
4400
+ 'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
4401
+ >;
4402
+
4403
+ /**
4404
+ * If provided, only these domains will be included in results. Cannot be used
4405
+ * alongside `blocked_domains`.
4406
+ */
4407
+ allowed_domains?: Array<string> | null;
4408
+
4409
+ /**
4410
+ * If provided, these domains will never appear in results. Cannot be used
4411
+ * alongside `allowed_domains`.
4412
+ */
4413
+ blocked_domains?: Array<string> | null;
4414
+
4415
+ /**
4416
+ * Create a cache control breakpoint at this content block.
4417
+ */
4418
+ cache_control?: BetaCacheControlEphemeral | null;
4419
+
4420
+ /**
4421
+ * If true, tool will not be included in initial system prompt. Only loaded when
4422
+ * returned via tool_reference from tool search.
4423
+ */
4424
+ defer_loading?: boolean;
4425
+
4426
+ /**
4427
+ * Maximum number of times the tool can be used in the API request.
4428
+ */
4429
+ max_uses?: number | null;
4430
+
4431
+ /**
4432
+ * How this tool's result blocks appear in the API response when the result was
4433
+ * consumed by a completed code_execution call in the same turn. 'full' returns the
4434
+ * complete content (default). 'excluded' drops the nested server_tool_use and
4435
+ * result block pair entirely. Results from direct calls, or from code_execution
4436
+ * calls that paused before completing, are always returned in full so they can be
4437
+ * sent back on the next turn.
4438
+ */
4439
+ response_inclusion?: 'full' | 'excluded';
4440
+
4441
+ /**
4442
+ * When true, guarantees schema validation on tool names and inputs
4443
+ */
4444
+ strict?: boolean;
4445
+
4446
+ /**
4447
+ * Parameters for the user's location. Used to provide more relevant search
4448
+ * results.
4449
+ */
4450
+ user_location?: BetaUserLocation | null;
4451
+ }
4452
+
4309
4453
  export interface BetaWebSearchToolRequestError {
4310
4454
  error_code: BetaWebSearchToolResultErrorCode;
4311
4455
 
@@ -4380,11 +4524,12 @@ export interface MessageCreateParamsBase {
4380
4524
  * only specifies the absolute maximum number of tokens to generate.
4381
4525
  *
4382
4526
  * Set to `0` to populate the
4383
- * [prompt cache](https://docs.claude.com/en/docs/build-with-claude/prompt-caching#pre-warming-the-cache)
4527
+ * [prompt cache](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pre-warming-the-cache)
4384
4528
  * without generating a response.
4385
4529
  *
4386
4530
  * Different models have different maximum values for this parameter. See
4387
- * [models](https://docs.claude.com/en/docs/models-overview) for details.
4531
+ * [models](https://platform.claude.com/docs/en/about-claude/models/overview) for
4532
+ * details.
4388
4533
  */
4389
4534
  max_tokens: number;
4390
4535
 
@@ -4446,12 +4591,13 @@ export interface MessageCreateParamsBase {
4446
4591
  * { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
4447
4592
  * ```
4448
4593
  *
4449
- * See [input examples](https://docs.claude.com/en/api/messages-examples).
4594
+ * See
4595
+ * [input examples](https://platform.claude.com/docs/en/build-with-claude/working-with-messages).
4450
4596
  *
4451
4597
  * Note that if you want to include a
4452
- * [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the
4453
- * top-level `system` parameter — there is no `"system"` role for input messages in
4454
- * the Messages API.
4598
+ * [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role),
4599
+ * you can use the top-level `system` parameter — there is no `"system"` role for
4600
+ * input messages in the Messages API.
4455
4601
  *
4456
4602
  * There is a limit of 100,000 messages in a single request.
4457
4603
  */
@@ -4556,7 +4702,8 @@ export interface MessageCreateParamsBase {
4556
4702
  * standard capacity for this request.
4557
4703
  *
4558
4704
  * Anthropic offers different levels of service for your API requests. See
4559
- * [service-tiers](https://docs.claude.com/en/api/service-tiers) for details.
4705
+ * [service-tiers](https://platform.claude.com/docs/en/api/service-tiers) for
4706
+ * details.
4560
4707
  */
4561
4708
  service_tier?: 'auto' | 'standard_only';
4562
4709
 
@@ -4583,7 +4730,8 @@ export interface MessageCreateParamsBase {
4583
4730
  * Body param: Whether to incrementally stream the response using server-sent
4584
4731
  * events.
4585
4732
  *
4586
- * See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
4733
+ * See [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming)
4734
+ * for details.
4587
4735
  */
4588
4736
  stream?: boolean;
4589
4737
 
@@ -4592,7 +4740,7 @@ export interface MessageCreateParamsBase {
4592
4740
  *
4593
4741
  * A system prompt is a way of providing context and instructions to Claude, such
4594
4742
  * as specifying a particular goal or role. See our
4595
- * [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).
4743
+ * [guide to system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role).
4596
4744
  */
4597
4745
  system?: string | Array<BetaTextBlockParam>;
4598
4746
 
@@ -4611,7 +4759,7 @@ export interface MessageCreateParamsBase {
4611
4759
  * tokens and counts towards your `max_tokens` limit.
4612
4760
  *
4613
4761
  * See
4614
- * [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
4762
+ * [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
4615
4763
  * for details.
4616
4764
  */
4617
4765
  thinking?: BetaThinkingConfigParam;
@@ -4632,9 +4780,9 @@ export interface MessageCreateParamsBase {
4632
4780
  *
4633
4781
  * There are two types of tools: **client tools** and **server tools**. The
4634
4782
  * behavior described below applies to client tools. For
4635
- * [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
4783
+ * [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools),
4636
4784
  * see their individual documentation as each has its own behavior (e.g., the
4637
- * [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
4785
+ * [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool)).
4638
4786
  *
4639
4787
  * Each tool definition includes:
4640
4788
  *
@@ -4697,7 +4845,9 @@ export interface MessageCreateParamsBase {
4697
4845
  * functions, or more generally whenever you want the model to produce a particular
4698
4846
  * JSON structure of output.
4699
4847
  *
4700
- * See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.
4848
+ * See our
4849
+ * [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview)
4850
+ * for more details.
4701
4851
  */
4702
4852
  tools?: Array<BetaToolUnion>;
4703
4853
 
@@ -4737,7 +4887,8 @@ export interface MessageCreateParamsNonStreaming extends MessageCreateParamsBase
4737
4887
  * Body param: Whether to incrementally stream the response using server-sent
4738
4888
  * events.
4739
4889
  *
4740
- * See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
4890
+ * See [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming)
4891
+ * for details.
4741
4892
  */
4742
4893
  stream?: false;
4743
4894
  }
@@ -4747,7 +4898,8 @@ export interface MessageCreateParamsStreaming extends MessageCreateParamsBase {
4747
4898
  * Body param: Whether to incrementally stream the response using server-sent
4748
4899
  * events.
4749
4900
  *
4750
- * See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
4901
+ * See [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming)
4902
+ * for details.
4751
4903
  */
4752
4904
  stream: true;
4753
4905
  }
@@ -4811,12 +4963,13 @@ export interface MessageCountTokensParams {
4811
4963
  * { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
4812
4964
  * ```
4813
4965
  *
4814
- * See [input examples](https://docs.claude.com/en/api/messages-examples).
4966
+ * See
4967
+ * [input examples](https://platform.claude.com/docs/en/build-with-claude/working-with-messages).
4815
4968
  *
4816
4969
  * Note that if you want to include a
4817
- * [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the
4818
- * top-level `system` parameter — there is no `"system"` role for input messages in
4819
- * the Messages API.
4970
+ * [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role),
4971
+ * you can use the top-level `system` parameter — there is no `"system"` role for
4972
+ * input messages in the Messages API.
4820
4973
  *
4821
4974
  * There is a limit of 100,000 messages in a single request.
4822
4975
  */
@@ -4875,7 +5028,7 @@ export interface MessageCountTokensParams {
4875
5028
  *
4876
5029
  * A system prompt is a way of providing context and instructions to Claude, such
4877
5030
  * as specifying a particular goal or role. See our
4878
- * [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).
5031
+ * [guide to system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role).
4879
5032
  */
4880
5033
  system?: string | Array<BetaTextBlockParam>;
4881
5034
 
@@ -4887,7 +5040,7 @@ export interface MessageCountTokensParams {
4887
5040
  * tokens and counts towards your `max_tokens` limit.
4888
5041
  *
4889
5042
  * See
4890
- * [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
5043
+ * [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
4891
5044
  * for details.
4892
5045
  */
4893
5046
  thinking?: BetaThinkingConfigParam;
@@ -4908,9 +5061,9 @@ export interface MessageCountTokensParams {
4908
5061
  *
4909
5062
  * There are two types of tools: **client tools** and **server tools**. The
4910
5063
  * behavior described below applies to client tools. For
4911
- * [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
5064
+ * [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools),
4912
5065
  * see their individual documentation as each has its own behavior (e.g., the
4913
- * [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
5066
+ * [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool)).
4914
5067
  *
4915
5068
  * Each tool definition includes:
4916
5069
  *
@@ -4973,7 +5126,9 @@ export interface MessageCountTokensParams {
4973
5126
  * functions, or more generally whenever you want the model to produce a particular
4974
5127
  * JSON structure of output.
4975
5128
  *
4976
- * See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.
5129
+ * See our
5130
+ * [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview)
5131
+ * for more details.
4977
5132
  */
4978
5133
  tools?: Array<
4979
5134
  | BetaTool
@@ -4996,6 +5151,8 @@ export interface MessageCountTokensParams {
4996
5151
  | BetaWebSearchTool20260209
4997
5152
  | BetaWebFetchTool20260209
4998
5153
  | BetaWebFetchTool20260309
5154
+ | BetaWebSearchTool20260318
5155
+ | BetaWebFetchTool20260318
4999
5156
  | BetaAdvisorTool20260301
5000
5157
  | BetaToolSearchToolBm25_20251119
5001
5158
  | BetaToolSearchToolRegex20251119
@@ -5006,6 +5163,13 @@ export interface MessageCountTokensParams {
5006
5163
  * Header param: Optional header to specify the beta version(s) you want to use.
5007
5164
  */
5008
5165
  betas?: Array<BetaAPI.AnthropicBeta>;
5166
+
5167
+ /**
5168
+ * Header param: The user profile ID to attribute this request to. Use when acting
5169
+ * on behalf of a party other than your organization. Requires the `user-profiles`
5170
+ * beta header.
5171
+ */
5172
+ user_profile_id?: string;
5009
5173
  }
5010
5174
 
5011
5175
  export { BetaToolRunner, type BetaToolRunnerParams } from '../../../lib/tools/BetaToolRunner';
@@ -5230,6 +5394,7 @@ export declare namespace Messages {
5230
5394
  type BetaWebFetchTool20250910 as BetaWebFetchTool20250910,
5231
5395
  type BetaWebFetchTool20260209 as BetaWebFetchTool20260209,
5232
5396
  type BetaWebFetchTool20260309 as BetaWebFetchTool20260309,
5397
+ type BetaWebFetchTool20260318 as BetaWebFetchTool20260318,
5233
5398
  type BetaWebFetchToolResultBlock as BetaWebFetchToolResultBlock,
5234
5399
  type BetaWebFetchToolResultBlockParam as BetaWebFetchToolResultBlockParam,
5235
5400
  type BetaWebFetchToolResultErrorBlock as BetaWebFetchToolResultErrorBlock,
@@ -5239,6 +5404,7 @@ export declare namespace Messages {
5239
5404
  type BetaWebSearchResultBlockParam as BetaWebSearchResultBlockParam,
5240
5405
  type BetaWebSearchTool20250305 as BetaWebSearchTool20250305,
5241
5406
  type BetaWebSearchTool20260209 as BetaWebSearchTool20260209,
5407
+ type BetaWebSearchTool20260318 as BetaWebSearchTool20260318,
5242
5408
  type BetaWebSearchToolRequestError as BetaWebSearchToolRequestError,
5243
5409
  type BetaWebSearchToolResultBlock as BetaWebSearchToolResultBlock,
5244
5410
  type BetaWebSearchToolResultBlockContent as BetaWebSearchToolResultBlockContent,
@@ -14,10 +14,10 @@ export class Completions extends APIResource {
14
14
  * [Legacy] Create a Text Completion.
15
15
  *
16
16
  * The Text Completions API is a legacy API. We recommend using the
17
- * [Messages API](https://docs.claude.com/en/api/messages) going forward.
17
+ * [Messages API](https://platform.claude.com/docs/en/api/messages) going forward.
18
18
  *
19
19
  * Future models and features will not be compatible with Text Completions. See our
20
- * [migration guide](https://docs.claude.com/en/api/migrating-from-text-completions-to-messages)
20
+ * [migration guide](https://platform.claude.com/docs/en/build-with-claude/working-with-messages)
21
21
  * for guidance in migrating from Text Completions to Messages.
22
22
  *
23
23
  * @example
@@ -122,8 +122,10 @@ export interface CompletionCreateParamsBase {
122
122
  * "\n\nHuman: {userQuestion}\n\nAssistant:"
123
123
  * ```
124
124
  *
125
- * See [prompt validation](https://docs.claude.com/en/api/prompt-validation) and
126
- * our guide to [prompt design](https://docs.claude.com/en/docs/intro-to-prompting)
125
+ * See
126
+ * [prompt validation](https://platform.claude.com/docs/en/build-with-claude/working-with-messages)
127
+ * and our guide to
128
+ * [prompt design](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview)
127
129
  * for more details.
128
130
  */
129
131
  prompt: string;
@@ -146,7 +148,8 @@ export interface CompletionCreateParamsBase {
146
148
  * Body param: Whether to incrementally stream the response using server-sent
147
149
  * events.
148
150
  *
149
- * See [streaming](https://docs.claude.com/en/api/streaming) for details.
151
+ * See [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming)
152
+ * for details.
150
153
  */
151
154
  stream?: boolean;
152
155
 
@@ -191,7 +194,8 @@ export interface CompletionCreateParamsNonStreaming extends CompletionCreatePara
191
194
  * Body param: Whether to incrementally stream the response using server-sent
192
195
  * events.
193
196
  *
194
- * See [streaming](https://docs.claude.com/en/api/streaming) for details.
197
+ * See [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming)
198
+ * for details.
195
199
  */
196
200
  stream?: false;
197
201
  }
@@ -201,7 +205,8 @@ export interface CompletionCreateParamsStreaming extends CompletionCreateParamsB
201
205
  * Body param: Whether to incrementally stream the response using server-sent
202
206
  * events.
203
207
  *
204
- * See [streaming](https://docs.claude.com/en/api/streaming) for details.
208
+ * See [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming)
209
+ * for details.
205
210
  */
206
211
  stream: true;
207
212
  }
@@ -173,6 +173,7 @@ export {
173
173
  type WebFetchTool20250910,
174
174
  type WebFetchTool20260209,
175
175
  type WebFetchTool20260309,
176
+ type WebFetchTool20260318,
176
177
  type WebFetchToolResultBlock,
177
178
  type WebFetchToolResultBlockParam,
178
179
  type WebFetchToolResultErrorBlock,
@@ -182,6 +183,7 @@ export {
182
183
  type WebSearchResultBlockParam,
183
184
  type WebSearchTool20250305,
184
185
  type WebSearchTool20260209,
186
+ type WebSearchTool20260318,
185
187
  type WebSearchToolRequestError,
186
188
  type WebSearchToolResultBlock,
187
189
  type WebSearchToolResultBlockContent,
@@ -20,7 +20,7 @@ export class Batches extends APIResource {
20
20
  * can take up to 24 hours to complete.
21
21
  *
22
22
  * Learn more about the Message Batches API in our
23
- * [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
23
+ * [user guide](https://platform.claude.com/docs/en/build-with-claude/batch-processing)
24
24
  *
25
25
  * @example
26
26
  * ```ts
@@ -58,7 +58,7 @@ export class Batches extends APIResource {
58
58
  * `results_url` field in the response.
59
59
  *
60
60
  * Learn more about the Message Batches API in our
61
- * [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
61
+ * [user guide](https://platform.claude.com/docs/en/build-with-claude/batch-processing)
62
62
  *
63
63
  * @example
64
64
  * ```ts
@@ -76,7 +76,7 @@ export class Batches extends APIResource {
76
76
  * returned first.
77
77
  *
78
78
  * Learn more about the Message Batches API in our
79
- * [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
79
+ * [user guide](https://platform.claude.com/docs/en/build-with-claude/batch-processing)
80
80
  *
81
81
  * @example
82
82
  * ```ts
@@ -100,7 +100,7 @@ export class Batches extends APIResource {
100
100
  * like to delete an in-progress batch, you must first cancel it.
101
101
  *
102
102
  * Learn more about the Message Batches API in our
103
- * [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
103
+ * [user guide](https://platform.claude.com/docs/en/build-with-claude/batch-processing)
104
104
  *
105
105
  * @example
106
106
  * ```ts
@@ -124,7 +124,7 @@ export class Batches extends APIResource {
124
124
  * non-interruptible.
125
125
  *
126
126
  * Learn more about the Message Batches API in our
127
- * [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
127
+ * [user guide](https://platform.claude.com/docs/en/build-with-claude/batch-processing)
128
128
  *
129
129
  * @example
130
130
  * ```ts
@@ -145,7 +145,7 @@ export class Batches extends APIResource {
145
145
  * requests. Use the `custom_id` field to match results to requests.
146
146
  *
147
147
  * Learn more about the Message Batches API in our
148
- * [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
148
+ * [user guide](https://platform.claude.com/docs/en/build-with-claude/batch-processing)
149
149
  *
150
150
  * @example
151
151
  * ```ts
@@ -386,7 +386,8 @@ export namespace BatchCreateParams {
386
386
  /**
387
387
  * Messages API creation parameters for the individual request.
388
388
  *
389
- * See the [Messages API reference](https://docs.claude.com/en/api/messages) for
389
+ * See the
390
+ * [Messages API reference](https://platform.claude.com/docs/en/api/messages) for
390
391
  * full documentation on available parameters.
391
392
  */
392
393
  params: MessagesAPI.MessageCreateParamsNonStreaming;
@@ -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,