@tanstack/ai-anthropic 0.16.2 → 0.16.4

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 (35) hide show
  1. package/dist/esm/adapters/summarize.js +39 -12
  2. package/dist/esm/adapters/summarize.js.map +1 -1
  3. package/dist/esm/adapters/text.js +841 -940
  4. package/dist/esm/adapters/text.js.map +1 -1
  5. package/dist/esm/index.js +3 -13
  6. package/dist/esm/model-meta.js +399 -74
  7. package/dist/esm/model-meta.js.map +1 -1
  8. package/dist/esm/text/text-provider-options.js +19 -26
  9. package/dist/esm/text/text-provider-options.js.map +1 -1
  10. package/dist/esm/tools/bash-tool.js +11 -12
  11. package/dist/esm/tools/bash-tool.js.map +1 -1
  12. package/dist/esm/tools/code-execution-tool.js +29 -30
  13. package/dist/esm/tools/code-execution-tool.js.map +1 -1
  14. package/dist/esm/tools/computer-use-tool.js +11 -12
  15. package/dist/esm/tools/computer-use-tool.js.map +1 -1
  16. package/dist/esm/tools/custom-tool.js +29 -30
  17. package/dist/esm/tools/custom-tool.js.map +1 -1
  18. package/dist/esm/tools/index.js +1 -14
  19. package/dist/esm/tools/memory-tool.js +14 -15
  20. package/dist/esm/tools/memory-tool.js.map +1 -1
  21. package/dist/esm/tools/text-editor-tool.js +11 -14
  22. package/dist/esm/tools/text-editor-tool.js.map +1 -1
  23. package/dist/esm/tools/tool-converter.js +41 -25
  24. package/dist/esm/tools/tool-converter.js.map +1 -1
  25. package/dist/esm/tools/web-fetch-tool.js +15 -16
  26. package/dist/esm/tools/web-fetch-tool.js.map +1 -1
  27. package/dist/esm/tools/web-search-tool.js +32 -56
  28. package/dist/esm/tools/web-search-tool.js.map +1 -1
  29. package/dist/esm/usage.js +33 -32
  30. package/dist/esm/usage.js.map +1 -1
  31. package/dist/esm/utils/client.js +23 -14
  32. package/dist/esm/utils/client.js.map +1 -1
  33. package/package.json +6 -6
  34. package/dist/esm/index.js.map +0 -1
  35. package/dist/esm/tools/index.js.map +0 -1
@@ -1,89 +1,414 @@
1
- const CLAUDE_OPUS_4_6 = {
2
- id: "claude-opus-4-6",
3
- max_output_tokens: 128e3
1
+ //#region src/model-meta.ts
2
+ var CLAUDE_OPUS_4_6 = {
3
+ name: "claude-opus-4-6",
4
+ id: "claude-opus-4-6",
5
+ context_window: 2e5,
6
+ max_output_tokens: 128e3,
7
+ knowledge_cutoff: "2025-05-01",
8
+ pricing: {
9
+ input: { normal: 5 },
10
+ output: { normal: 25 }
11
+ },
12
+ supports: {
13
+ input: [
14
+ "text",
15
+ "image",
16
+ "document"
17
+ ],
18
+ extended_thinking: true,
19
+ adaptive_thinking: true,
20
+ priority_tier: true,
21
+ tools: [
22
+ "web_search",
23
+ "web_fetch",
24
+ "code_execution",
25
+ "computer_use",
26
+ "bash",
27
+ "text_editor",
28
+ "memory"
29
+ ]
30
+ }
4
31
  };
5
- const CLAUDE_OPUS_4_5 = {
6
- id: "claude-opus-4-5",
7
- max_output_tokens: 32e3
32
+ var CLAUDE_OPUS_4_5 = {
33
+ name: "claude-opus-4-5",
34
+ id: "claude-opus-4-5",
35
+ context_window: 2e5,
36
+ max_output_tokens: 32e3,
37
+ knowledge_cutoff: "2025-11-01",
38
+ pricing: {
39
+ input: { normal: 15 },
40
+ output: { normal: 75 }
41
+ },
42
+ supports: {
43
+ input: [
44
+ "text",
45
+ "image",
46
+ "document"
47
+ ],
48
+ extended_thinking: true,
49
+ priority_tier: true,
50
+ tools: [
51
+ "web_search",
52
+ "web_fetch",
53
+ "code_execution",
54
+ "computer_use",
55
+ "bash",
56
+ "text_editor",
57
+ "memory"
58
+ ]
59
+ }
8
60
  };
9
- const CLAUDE_SONNET_4_6 = {
10
- id: "claude-sonnet-4-6",
11
- max_output_tokens: 64e3
61
+ var CLAUDE_SONNET_4_6 = {
62
+ name: "claude-sonnet-4-6",
63
+ id: "claude-sonnet-4-6",
64
+ context_window: 1e6,
65
+ max_output_tokens: 64e3,
66
+ knowledge_cutoff: "2025-08-01",
67
+ pricing: {
68
+ input: { normal: 3 },
69
+ output: { normal: 15 }
70
+ },
71
+ supports: {
72
+ input: [
73
+ "text",
74
+ "image",
75
+ "document"
76
+ ],
77
+ extended_thinking: true,
78
+ adaptive_thinking: true,
79
+ priority_tier: true,
80
+ tools: [
81
+ "web_search",
82
+ "web_fetch",
83
+ "code_execution",
84
+ "computer_use",
85
+ "bash",
86
+ "text_editor",
87
+ "memory"
88
+ ]
89
+ }
12
90
  };
13
- const CLAUDE_SONNET_4_5 = {
14
- id: "claude-sonnet-4-5",
15
- max_output_tokens: 64e3
91
+ var CLAUDE_SONNET_4_5 = {
92
+ name: "claude-sonnet-4-5",
93
+ id: "claude-sonnet-4-5",
94
+ context_window: 2e5,
95
+ max_output_tokens: 64e3,
96
+ knowledge_cutoff: "2025-09-29",
97
+ pricing: {
98
+ input: { normal: 3 },
99
+ output: { normal: 15 }
100
+ },
101
+ supports: {
102
+ input: [
103
+ "text",
104
+ "image",
105
+ "document"
106
+ ],
107
+ extended_thinking: true,
108
+ priority_tier: true,
109
+ tools: [
110
+ "web_search",
111
+ "web_fetch",
112
+ "code_execution",
113
+ "computer_use",
114
+ "bash",
115
+ "text_editor",
116
+ "memory"
117
+ ]
118
+ }
16
119
  };
17
- const CLAUDE_HAIKU_4_5 = {
18
- id: "claude-haiku-4-5",
19
- max_output_tokens: 64e3
120
+ var CLAUDE_HAIKU_4_5 = {
121
+ name: "claude-haiku-4-5",
122
+ id: "claude-haiku-4-5",
123
+ context_window: 2e5,
124
+ max_output_tokens: 64e3,
125
+ knowledge_cutoff: "2025-10-01",
126
+ pricing: {
127
+ input: { normal: 1 },
128
+ output: { normal: 5 }
129
+ },
130
+ supports: {
131
+ input: [
132
+ "text",
133
+ "image",
134
+ "document"
135
+ ],
136
+ extended_thinking: true,
137
+ priority_tier: true,
138
+ tools: [
139
+ "web_search",
140
+ "web_fetch",
141
+ "code_execution",
142
+ "computer_use",
143
+ "bash",
144
+ "text_editor",
145
+ "memory"
146
+ ]
147
+ }
20
148
  };
21
- const CLAUDE_OPUS_4_1 = {
22
- id: "claude-opus-4-1",
23
- max_output_tokens: 64e3
149
+ var CLAUDE_OPUS_4_1 = {
150
+ name: "claude-opus-4-1",
151
+ id: "claude-opus-4-1",
152
+ context_window: 2e5,
153
+ max_output_tokens: 64e3,
154
+ knowledge_cutoff: "2025-08-05",
155
+ pricing: {
156
+ input: { normal: 15 },
157
+ output: { normal: 75 }
158
+ },
159
+ supports: {
160
+ input: [
161
+ "text",
162
+ "image",
163
+ "document"
164
+ ],
165
+ extended_thinking: true,
166
+ priority_tier: true,
167
+ tools: [
168
+ "web_search",
169
+ "web_fetch",
170
+ "code_execution",
171
+ "computer_use",
172
+ "bash",
173
+ "text_editor",
174
+ "memory"
175
+ ]
176
+ }
24
177
  };
25
- const CLAUDE_OPUS_4_7 = {
26
- id: "claude-opus-4-7",
27
- max_output_tokens: 128e3
178
+ var CLAUDE_OPUS_4_7 = {
179
+ name: "claude-opus-4-7",
180
+ id: "claude-opus-4-7",
181
+ context_window: 1e6,
182
+ max_output_tokens: 128e3,
183
+ supports: {
184
+ input: [
185
+ "text",
186
+ "image",
187
+ "document"
188
+ ],
189
+ extended_thinking: false,
190
+ adaptive_thinking: true,
191
+ priority_tier: true,
192
+ tools: [
193
+ "web_search",
194
+ "web_fetch",
195
+ "code_execution",
196
+ "computer_use",
197
+ "bash",
198
+ "text_editor",
199
+ "memory"
200
+ ]
201
+ },
202
+ pricing: {
203
+ input: {
204
+ normal: 5,
205
+ cached: .5
206
+ },
207
+ output: { normal: 25 }
208
+ }
28
209
  };
29
- const CLAUDE_OPUS_4_8 = {
30
- id: "claude-opus-4-8",
31
- max_output_tokens: 128e3
210
+ var CLAUDE_OPUS_4_8 = {
211
+ name: "claude-opus-4-8",
212
+ id: "claude-opus-4-8",
213
+ context_window: 1e6,
214
+ max_output_tokens: 128e3,
215
+ supports: {
216
+ input: [
217
+ "text",
218
+ "image",
219
+ "document"
220
+ ],
221
+ extended_thinking: false,
222
+ adaptive_thinking: true,
223
+ priority_tier: true,
224
+ tools: [
225
+ "web_search",
226
+ "web_fetch",
227
+ "code_execution",
228
+ "computer_use",
229
+ "bash",
230
+ "text_editor",
231
+ "memory"
232
+ ]
233
+ },
234
+ pricing: {
235
+ input: {
236
+ normal: 5,
237
+ cached: .5
238
+ },
239
+ output: { normal: 25 }
240
+ }
32
241
  };
33
- const CLAUDE_FABLE_5 = {
34
- id: "claude-fable-5",
35
- max_output_tokens: 128e3
242
+ var CLAUDE_FABLE_5 = {
243
+ name: "claude-fable-5",
244
+ id: "claude-fable-5",
245
+ context_window: 1e6,
246
+ max_output_tokens: 128e3,
247
+ supports: {
248
+ input: [
249
+ "text",
250
+ "image",
251
+ "document"
252
+ ],
253
+ extended_thinking: false,
254
+ adaptive_thinking: true,
255
+ priority_tier: true,
256
+ tools: [
257
+ "web_search",
258
+ "web_fetch",
259
+ "code_execution",
260
+ "computer_use",
261
+ "bash",
262
+ "text_editor",
263
+ "memory"
264
+ ]
265
+ },
266
+ pricing: {
267
+ input: {
268
+ normal: 10,
269
+ cached: 1
270
+ },
271
+ output: { normal: 50 }
272
+ }
36
273
  };
37
- const CLAUDE_SONNET_5 = {
38
- id: "claude-sonnet-5",
39
- max_output_tokens: 128e3
274
+ var CLAUDE_SONNET_5 = {
275
+ name: "claude-sonnet-5",
276
+ id: "claude-sonnet-5",
277
+ context_window: 1e6,
278
+ max_output_tokens: 128e3,
279
+ supports: {
280
+ input: [
281
+ "text",
282
+ "image",
283
+ "document"
284
+ ],
285
+ extended_thinking: false,
286
+ adaptive_thinking: true,
287
+ priority_tier: true,
288
+ tools: [
289
+ "web_search",
290
+ "web_fetch",
291
+ "code_execution",
292
+ "computer_use",
293
+ "bash",
294
+ "text_editor",
295
+ "memory"
296
+ ]
297
+ },
298
+ pricing: {
299
+ input: {
300
+ normal: 3,
301
+ cached: .3
302
+ },
303
+ output: { normal: 15 }
304
+ }
40
305
  };
41
- const ANTHROPIC_MODELS = [
42
- CLAUDE_OPUS_4_6.id,
43
- CLAUDE_OPUS_4_5.id,
44
- CLAUDE_SONNET_4_6.id,
45
- CLAUDE_SONNET_4_5.id,
46
- CLAUDE_HAIKU_4_5.id,
47
- CLAUDE_OPUS_4_1.id,
48
- CLAUDE_OPUS_4_7.id,
49
- CLAUDE_OPUS_4_8.id,
50
- CLAUDE_FABLE_5.id,
51
- CLAUDE_SONNET_5.id
306
+ /**
307
+ * Model ids accepted by the Anthropic text adapter.
308
+ *
309
+ * Every id here resolves against the first-party Anthropic API
310
+ * (`GET /v1/models/{id}`). Retired models (Claude 3.x, Sonnet 3.7,
311
+ * Opus 4 / Sonnet 4) and the `-fast` variant ids (fast mode is requested
312
+ * via the `speed` parameter, not a model id) were removed after Anthropic
313
+ * turned them off.
314
+ */
315
+ var ANTHROPIC_MODELS = [
316
+ CLAUDE_OPUS_4_6.id,
317
+ CLAUDE_OPUS_4_5.id,
318
+ CLAUDE_SONNET_4_6.id,
319
+ CLAUDE_SONNET_4_5.id,
320
+ CLAUDE_HAIKU_4_5.id,
321
+ CLAUDE_OPUS_4_1.id,
322
+ CLAUDE_OPUS_4_7.id,
323
+ CLAUDE_OPUS_4_8.id,
324
+ CLAUDE_FABLE_5.id,
325
+ CLAUDE_SONNET_5.id
52
326
  ];
53
- const ANTHROPIC_DEFAULT_MAX_OUTPUT_TOKENS = 64e3;
54
- const ANTHROPIC_MODEL_MAX_OUTPUT_TOKENS = {
55
- [CLAUDE_OPUS_4_6.id]: CLAUDE_OPUS_4_6.max_output_tokens,
56
- [CLAUDE_OPUS_4_5.id]: CLAUDE_OPUS_4_5.max_output_tokens,
57
- [CLAUDE_SONNET_4_6.id]: CLAUDE_SONNET_4_6.max_output_tokens,
58
- [CLAUDE_SONNET_4_5.id]: CLAUDE_SONNET_4_5.max_output_tokens,
59
- [CLAUDE_HAIKU_4_5.id]: CLAUDE_HAIKU_4_5.max_output_tokens,
60
- [CLAUDE_OPUS_4_1.id]: CLAUDE_OPUS_4_1.max_output_tokens,
61
- [CLAUDE_OPUS_4_7.id]: CLAUDE_OPUS_4_7.max_output_tokens,
62
- [CLAUDE_OPUS_4_8.id]: CLAUDE_OPUS_4_8.max_output_tokens,
63
- [CLAUDE_FABLE_5.id]: CLAUDE_FABLE_5.max_output_tokens,
64
- [CLAUDE_SONNET_5.id]: CLAUDE_SONNET_5.max_output_tokens
327
+ /**
328
+ * Fallback `max_tokens` ceiling for a model whose metadata carries no
329
+ * `max_output_tokens` (e.g. an unrecognized model id). Anthropic's Messages
330
+ * API *requires* `max_tokens`, so the adapter must always send a value. 64K is
331
+ * the output ceiling of the current mainstream Claude tier (Sonnet/Haiku 4.5),
332
+ * so it's a sane default for an unknown — almost certainly modern — model and
333
+ * avoids silently truncating long generations (issue #849). Recognized models
334
+ * use their exact `max_output_tokens` from {@link ANTHROPIC_MODEL_MAX_OUTPUT_TOKENS}
335
+ * (e.g. 128K for Opus), so this fallback only ever applies to ids not in the
336
+ * map.
337
+ */
338
+ var ANTHROPIC_DEFAULT_MAX_OUTPUT_TOKENS = 64e3;
339
+ /**
340
+ * Runtime lookup of each model's maximum output-token ceiling, keyed by model
341
+ * id. Lets the text adapter default the required `max_tokens` request field to
342
+ * the model's real ceiling when the caller doesn't specify one, rather than a
343
+ * low constant that truncates responses mid-stream (issue #849).
344
+ *
345
+ * Kept in sync with {@link ANTHROPIC_MODELS} by `scripts/sync-provider-models.ts`
346
+ * — when that script adds a model it also inserts the model's `max_output_tokens`
347
+ * here, so a freshly-synced model resolves to its real ceiling rather than the
348
+ * fallback above.
349
+ */
350
+ var ANTHROPIC_MODEL_MAX_OUTPUT_TOKENS = {
351
+ [CLAUDE_OPUS_4_6.id]: CLAUDE_OPUS_4_6.max_output_tokens,
352
+ [CLAUDE_OPUS_4_5.id]: CLAUDE_OPUS_4_5.max_output_tokens,
353
+ [CLAUDE_SONNET_4_6.id]: CLAUDE_SONNET_4_6.max_output_tokens,
354
+ [CLAUDE_SONNET_4_5.id]: CLAUDE_SONNET_4_5.max_output_tokens,
355
+ [CLAUDE_HAIKU_4_5.id]: CLAUDE_HAIKU_4_5.max_output_tokens,
356
+ [CLAUDE_OPUS_4_1.id]: CLAUDE_OPUS_4_1.max_output_tokens,
357
+ [CLAUDE_OPUS_4_7.id]: CLAUDE_OPUS_4_7.max_output_tokens,
358
+ [CLAUDE_OPUS_4_8.id]: CLAUDE_OPUS_4_8.max_output_tokens,
359
+ [CLAUDE_FABLE_5.id]: CLAUDE_FABLE_5.max_output_tokens,
360
+ [CLAUDE_SONNET_5.id]: CLAUDE_SONNET_5.max_output_tokens
65
361
  };
66
- const ANTHROPIC_MAX_NONSTREAMING_TOKENS = 21e3;
362
+ /**
363
+ * Largest `max_tokens` the Anthropic SDK permits on a **non-streaming**
364
+ * request. The SDK refuses to make a non-streaming call it estimates could
365
+ * exceed its 10-minute timeout, computed as
366
+ * `(60min * max_tokens) / 128_000 > 10min` — i.e. it throws
367
+ * `"Streaming is required for operations that may take longer than 10 minutes"`
368
+ * once `max_tokens > 128_000 * 10 / 60 ≈ 21_333`
369
+ * (`@anthropic-ai/sdk`'s `calculateNonstreamingTimeout`). The text adapter's
370
+ * only non-streaming call is the forced-tool `structuredOutput()` request, so
371
+ * its defaulted ceiling must stay at or below this; the streaming chat path
372
+ * keeps the model's full {@link getAnthropicDefaultMaxTokens} ceiling. We sit
373
+ * just under the boundary (`21_333` would round-trip to exactly 10min). This
374
+ * caps only the *default* — an explicit oversized `max_tokens` from the caller
375
+ * still surfaces the SDK's "use streaming" error, which is the correct signal.
376
+ */
377
+ var ANTHROPIC_MAX_NONSTREAMING_TOKENS = 21e3;
378
+ /**
379
+ * Resolve the default `max_tokens` for a model: its known `max_output_tokens`
380
+ * ceiling, or {@link ANTHROPIC_DEFAULT_MAX_OUTPUT_TOKENS} for unknown models.
381
+ * Callers that pass an explicit `max_tokens` bypass this entirely.
382
+ *
383
+ * Pass `stream: false` for non-streaming requests (the `structuredOutput()`
384
+ * path): the result is then clamped to {@link ANTHROPIC_MAX_NONSTREAMING_TOKENS}
385
+ * so the defaulted ceiling doesn't trip the SDK's non-streaming 10-minute guard
386
+ * (issue #849). Streaming requests (the default) are unaffected and get the
387
+ * model's full ceiling.
388
+ */
67
389
  function getAnthropicDefaultMaxTokens(model, { stream = true } = {}) {
68
- const ceiling = ANTHROPIC_MODEL_MAX_OUTPUT_TOKENS[model] ?? ANTHROPIC_DEFAULT_MAX_OUTPUT_TOKENS;
69
- return stream ? ceiling : Math.min(ceiling, ANTHROPIC_MAX_NONSTREAMING_TOKENS);
390
+ const ceiling = ANTHROPIC_MODEL_MAX_OUTPUT_TOKENS[model] ?? 64e3;
391
+ return stream ? ceiling : Math.min(ceiling, ANTHROPIC_MAX_NONSTREAMING_TOKENS);
70
392
  }
71
- const ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS = /* @__PURE__ */ new Set([
72
- CLAUDE_OPUS_4_5.id,
73
- CLAUDE_OPUS_4_6.id,
74
- CLAUDE_OPUS_4_7.id,
75
- CLAUDE_OPUS_4_8.id,
76
- CLAUDE_FABLE_5.id,
77
- CLAUDE_SONNET_5.id,
78
- CLAUDE_SONNET_4_5.id,
79
- CLAUDE_SONNET_4_6.id,
80
- CLAUDE_HAIKU_4_5.id
393
+ /**
394
+ * Anthropic models that support combining `tools` + JSON-Schema-constrained
395
+ * output in a single streaming Messages request (per issue #605). GA'd
396
+ * 2026-01-29 for Claude 4.5+ via `output_format` on the beta messages
397
+ * endpoint. Older Claude models still need the forced-tool-use workaround
398
+ * in `structuredOutput`.
399
+ */
400
+ var ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS = /* @__PURE__ */ new Set([
401
+ CLAUDE_OPUS_4_5.id,
402
+ CLAUDE_OPUS_4_6.id,
403
+ CLAUDE_OPUS_4_7.id,
404
+ CLAUDE_OPUS_4_8.id,
405
+ CLAUDE_FABLE_5.id,
406
+ CLAUDE_SONNET_5.id,
407
+ CLAUDE_SONNET_4_5.id,
408
+ CLAUDE_SONNET_4_6.id,
409
+ CLAUDE_HAIKU_4_5.id
81
410
  ]);
82
- export {
83
- ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS,
84
- ANTHROPIC_DEFAULT_MAX_OUTPUT_TOKENS,
85
- ANTHROPIC_MAX_NONSTREAMING_TOKENS,
86
- ANTHROPIC_MODELS,
87
- getAnthropicDefaultMaxTokens
88
- };
89
- //# sourceMappingURL=model-meta.js.map
411
+ //#endregion
412
+ export { ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS, ANTHROPIC_DEFAULT_MAX_OUTPUT_TOKENS, ANTHROPIC_MAX_NONSTREAMING_TOKENS, ANTHROPIC_MODELS, getAnthropicDefaultMaxTokens };
413
+
414
+ //# sourceMappingURL=model-meta.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"model-meta.js","sources":["../../src/model-meta.ts"],"sourcesContent":["import type {\n AnthropicAdaptiveOnlyThinkingOptions,\n AnthropicAdaptiveOrDisabledThinkingOptions,\n AnthropicAdaptiveThinkingOptions,\n AnthropicContainerOptions,\n AnthropicContextManagementOptions,\n AnthropicMCPOptions,\n AnthropicMaxTokensOptions,\n AnthropicOutputConfigOptions,\n AnthropicSamplingOptions,\n AnthropicServiceTierOptions,\n AnthropicStopSequencesOptions,\n AnthropicThinkingOptions,\n AnthropicToolChoiceOptions,\n} from './text/text-provider-options'\n\ninterface ModelMeta<\n TProviderOptions = unknown,\n TToolCapabilities = unknown,\n TMessageCapabilities = unknown,\n> {\n name: string\n id: string\n supports: {\n input: Array<'text' | 'image' | 'audio' | 'video' | 'document'>\n extended_thinking?: boolean\n adaptive_thinking?: boolean\n priority_tier?: boolean\n tools?: Array<\n | 'web_search'\n | 'web_fetch'\n | 'code_execution'\n | 'computer_use'\n | 'bash'\n | 'text_editor'\n | 'memory'\n >\n }\n context_window?: number\n max_output_tokens?: number\n knowledge_cutoff?: string\n pricing: {\n input: {\n normal: number\n cached?: number\n }\n output: {\n normal: number\n }\n }\n /**\n * Type-level description of which provider options this model supports.\n */\n providerOptions?: TProviderOptions\n /**\n * Type-level description of which tool capabilities this model supports.\n */\n toolCapabilities?: TToolCapabilities\n /**\n * Type-level description of which message/input capabilities this model supports.\n */\n messageCapabilities?: TMessageCapabilities\n}\n\n// Claude Opus 4.6 accepts adaptive thinking alongside the deprecated\n// budget-based extended thinking, and still accepts sampling parameters.\nconst CLAUDE_OPUS_4_6 = {\n name: 'claude-opus-4-6',\n id: 'claude-opus-4-6',\n context_window: 200_000,\n max_output_tokens: 128_000,\n knowledge_cutoff: '2025-05-01',\n pricing: {\n input: {\n normal: 5,\n },\n output: {\n normal: 25,\n },\n },\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: true,\n adaptive_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n>\n\nconst CLAUDE_OPUS_4_5 = {\n name: 'claude-opus-4-5',\n id: 'claude-opus-4-5',\n context_window: 200_000,\n max_output_tokens: 32_000,\n knowledge_cutoff: '2025-11-01',\n pricing: {\n input: {\n normal: 15,\n },\n output: {\n normal: 75,\n },\n },\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n>\n\n// Claude Sonnet 4.6 accepts adaptive thinking alongside the deprecated\n// budget-based extended thinking, and still accepts sampling parameters.\nconst CLAUDE_SONNET_4_6 = {\n name: 'claude-sonnet-4-6',\n id: 'claude-sonnet-4-6',\n context_window: 1_000_000,\n max_output_tokens: 64_000,\n knowledge_cutoff: '2025-08-01',\n pricing: {\n input: {\n normal: 3,\n },\n output: {\n normal: 15,\n },\n },\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: true,\n adaptive_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n>\n\nconst CLAUDE_SONNET_4_5 = {\n name: 'claude-sonnet-4-5',\n id: 'claude-sonnet-4-5',\n context_window: 200_000,\n max_output_tokens: 64_000,\n knowledge_cutoff: '2025-09-29',\n pricing: {\n input: {\n normal: 3,\n },\n output: {\n normal: 15,\n },\n },\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n>\n\nconst CLAUDE_HAIKU_4_5 = {\n name: 'claude-haiku-4-5',\n id: 'claude-haiku-4-5',\n context_window: 200_000,\n max_output_tokens: 64_000,\n knowledge_cutoff: '2025-10-01',\n pricing: {\n input: {\n normal: 1,\n },\n output: {\n normal: 5,\n },\n },\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n>\n\nconst CLAUDE_OPUS_4_1 = {\n name: 'claude-opus-4-1',\n id: 'claude-opus-4-1',\n context_window: 200_000,\n max_output_tokens: 64_000,\n knowledge_cutoff: '2025-08-05',\n pricing: {\n input: {\n normal: 15,\n },\n output: {\n normal: 75,\n },\n },\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n>\n\n// Claude Opus 4.7 removed budget-based extended thinking and the sampling\n// parameters (`temperature`, `top_p`, `top_k`) — sending either returns a\n// 400. Use adaptive thinking with `output_config.effort` instead.\nconst CLAUDE_OPUS_4_7 = {\n name: 'claude-opus-4-7',\n id: 'claude-opus-4-7',\n context_window: 1_000_000,\n max_output_tokens: 128_000,\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: false,\n adaptive_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n pricing: {\n input: {\n normal: 5,\n cached: 0.5,\n },\n output: {\n normal: 25,\n },\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOrDisabledThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n>\n\n// Claude Opus 4.8 keeps the same request surface as Opus 4.7: adaptive\n// thinking only (budget_tokens 400s), no sampling parameters.\nconst CLAUDE_OPUS_4_8 = {\n name: 'claude-opus-4-8',\n id: 'claude-opus-4-8',\n context_window: 1_000_000,\n max_output_tokens: 128_000,\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: false,\n adaptive_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n pricing: {\n input: {\n normal: 5,\n cached: 0.5,\n },\n output: {\n normal: 25,\n },\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOrDisabledThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n>\n\n// Claude Fable 5: thinking is always on — the only accepted explicit\n// `thinking` config is `{type: 'adaptive'}` (disabled/budget_tokens 400),\n// and the sampling parameters (`temperature`, `top_p`, `top_k`) are\n// rejected. Its provider options therefore use the adaptive-only thinking\n// shape and `max_tokens` without the sampling knobs.\nconst CLAUDE_FABLE_5 = {\n name: 'claude-fable-5',\n id: 'claude-fable-5',\n context_window: 1_000_000,\n max_output_tokens: 128_000,\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: false,\n adaptive_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n pricing: {\n input: {\n normal: 10,\n cached: 1,\n },\n output: {\n normal: 50,\n },\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOnlyThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n>\n\n// Claude Sonnet 5: adaptive thinking is the default (omitting `thinking`\n// runs adaptive); `{type: 'disabled'}` opts out, but the manual\n// `{type: 'enabled', budget_tokens}` shape and non-default sampling\n// parameters (`temperature`, `top_p`, `top_k`) are rejected with a 400.\n// Pricing below is the sticker $3/$15 per MTok (an introductory $2/$10\n// applies through 2026-08-31).\nconst CLAUDE_SONNET_5 = {\n name: 'claude-sonnet-5',\n id: 'claude-sonnet-5',\n context_window: 1_000_000,\n max_output_tokens: 128_000,\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: false,\n adaptive_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n pricing: {\n input: {\n normal: 3,\n cached: 0.3,\n },\n output: {\n normal: 15,\n },\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOrDisabledThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n>\n\n/**\n * Model ids accepted by the Anthropic text adapter.\n *\n * Every id here resolves against the first-party Anthropic API\n * (`GET /v1/models/{id}`). Retired models (Claude 3.x, Sonnet 3.7,\n * Opus 4 / Sonnet 4) and the `-fast` variant ids (fast mode is requested\n * via the `speed` parameter, not a model id) were removed after Anthropic\n * turned them off.\n */\nexport const ANTHROPIC_MODELS = [\n CLAUDE_OPUS_4_6.id,\n CLAUDE_OPUS_4_5.id,\n CLAUDE_SONNET_4_6.id,\n CLAUDE_SONNET_4_5.id,\n CLAUDE_HAIKU_4_5.id,\n CLAUDE_OPUS_4_1.id,\n\n CLAUDE_OPUS_4_7.id,\n CLAUDE_OPUS_4_8.id,\n\n CLAUDE_FABLE_5.id,\n CLAUDE_SONNET_5.id,\n] as const\n\n/**\n * Fallback `max_tokens` ceiling for a model whose metadata carries no\n * `max_output_tokens` (e.g. an unrecognized model id). Anthropic's Messages\n * API *requires* `max_tokens`, so the adapter must always send a value. 64K is\n * the output ceiling of the current mainstream Claude tier (Sonnet/Haiku 4.5),\n * so it's a sane default for an unknown — almost certainly modern — model and\n * avoids silently truncating long generations (issue #849). Recognized models\n * use their exact `max_output_tokens` from {@link ANTHROPIC_MODEL_MAX_OUTPUT_TOKENS}\n * (e.g. 128K for Opus), so this fallback only ever applies to ids not in the\n * map.\n */\nexport const ANTHROPIC_DEFAULT_MAX_OUTPUT_TOKENS = 64_000\n\n/**\n * Runtime lookup of each model's maximum output-token ceiling, keyed by model\n * id. Lets the text adapter default the required `max_tokens` request field to\n * the model's real ceiling when the caller doesn't specify one, rather than a\n * low constant that truncates responses mid-stream (issue #849).\n *\n * Kept in sync with {@link ANTHROPIC_MODELS} by `scripts/sync-provider-models.ts`\n * — when that script adds a model it also inserts the model's `max_output_tokens`\n * here, so a freshly-synced model resolves to its real ceiling rather than the\n * fallback above.\n */\nconst ANTHROPIC_MODEL_MAX_OUTPUT_TOKENS: Record<string, number> = {\n [CLAUDE_OPUS_4_6.id]: CLAUDE_OPUS_4_6.max_output_tokens,\n [CLAUDE_OPUS_4_5.id]: CLAUDE_OPUS_4_5.max_output_tokens,\n [CLAUDE_SONNET_4_6.id]: CLAUDE_SONNET_4_6.max_output_tokens,\n [CLAUDE_SONNET_4_5.id]: CLAUDE_SONNET_4_5.max_output_tokens,\n [CLAUDE_HAIKU_4_5.id]: CLAUDE_HAIKU_4_5.max_output_tokens,\n [CLAUDE_OPUS_4_1.id]: CLAUDE_OPUS_4_1.max_output_tokens,\n [CLAUDE_OPUS_4_7.id]: CLAUDE_OPUS_4_7.max_output_tokens,\n [CLAUDE_OPUS_4_8.id]: CLAUDE_OPUS_4_8.max_output_tokens,\n [CLAUDE_FABLE_5.id]: CLAUDE_FABLE_5.max_output_tokens,\n [CLAUDE_SONNET_5.id]: CLAUDE_SONNET_5.max_output_tokens,\n}\n\n/**\n * Largest `max_tokens` the Anthropic SDK permits on a **non-streaming**\n * request. The SDK refuses to make a non-streaming call it estimates could\n * exceed its 10-minute timeout, computed as\n * `(60min * max_tokens) / 128_000 > 10min` — i.e. it throws\n * `\"Streaming is required for operations that may take longer than 10 minutes\"`\n * once `max_tokens > 128_000 * 10 / 60 ≈ 21_333`\n * (`@anthropic-ai/sdk`'s `calculateNonstreamingTimeout`). The text adapter's\n * only non-streaming call is the forced-tool `structuredOutput()` request, so\n * its defaulted ceiling must stay at or below this; the streaming chat path\n * keeps the model's full {@link getAnthropicDefaultMaxTokens} ceiling. We sit\n * just under the boundary (`21_333` would round-trip to exactly 10min). This\n * caps only the *default* — an explicit oversized `max_tokens` from the caller\n * still surfaces the SDK's \"use streaming\" error, which is the correct signal.\n */\nexport const ANTHROPIC_MAX_NONSTREAMING_TOKENS = 21_000\n\n/**\n * Resolve the default `max_tokens` for a model: its known `max_output_tokens`\n * ceiling, or {@link ANTHROPIC_DEFAULT_MAX_OUTPUT_TOKENS} for unknown models.\n * Callers that pass an explicit `max_tokens` bypass this entirely.\n *\n * Pass `stream: false` for non-streaming requests (the `structuredOutput()`\n * path): the result is then clamped to {@link ANTHROPIC_MAX_NONSTREAMING_TOKENS}\n * so the defaulted ceiling doesn't trip the SDK's non-streaming 10-minute guard\n * (issue #849). Streaming requests (the default) are unaffected and get the\n * model's full ceiling.\n */\nexport function getAnthropicDefaultMaxTokens(\n model: string,\n { stream = true }: { stream?: boolean } = {},\n): number {\n const ceiling =\n ANTHROPIC_MODEL_MAX_OUTPUT_TOKENS[model] ??\n ANTHROPIC_DEFAULT_MAX_OUTPUT_TOKENS\n return stream ? ceiling : Math.min(ceiling, ANTHROPIC_MAX_NONSTREAMING_TOKENS)\n}\n\n/**\n * Anthropic models that support combining `tools` + JSON-Schema-constrained\n * output in a single streaming Messages request (per issue #605). GA'd\n * 2026-01-29 for Claude 4.5+ via `output_format` on the beta messages\n * endpoint. Older Claude models still need the forced-tool-use workaround\n * in `structuredOutput`.\n */\nexport const ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS = new Set<string>([\n CLAUDE_OPUS_4_5.id,\n CLAUDE_OPUS_4_6.id,\n CLAUDE_OPUS_4_7.id,\n CLAUDE_OPUS_4_8.id,\n CLAUDE_FABLE_5.id,\n CLAUDE_SONNET_5.id,\n CLAUDE_SONNET_4_5.id,\n CLAUDE_SONNET_4_6.id,\n CLAUDE_HAIKU_4_5.id,\n])\n\n// const ANTHROPIC_IMAGE_MODELS = [] as const\n// const ANTHROPIC_EMBEDDING_MODELS = [] as const\n// const ANTHROPIC_AUDIO_MODELS = [] as const\n// const ANTHROPIC_VIDEO_MODELS = [] as const\n\nexport type AnthropicChatModel = (typeof ANTHROPIC_MODELS)[number]\n// Manual type map for per-model provider options\n// Models are differentiated by which thinking shapes and sampling\n// parameters the API accepts.\nexport type AnthropicChatModelProviderOptionsByName = {\n // 4.6 generation: adaptive thinking plus the deprecated budget-based\n // shape; sampling parameters still accepted.\n [CLAUDE_OPUS_4_6.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_SONNET_4_6.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n\n // Pre-4.6 models: budget-based extended thinking and sampling parameters.\n [CLAUDE_OPUS_4_5.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_SONNET_4_5.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_HAIKU_4_5.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_OPUS_4_1.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n\n // Opus 4.7/4.8: adaptive thinking (or explicit disable), no\n // budget_tokens, no sampling parameters — see the constants above.\n [CLAUDE_OPUS_4_7.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOrDisabledThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n [CLAUDE_OPUS_4_8.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOrDisabledThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n\n // Claude Fable 5: thinking always on (adaptive-only config); sampling\n // parameters removed — see the CLAUDE_FABLE_5 constant above.\n [CLAUDE_FABLE_5.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOnlyThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n // Claude Sonnet 5: adaptive thinking by default, explicit disable\n // allowed; no budget_tokens, no sampling parameters — see the\n // CLAUDE_SONNET_5 constant above.\n [CLAUDE_SONNET_5.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOrDisabledThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n}\n\nexport type AnthropicChatModelToolCapabilitiesByName = {\n [CLAUDE_OPUS_4_6.id]: typeof CLAUDE_OPUS_4_6.supports.tools\n [CLAUDE_OPUS_4_5.id]: typeof CLAUDE_OPUS_4_5.supports.tools\n [CLAUDE_SONNET_4_6.id]: typeof CLAUDE_SONNET_4_6.supports.tools\n [CLAUDE_SONNET_4_5.id]: typeof CLAUDE_SONNET_4_5.supports.tools\n [CLAUDE_HAIKU_4_5.id]: typeof CLAUDE_HAIKU_4_5.supports.tools\n [CLAUDE_OPUS_4_1.id]: typeof CLAUDE_OPUS_4_1.supports.tools\n [CLAUDE_OPUS_4_7.id]: typeof CLAUDE_OPUS_4_7.supports.tools\n [CLAUDE_OPUS_4_8.id]: typeof CLAUDE_OPUS_4_8.supports.tools\n [CLAUDE_FABLE_5.id]: typeof CLAUDE_FABLE_5.supports.tools\n [CLAUDE_SONNET_5.id]: typeof CLAUDE_SONNET_5.supports.tools\n}\n\n/**\n * Type-only map from chat model name to its supported input modalities.\n * All Anthropic Claude models support text, image, and document (PDF) input.\n * Used by the core AI types to constrain ContentPart types based on the selected model.\n * Note: These must be inlined as readonly arrays (not typeof) because the model\n * constants are not exported and typeof references don't work in .d.ts files\n * when consumed by external packages.\n *\n * @see https://docs.anthropic.com/claude/docs/vision\n * @see https://docs.anthropic.com/claude/docs/pdf-support\n */\nexport type AnthropicModelInputModalitiesByName = {\n [CLAUDE_OPUS_4_6.id]: typeof CLAUDE_OPUS_4_6.supports.input\n [CLAUDE_OPUS_4_5.id]: typeof CLAUDE_OPUS_4_5.supports.input\n [CLAUDE_SONNET_4_6.id]: typeof CLAUDE_SONNET_4_6.supports.input\n [CLAUDE_SONNET_4_5.id]: typeof CLAUDE_SONNET_4_5.supports.input\n [CLAUDE_HAIKU_4_5.id]: typeof CLAUDE_HAIKU_4_5.supports.input\n [CLAUDE_OPUS_4_1.id]: typeof CLAUDE_OPUS_4_1.supports.input\n [CLAUDE_OPUS_4_7.id]: typeof CLAUDE_OPUS_4_7.supports.input\n [CLAUDE_OPUS_4_8.id]: typeof CLAUDE_OPUS_4_8.supports.input\n [CLAUDE_FABLE_5.id]: typeof CLAUDE_FABLE_5.supports.input\n [CLAUDE_SONNET_5.id]: typeof CLAUDE_SONNET_5.supports.input\n}\n"],"names":[],"mappings":"AAkEA,MAAM,kBAAkB;AAAA,EAEtB,IAAI;AAAA,EAEJ,mBAAmB;AAyBrB;AAWA,MAAM,kBAAkB;AAAA,EAEtB,IAAI;AAAA,EAEJ,mBAAmB;AAwBrB;AAaA,MAAM,oBAAoB;AAAA,EAExB,IAAI;AAAA,EAEJ,mBAAmB;AAyBrB;AAWA,MAAM,oBAAoB;AAAA,EAExB,IAAI;AAAA,EAEJ,mBAAmB;AAwBrB;AAWA,MAAM,mBAAmB;AAAA,EAEvB,IAAI;AAAA,EAEJ,mBAAmB;AAwBrB;AAWA,MAAM,kBAAkB;AAAA,EAEtB,IAAI;AAAA,EAEJ,mBAAmB;AAwBrB;AAcA,MAAM,kBAAkB;AAAA,EAEtB,IAAI;AAAA,EAEJ,mBAAmB;AAyBrB;AAcA,MAAM,kBAAkB;AAAA,EAEtB,IAAI;AAAA,EAEJ,mBAAmB;AAyBrB;AAiBA,MAAM,iBAAiB;AAAA,EAErB,IAAI;AAAA,EAEJ,mBAAmB;AAyBrB;AAkBA,MAAM,kBAAkB;AAAA,EAEtB,IAAI;AAAA,EAEJ,mBAAmB;AAyBrB;AAqBO,MAAM,mBAAmB;AAAA,EAC9B,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAEhB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAEhB,eAAe;AAAA,EACf,gBAAgB;AAClB;AAaO,MAAM,sCAAsC;AAanD,MAAM,oCAA4D;AAAA,EAChE,CAAC,gBAAgB,EAAE,GAAG,gBAAgB;AAAA,EACtC,CAAC,gBAAgB,EAAE,GAAG,gBAAgB;AAAA,EACtC,CAAC,kBAAkB,EAAE,GAAG,kBAAkB;AAAA,EAC1C,CAAC,kBAAkB,EAAE,GAAG,kBAAkB;AAAA,EAC1C,CAAC,iBAAiB,EAAE,GAAG,iBAAiB;AAAA,EACxC,CAAC,gBAAgB,EAAE,GAAG,gBAAgB;AAAA,EACtC,CAAC,gBAAgB,EAAE,GAAG,gBAAgB;AAAA,EACtC,CAAC,gBAAgB,EAAE,GAAG,gBAAgB;AAAA,EACtC,CAAC,eAAe,EAAE,GAAG,eAAe;AAAA,EACpC,CAAC,gBAAgB,EAAE,GAAG,gBAAgB;AACxC;AAiBO,MAAM,oCAAoC;AAa1C,SAAS,6BACd,OACA,EAAE,SAAS,KAAA,IAA+B,CAAA,GAClC;AACR,QAAM,UACJ,kCAAkC,KAAK,KACvC;AACF,SAAO,SAAS,UAAU,KAAK,IAAI,SAAS,iCAAiC;AAC/E;AASO,MAAM,iEAAiD,IAAY;AAAA,EACxE,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,iBAAiB;AACnB,CAAC;"}
1
+ {"version":3,"file":"model-meta.js","names":[],"sources":["../../src/model-meta.ts"],"sourcesContent":["import type {\n AnthropicAdaptiveOnlyThinkingOptions,\n AnthropicAdaptiveOrDisabledThinkingOptions,\n AnthropicAdaptiveThinkingOptions,\n AnthropicContainerOptions,\n AnthropicContextManagementOptions,\n AnthropicMCPOptions,\n AnthropicMaxTokensOptions,\n AnthropicOutputConfigOptions,\n AnthropicSamplingOptions,\n AnthropicServiceTierOptions,\n AnthropicStopSequencesOptions,\n AnthropicThinkingOptions,\n AnthropicToolChoiceOptions,\n} from './text/text-provider-options'\n\ninterface ModelMeta<\n TProviderOptions = unknown,\n TToolCapabilities = unknown,\n TMessageCapabilities = unknown,\n> {\n name: string\n id: string\n supports: {\n input: Array<'text' | 'image' | 'audio' | 'video' | 'document'>\n extended_thinking?: boolean\n adaptive_thinking?: boolean\n priority_tier?: boolean\n tools?: Array<\n | 'web_search'\n | 'web_fetch'\n | 'code_execution'\n | 'computer_use'\n | 'bash'\n | 'text_editor'\n | 'memory'\n >\n }\n context_window?: number\n max_output_tokens?: number\n knowledge_cutoff?: string\n pricing: {\n input: {\n normal: number\n cached?: number\n }\n output: {\n normal: number\n }\n }\n /**\n * Type-level description of which provider options this model supports.\n */\n providerOptions?: TProviderOptions\n /**\n * Type-level description of which tool capabilities this model supports.\n */\n toolCapabilities?: TToolCapabilities\n /**\n * Type-level description of which message/input capabilities this model supports.\n */\n messageCapabilities?: TMessageCapabilities\n}\n\n// Claude Opus 4.6 accepts adaptive thinking alongside the deprecated\n// budget-based extended thinking, and still accepts sampling parameters.\nconst CLAUDE_OPUS_4_6 = {\n name: 'claude-opus-4-6',\n id: 'claude-opus-4-6',\n context_window: 200_000,\n max_output_tokens: 128_000,\n knowledge_cutoff: '2025-05-01',\n pricing: {\n input: {\n normal: 5,\n },\n output: {\n normal: 25,\n },\n },\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: true,\n adaptive_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n>\n\nconst CLAUDE_OPUS_4_5 = {\n name: 'claude-opus-4-5',\n id: 'claude-opus-4-5',\n context_window: 200_000,\n max_output_tokens: 32_000,\n knowledge_cutoff: '2025-11-01',\n pricing: {\n input: {\n normal: 15,\n },\n output: {\n normal: 75,\n },\n },\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n>\n\n// Claude Sonnet 4.6 accepts adaptive thinking alongside the deprecated\n// budget-based extended thinking, and still accepts sampling parameters.\nconst CLAUDE_SONNET_4_6 = {\n name: 'claude-sonnet-4-6',\n id: 'claude-sonnet-4-6',\n context_window: 1_000_000,\n max_output_tokens: 64_000,\n knowledge_cutoff: '2025-08-01',\n pricing: {\n input: {\n normal: 3,\n },\n output: {\n normal: 15,\n },\n },\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: true,\n adaptive_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n>\n\nconst CLAUDE_SONNET_4_5 = {\n name: 'claude-sonnet-4-5',\n id: 'claude-sonnet-4-5',\n context_window: 200_000,\n max_output_tokens: 64_000,\n knowledge_cutoff: '2025-09-29',\n pricing: {\n input: {\n normal: 3,\n },\n output: {\n normal: 15,\n },\n },\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n>\n\nconst CLAUDE_HAIKU_4_5 = {\n name: 'claude-haiku-4-5',\n id: 'claude-haiku-4-5',\n context_window: 200_000,\n max_output_tokens: 64_000,\n knowledge_cutoff: '2025-10-01',\n pricing: {\n input: {\n normal: 1,\n },\n output: {\n normal: 5,\n },\n },\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n>\n\nconst CLAUDE_OPUS_4_1 = {\n name: 'claude-opus-4-1',\n id: 'claude-opus-4-1',\n context_window: 200_000,\n max_output_tokens: 64_000,\n knowledge_cutoff: '2025-08-05',\n pricing: {\n input: {\n normal: 15,\n },\n output: {\n normal: 75,\n },\n },\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n>\n\n// Claude Opus 4.7 removed budget-based extended thinking and the sampling\n// parameters (`temperature`, `top_p`, `top_k`) — sending either returns a\n// 400. Use adaptive thinking with `output_config.effort` instead.\nconst CLAUDE_OPUS_4_7 = {\n name: 'claude-opus-4-7',\n id: 'claude-opus-4-7',\n context_window: 1_000_000,\n max_output_tokens: 128_000,\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: false,\n adaptive_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n pricing: {\n input: {\n normal: 5,\n cached: 0.5,\n },\n output: {\n normal: 25,\n },\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOrDisabledThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n>\n\n// Claude Opus 4.8 keeps the same request surface as Opus 4.7: adaptive\n// thinking only (budget_tokens 400s), no sampling parameters.\nconst CLAUDE_OPUS_4_8 = {\n name: 'claude-opus-4-8',\n id: 'claude-opus-4-8',\n context_window: 1_000_000,\n max_output_tokens: 128_000,\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: false,\n adaptive_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n pricing: {\n input: {\n normal: 5,\n cached: 0.5,\n },\n output: {\n normal: 25,\n },\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOrDisabledThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n>\n\n// Claude Fable 5: thinking is always on — the only accepted explicit\n// `thinking` config is `{type: 'adaptive'}` (disabled/budget_tokens 400),\n// and the sampling parameters (`temperature`, `top_p`, `top_k`) are\n// rejected. Its provider options therefore use the adaptive-only thinking\n// shape and `max_tokens` without the sampling knobs.\nconst CLAUDE_FABLE_5 = {\n name: 'claude-fable-5',\n id: 'claude-fable-5',\n context_window: 1_000_000,\n max_output_tokens: 128_000,\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: false,\n adaptive_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n pricing: {\n input: {\n normal: 10,\n cached: 1,\n },\n output: {\n normal: 50,\n },\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOnlyThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n>\n\n// Claude Sonnet 5: adaptive thinking is the default (omitting `thinking`\n// runs adaptive); `{type: 'disabled'}` opts out, but the manual\n// `{type: 'enabled', budget_tokens}` shape and non-default sampling\n// parameters (`temperature`, `top_p`, `top_k`) are rejected with a 400.\n// Pricing below is the sticker $3/$15 per MTok (an introductory $2/$10\n// applies through 2026-08-31).\nconst CLAUDE_SONNET_5 = {\n name: 'claude-sonnet-5',\n id: 'claude-sonnet-5',\n context_window: 1_000_000,\n max_output_tokens: 128_000,\n supports: {\n input: ['text', 'image', 'document'],\n extended_thinking: false,\n adaptive_thinking: true,\n priority_tier: true,\n tools: [\n 'web_search',\n 'web_fetch',\n 'code_execution',\n 'computer_use',\n 'bash',\n 'text_editor',\n 'memory',\n ],\n },\n pricing: {\n input: {\n normal: 3,\n cached: 0.3,\n },\n output: {\n normal: 15,\n },\n },\n} as const satisfies ModelMeta<\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOrDisabledThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n>\n\n/**\n * Model ids accepted by the Anthropic text adapter.\n *\n * Every id here resolves against the first-party Anthropic API\n * (`GET /v1/models/{id}`). Retired models (Claude 3.x, Sonnet 3.7,\n * Opus 4 / Sonnet 4) and the `-fast` variant ids (fast mode is requested\n * via the `speed` parameter, not a model id) were removed after Anthropic\n * turned them off.\n */\nexport const ANTHROPIC_MODELS = [\n CLAUDE_OPUS_4_6.id,\n CLAUDE_OPUS_4_5.id,\n CLAUDE_SONNET_4_6.id,\n CLAUDE_SONNET_4_5.id,\n CLAUDE_HAIKU_4_5.id,\n CLAUDE_OPUS_4_1.id,\n\n CLAUDE_OPUS_4_7.id,\n CLAUDE_OPUS_4_8.id,\n\n CLAUDE_FABLE_5.id,\n CLAUDE_SONNET_5.id,\n] as const\n\n/**\n * Fallback `max_tokens` ceiling for a model whose metadata carries no\n * `max_output_tokens` (e.g. an unrecognized model id). Anthropic's Messages\n * API *requires* `max_tokens`, so the adapter must always send a value. 64K is\n * the output ceiling of the current mainstream Claude tier (Sonnet/Haiku 4.5),\n * so it's a sane default for an unknown — almost certainly modern — model and\n * avoids silently truncating long generations (issue #849). Recognized models\n * use their exact `max_output_tokens` from {@link ANTHROPIC_MODEL_MAX_OUTPUT_TOKENS}\n * (e.g. 128K for Opus), so this fallback only ever applies to ids not in the\n * map.\n */\nexport const ANTHROPIC_DEFAULT_MAX_OUTPUT_TOKENS = 64_000\n\n/**\n * Runtime lookup of each model's maximum output-token ceiling, keyed by model\n * id. Lets the text adapter default the required `max_tokens` request field to\n * the model's real ceiling when the caller doesn't specify one, rather than a\n * low constant that truncates responses mid-stream (issue #849).\n *\n * Kept in sync with {@link ANTHROPIC_MODELS} by `scripts/sync-provider-models.ts`\n * — when that script adds a model it also inserts the model's `max_output_tokens`\n * here, so a freshly-synced model resolves to its real ceiling rather than the\n * fallback above.\n */\nconst ANTHROPIC_MODEL_MAX_OUTPUT_TOKENS: Record<string, number> = {\n [CLAUDE_OPUS_4_6.id]: CLAUDE_OPUS_4_6.max_output_tokens,\n [CLAUDE_OPUS_4_5.id]: CLAUDE_OPUS_4_5.max_output_tokens,\n [CLAUDE_SONNET_4_6.id]: CLAUDE_SONNET_4_6.max_output_tokens,\n [CLAUDE_SONNET_4_5.id]: CLAUDE_SONNET_4_5.max_output_tokens,\n [CLAUDE_HAIKU_4_5.id]: CLAUDE_HAIKU_4_5.max_output_tokens,\n [CLAUDE_OPUS_4_1.id]: CLAUDE_OPUS_4_1.max_output_tokens,\n [CLAUDE_OPUS_4_7.id]: CLAUDE_OPUS_4_7.max_output_tokens,\n [CLAUDE_OPUS_4_8.id]: CLAUDE_OPUS_4_8.max_output_tokens,\n [CLAUDE_FABLE_5.id]: CLAUDE_FABLE_5.max_output_tokens,\n [CLAUDE_SONNET_5.id]: CLAUDE_SONNET_5.max_output_tokens,\n}\n\n/**\n * Largest `max_tokens` the Anthropic SDK permits on a **non-streaming**\n * request. The SDK refuses to make a non-streaming call it estimates could\n * exceed its 10-minute timeout, computed as\n * `(60min * max_tokens) / 128_000 > 10min` — i.e. it throws\n * `\"Streaming is required for operations that may take longer than 10 minutes\"`\n * once `max_tokens > 128_000 * 10 / 60 ≈ 21_333`\n * (`@anthropic-ai/sdk`'s `calculateNonstreamingTimeout`). The text adapter's\n * only non-streaming call is the forced-tool `structuredOutput()` request, so\n * its defaulted ceiling must stay at or below this; the streaming chat path\n * keeps the model's full {@link getAnthropicDefaultMaxTokens} ceiling. We sit\n * just under the boundary (`21_333` would round-trip to exactly 10min). This\n * caps only the *default* — an explicit oversized `max_tokens` from the caller\n * still surfaces the SDK's \"use streaming\" error, which is the correct signal.\n */\nexport const ANTHROPIC_MAX_NONSTREAMING_TOKENS = 21_000\n\n/**\n * Resolve the default `max_tokens` for a model: its known `max_output_tokens`\n * ceiling, or {@link ANTHROPIC_DEFAULT_MAX_OUTPUT_TOKENS} for unknown models.\n * Callers that pass an explicit `max_tokens` bypass this entirely.\n *\n * Pass `stream: false` for non-streaming requests (the `structuredOutput()`\n * path): the result is then clamped to {@link ANTHROPIC_MAX_NONSTREAMING_TOKENS}\n * so the defaulted ceiling doesn't trip the SDK's non-streaming 10-minute guard\n * (issue #849). Streaming requests (the default) are unaffected and get the\n * model's full ceiling.\n */\nexport function getAnthropicDefaultMaxTokens(\n model: string,\n { stream = true }: { stream?: boolean } = {},\n): number {\n const ceiling =\n ANTHROPIC_MODEL_MAX_OUTPUT_TOKENS[model] ??\n ANTHROPIC_DEFAULT_MAX_OUTPUT_TOKENS\n return stream ? ceiling : Math.min(ceiling, ANTHROPIC_MAX_NONSTREAMING_TOKENS)\n}\n\n/**\n * Anthropic models that support combining `tools` + JSON-Schema-constrained\n * output in a single streaming Messages request (per issue #605). GA'd\n * 2026-01-29 for Claude 4.5+ via `output_format` on the beta messages\n * endpoint. Older Claude models still need the forced-tool-use workaround\n * in `structuredOutput`.\n */\nexport const ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS = new Set<string>([\n CLAUDE_OPUS_4_5.id,\n CLAUDE_OPUS_4_6.id,\n CLAUDE_OPUS_4_7.id,\n CLAUDE_OPUS_4_8.id,\n CLAUDE_FABLE_5.id,\n CLAUDE_SONNET_5.id,\n CLAUDE_SONNET_4_5.id,\n CLAUDE_SONNET_4_6.id,\n CLAUDE_HAIKU_4_5.id,\n])\n\n// const ANTHROPIC_IMAGE_MODELS = [] as const\n// const ANTHROPIC_EMBEDDING_MODELS = [] as const\n// const ANTHROPIC_AUDIO_MODELS = [] as const\n// const ANTHROPIC_VIDEO_MODELS = [] as const\n\nexport type AnthropicChatModel = (typeof ANTHROPIC_MODELS)[number]\n// Manual type map for per-model provider options\n// Models are differentiated by which thinking shapes and sampling\n// parameters the API accepts.\nexport type AnthropicChatModelProviderOptionsByName = {\n // 4.6 generation: adaptive thinking plus the deprecated budget-based\n // shape; sampling parameters still accepted.\n [CLAUDE_OPUS_4_6.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_SONNET_4_6.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n\n // Pre-4.6 models: budget-based extended thinking and sampling parameters.\n [CLAUDE_OPUS_4_5.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_SONNET_4_5.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_HAIKU_4_5.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_OPUS_4_1.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n\n // Opus 4.7/4.8: adaptive thinking (or explicit disable), no\n // budget_tokens, no sampling parameters — see the constants above.\n [CLAUDE_OPUS_4_7.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOrDisabledThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n [CLAUDE_OPUS_4_8.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOrDisabledThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n\n // Claude Fable 5: thinking always on (adaptive-only config); sampling\n // parameters removed — see the CLAUDE_FABLE_5 constant above.\n [CLAUDE_FABLE_5.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOnlyThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n // Claude Sonnet 5: adaptive thinking by default, explicit disable\n // allowed; no budget_tokens, no sampling parameters — see the\n // CLAUDE_SONNET_5 constant above.\n [CLAUDE_SONNET_5.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOrDisabledThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n}\n\nexport type AnthropicChatModelToolCapabilitiesByName = {\n [CLAUDE_OPUS_4_6.id]: typeof CLAUDE_OPUS_4_6.supports.tools\n [CLAUDE_OPUS_4_5.id]: typeof CLAUDE_OPUS_4_5.supports.tools\n [CLAUDE_SONNET_4_6.id]: typeof CLAUDE_SONNET_4_6.supports.tools\n [CLAUDE_SONNET_4_5.id]: typeof CLAUDE_SONNET_4_5.supports.tools\n [CLAUDE_HAIKU_4_5.id]: typeof CLAUDE_HAIKU_4_5.supports.tools\n [CLAUDE_OPUS_4_1.id]: typeof CLAUDE_OPUS_4_1.supports.tools\n [CLAUDE_OPUS_4_7.id]: typeof CLAUDE_OPUS_4_7.supports.tools\n [CLAUDE_OPUS_4_8.id]: typeof CLAUDE_OPUS_4_8.supports.tools\n [CLAUDE_FABLE_5.id]: typeof CLAUDE_FABLE_5.supports.tools\n [CLAUDE_SONNET_5.id]: typeof CLAUDE_SONNET_5.supports.tools\n}\n\n/**\n * Type-only map from chat model name to its supported input modalities.\n * All Anthropic Claude models support text, image, and document (PDF) input.\n * Used by the core AI types to constrain ContentPart types based on the selected model.\n * Note: These must be inlined as readonly arrays (not typeof) because the model\n * constants are not exported and typeof references don't work in .d.ts files\n * when consumed by external packages.\n *\n * @see https://docs.anthropic.com/claude/docs/vision\n * @see https://docs.anthropic.com/claude/docs/pdf-support\n */\nexport type AnthropicModelInputModalitiesByName = {\n [CLAUDE_OPUS_4_6.id]: typeof CLAUDE_OPUS_4_6.supports.input\n [CLAUDE_OPUS_4_5.id]: typeof CLAUDE_OPUS_4_5.supports.input\n [CLAUDE_SONNET_4_6.id]: typeof CLAUDE_SONNET_4_6.supports.input\n [CLAUDE_SONNET_4_5.id]: typeof CLAUDE_SONNET_4_5.supports.input\n [CLAUDE_HAIKU_4_5.id]: typeof CLAUDE_HAIKU_4_5.supports.input\n [CLAUDE_OPUS_4_1.id]: typeof CLAUDE_OPUS_4_1.supports.input\n [CLAUDE_OPUS_4_7.id]: typeof CLAUDE_OPUS_4_7.supports.input\n [CLAUDE_OPUS_4_8.id]: typeof CLAUDE_OPUS_4_8.supports.input\n [CLAUDE_FABLE_5.id]: typeof CLAUDE_FABLE_5.supports.input\n [CLAUDE_SONNET_5.id]: typeof CLAUDE_SONNET_5.supports.input\n}\n"],"mappings":"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"}
@@ -1,30 +1,23 @@
1
- const validateTopPandTemperature = (options) => {
2
- if (options.top_p !== void 0 && options.temperature !== void 0) {
3
- throw new Error("You should either set top_p or temperature, but not both.");
4
- }
1
+ //#region src/text/text-provider-options.ts
2
+ var validateTopPandTemperature = (options) => {
3
+ if (options.top_p !== void 0 && options.temperature !== void 0) throw new Error("You should either set top_p or temperature, but not both.");
5
4
  };
6
- const validateThinking = (options) => {
7
- const thinking = options.thinking;
8
- if (thinking && thinking.type === "enabled") {
9
- if (thinking.budget_tokens < 1024) {
10
- throw new Error("thinking.budget_tokens must be at least 1024.");
11
- }
12
- if (thinking.budget_tokens >= options.max_tokens) {
13
- throw new Error("thinking.budget_tokens must be less than max_tokens.");
14
- }
15
- }
5
+ var validateThinking = (options) => {
6
+ const thinking = options.thinking;
7
+ if (thinking && thinking.type === "enabled") {
8
+ if (thinking.budget_tokens < 1024) throw new Error("thinking.budget_tokens must be at least 1024.");
9
+ if (thinking.budget_tokens >= options.max_tokens) throw new Error("thinking.budget_tokens must be less than max_tokens.");
10
+ }
16
11
  };
17
- const validateMaxTokens = (options) => {
18
- if (options.max_tokens < 1) {
19
- throw new Error("max_tokens must be at least 1.");
20
- }
12
+ var validateMaxTokens = (options) => {
13
+ if (options.max_tokens < 1) throw new Error("max_tokens must be at least 1.");
21
14
  };
22
- const validateTextProviderOptions = (options) => {
23
- validateTopPandTemperature(options);
24
- validateThinking(options);
25
- validateMaxTokens(options);
15
+ var validateTextProviderOptions = (options) => {
16
+ validateTopPandTemperature(options);
17
+ validateThinking(options);
18
+ validateMaxTokens(options);
26
19
  };
27
- export {
28
- validateTextProviderOptions
29
- };
30
- //# sourceMappingURL=text-provider-options.js.map
20
+ //#endregion
21
+ export { validateTextProviderOptions };
22
+
23
+ //# sourceMappingURL=text-provider-options.js.map