@tanstack/ai-anthropic 0.18.10 → 0.18.13

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.
package/README.md ADDED
@@ -0,0 +1,213 @@
1
+ <div align="center">
2
+ <picture>
3
+ <source
4
+ media="(prefers-color-scheme: dark)"
5
+ srcset="https://tanstack.com/api/readme/ai.png?theme=dark"
6
+ />
7
+ <source
8
+ media="(prefers-color-scheme: light)"
9
+ srcset="https://tanstack.com/api/readme/ai.png"
10
+ />
11
+ <img
12
+ src="https://tanstack.com/api/readme/ai.png"
13
+ alt="TanStack AI"
14
+ width="900"
15
+ />
16
+ </picture>
17
+ </div>
18
+
19
+ <br />
20
+
21
+ # @tanstack/ai-anthropic
22
+
23
+ Anthropic Claude adapter for TanStack AI chat, tool calling, thinking, and structured outputs
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ npm install @tanstack/ai-anthropic
29
+ # or
30
+ pnpm add @tanstack/ai-anthropic
31
+ # or
32
+ yarn add @tanstack/ai-anthropic
33
+ ```
34
+
35
+ ## Setup
36
+
37
+ Set your API key as an environment variable:
38
+
39
+ ```bash
40
+ export ANTHROPIC_API_KEY="sk-ant-..."
41
+ ```
42
+
43
+ ## Usage
44
+
45
+ ### Text/Chat Adapter
46
+
47
+ ```typescript
48
+ import { chat } from '@tanstack/ai'
49
+ import { anthropicText } from '@tanstack/ai-anthropic'
50
+
51
+ const stream = chat({
52
+ adapter: anthropicText('claude-sonnet-4-6'),
53
+ messages: [{ role: 'user', content: 'Hello!' }],
54
+ })
55
+ ```
56
+
57
+ ### With Explicit API Key
58
+
59
+ ```typescript
60
+ import { createAnthropicChat } from '@tanstack/ai-anthropic'
61
+
62
+ const adapter = createAnthropicChat(
63
+ 'claude-sonnet-4-6',
64
+ process.env.ANTHROPIC_API_KEY!,
65
+ {
66
+ baseURL: 'https://api.anthropic.com', // optional, for custom endpoints
67
+ },
68
+ )
69
+ ```
70
+
71
+ ### With Tools
72
+
73
+ ```typescript
74
+ import { chat, toServerSentEventsResponse, toolDefinition } from '@tanstack/ai'
75
+ import { anthropicText } from '@tanstack/ai-anthropic'
76
+ import { z } from 'zod'
77
+
78
+ const searchDatabase = toolDefinition({
79
+ name: 'search_database',
80
+ description: 'Search the database',
81
+ inputSchema: z.object({ query: z.string() }),
82
+ }).server(async ({ query }) => {
83
+ return { results: [] }
84
+ })
85
+
86
+ export async function POST(request: Request) {
87
+ const { messages } = await request.json()
88
+
89
+ const stream = chat({
90
+ adapter: anthropicText('claude-sonnet-4-6'),
91
+ messages,
92
+ tools: [searchDatabase],
93
+ })
94
+
95
+ return toServerSentEventsResponse(stream)
96
+ }
97
+ ```
98
+
99
+ ### Thinking
100
+
101
+ Newer Claude models use adaptive thinking — the model decides when and how much to think, and depth is tuned with `output_config.effort`:
102
+
103
+ ```typescript
104
+ const stream = chat({
105
+ adapter: anthropicText('claude-sonnet-5'),
106
+ messages: [{ role: 'user', content: 'Plan a database migration.' }],
107
+ modelOptions: {
108
+ thinking: { type: 'adaptive', display: 'summarized' },
109
+ output_config: { effort: 'xhigh' },
110
+ max_tokens: 64_000,
111
+ },
112
+ })
113
+ ```
114
+
115
+ Claude 4.6 models also accept the manual `{ type: 'enabled', budget_tokens }` shape; `budget_tokens` must be less than `max_tokens`. Which shapes and sampling parameters each model accepts is enforced by the adapter's types — see the docs for the per-model rules.
116
+
117
+ ### Prompt Caching
118
+
119
+ Mark a content part with `cache_control` to cache it:
120
+
121
+ ```typescript
122
+ const stream = chat({
123
+ adapter: anthropicText('claude-sonnet-4-6'),
124
+ messages: [
125
+ {
126
+ role: 'user',
127
+ content: [
128
+ {
129
+ type: 'text',
130
+ content: 'What is the capital of France?',
131
+ metadata: { cache_control: { type: 'ephemeral' } },
132
+ },
133
+ ],
134
+ },
135
+ ],
136
+ })
137
+ ```
138
+
139
+ ### Summarization
140
+
141
+ ```typescript
142
+ import { summarize } from '@tanstack/ai'
143
+ import { anthropicSummarize } from '@tanstack/ai-anthropic'
144
+
145
+ const result = await summarize({
146
+ adapter: anthropicSummarize('claude-sonnet-4-6'),
147
+ text: 'Your long text to summarize...',
148
+ maxLength: 100,
149
+ style: 'concise', // "concise" | "bullet-points" | "paragraph"
150
+ })
151
+
152
+ console.log(result.summary)
153
+ ```
154
+
155
+ ### Provider Tools
156
+
157
+ Anthropic's native tools live on `@tanstack/ai-anthropic/tools` and go into `chat({ tools })` alongside your own: `webSearchTool`, `webFetchTool`, `codeExecutionTool`, `computerUseTool`, `bashTool`, `textEditorTool`, `memoryTool`, and `customTool`.
158
+
159
+ ```typescript
160
+ import { chat } from '@tanstack/ai'
161
+ import { anthropicText } from '@tanstack/ai-anthropic'
162
+ import { webSearchTool } from '@tanstack/ai-anthropic/tools'
163
+
164
+ const stream = chat({
165
+ adapter: anthropicText('claude-opus-4-7'),
166
+ messages: [{ role: 'user', content: "What's new in AI this week?" }],
167
+ tools: [
168
+ webSearchTool({
169
+ name: 'web_search',
170
+ type: 'web_search_20250305',
171
+ max_uses: 2,
172
+ }),
173
+ ],
174
+ })
175
+ ```
176
+
177
+ ### Claude on Vertex AI
178
+
179
+ Install `@anthropic-ai/vertex-sdk` next to this package and import from `@tanstack/ai-anthropic/vertex`:
180
+
181
+ ```typescript
182
+ import { chat } from '@tanstack/ai'
183
+ import { anthropicVertexText } from '@tanstack/ai-anthropic/vertex'
184
+
185
+ const stream = chat({
186
+ adapter: anthropicVertexText('claude-sonnet-5', {
187
+ project: 'my-project',
188
+ location: 'europe-west1',
189
+ }),
190
+ messages: [{ role: 'user', content: 'Hello!' }],
191
+ })
192
+ ```
193
+
194
+ `location` is required (on the factory or via `GOOGLE_CLOUD_LOCATION`, `GOOGLE_VERTEX_LOCATION`, or `CLOUD_ML_REGION`); `project` can come from Application Default Credentials. Only the Claude models in the Vertex catalog are accepted.
195
+
196
+ ## Features
197
+
198
+ - ✅ Streaming chat
199
+ - ✅ Function/tool calling and Anthropic's native provider tools
200
+ - ✅ Extended and adaptive thinking
201
+ - ✅ Structured output
202
+ - ✅ Prompt caching
203
+ - ✅ Summarization (`anthropicSummarize`)
204
+ - ✅ Claude on Vertex AI (`@tanstack/ai-anthropic/vertex`)
205
+
206
+ ## Documentation
207
+
208
+ - [Anthropic adapter](https://tanstack.com/ai/latest/docs/adapters/anthropic): configuration, per-model thinking rules, every provider tool, and the API reference
209
+ - [Provider Tools](https://tanstack.com/ai/latest/docs/tools/provider-tools): the concept, comparison matrix, and which models support which tools
210
+
211
+ ## License
212
+
213
+ MIT
@@ -231,7 +231,7 @@ declare const CLAUDE_OPUS_5: {
231
231
  readonly max_output_tokens: 128000;
232
232
  readonly supports: {
233
233
  readonly input: ["text", "image", "document"];
234
- readonly tools: [];
234
+ readonly tools: ["web_search", "web_fetch", "code_execution", "computer_use", "bash", "text_editor", "memory"];
235
235
  };
236
236
  readonly pricing: {
237
237
  readonly input: {
@@ -269,7 +269,7 @@ declare const CLAUDE_FABLE_5_1: {
269
269
  readonly max_output_tokens: 128000;
270
270
  readonly supports: {
271
271
  readonly input: ["text", "image", "document"];
272
- readonly tools: [];
272
+ readonly tools: ["web_search", "web_fetch", "code_execution", "computer_use", "bash", "text_editor", "memory"];
273
273
  };
274
274
  readonly pricing: {
275
275
  readonly input: {
@@ -351,7 +351,7 @@ export type AnthropicChatModelProviderOptionsByName = {
351
351
  [CLAUDE_OPUS_4_8.id]: AnthropicCacheControlOptions & AnthropicContainerOptions & AnthropicContextManagementOptions & AnthropicMCPOptions & AnthropicServiceTierOptions & AnthropicStopSequencesOptions & AnthropicAdaptiveOrDisabledThinkingOptions & AnthropicToolChoiceOptions & AnthropicMaxTokensOptions & AnthropicOutputConfigOptions;
352
352
  [CLAUDE_FABLE_5.id]: AnthropicCacheControlOptions & AnthropicContainerOptions & AnthropicContextManagementOptions & AnthropicMCPOptions & AnthropicServiceTierOptions & AnthropicStopSequencesOptions & AnthropicAdaptiveOnlyThinkingOptions & AnthropicToolChoiceOptions & AnthropicMaxTokensOptions & AnthropicOutputConfigOptions;
353
353
  [CLAUDE_SONNET_5.id]: AnthropicCacheControlOptions & AnthropicContainerOptions & AnthropicContextManagementOptions & AnthropicMCPOptions & AnthropicServiceTierOptions & AnthropicStopSequencesOptions & AnthropicAdaptiveOrDisabledThinkingOptions & AnthropicToolChoiceOptions & AnthropicMaxTokensOptions & AnthropicOutputConfigOptions;
354
- [CLAUDE_OPUS_5.id]: AnthropicContainerOptions & AnthropicContextManagementOptions & AnthropicMCPOptions & AnthropicServiceTierOptions & AnthropicStopSequencesOptions & AnthropicThinkingOptions & AnthropicToolChoiceOptions & AnthropicSamplingOptions;
354
+ [CLAUDE_OPUS_5.id]: AnthropicContainerOptions & AnthropicContextManagementOptions & AnthropicMCPOptions & AnthropicServiceTierOptions & AnthropicStopSequencesOptions & AnthropicThinkingOptions & AnthropicToolChoiceOptions & AnthropicSamplingOptions & AnthropicOutputConfigOptions;
355
355
  [CLAUDE_OPUS_5_FAST.id]: AnthropicContainerOptions & AnthropicContextManagementOptions & AnthropicMCPOptions & AnthropicServiceTierOptions & AnthropicStopSequencesOptions & AnthropicThinkingOptions & AnthropicToolChoiceOptions & AnthropicSamplingOptions;
356
356
  [CLAUDE_FABLE_5_1.id]: AnthropicCacheControlOptions & AnthropicContainerOptions & AnthropicContextManagementOptions & AnthropicMCPOptions & AnthropicServiceTierOptions & AnthropicStopSequencesOptions & AnthropicAdaptiveOnlyThinkingOptions & AnthropicToolChoiceOptions & AnthropicMaxTokensOptions & AnthropicOutputConfigOptions;
357
357
  };
@@ -323,7 +323,15 @@ var CLAUDE_OPUS_5 = {
323
323
  "image",
324
324
  "document"
325
325
  ],
326
- tools: []
326
+ tools: [
327
+ "web_search",
328
+ "web_fetch",
329
+ "code_execution",
330
+ "computer_use",
331
+ "bash",
332
+ "text_editor",
333
+ "memory"
334
+ ]
327
335
  },
328
336
  pricing: {
329
337
  input: {
@@ -365,7 +373,15 @@ var CLAUDE_FABLE_5_1 = {
365
373
  "image",
366
374
  "document"
367
375
  ],
368
- tools: []
376
+ tools: [
377
+ "web_search",
378
+ "web_fetch",
379
+ "code_execution",
380
+ "computer_use",
381
+ "bash",
382
+ "text_editor",
383
+ "memory"
384
+ ]
369
385
  },
370
386
  pricing: {
371
387
  input: {
@@ -489,7 +505,9 @@ var ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS = /* @__PURE__ */ new Set([
489
505
  CLAUDE_OPUS_4_6.id,
490
506
  CLAUDE_OPUS_4_7.id,
491
507
  CLAUDE_OPUS_4_8.id,
508
+ CLAUDE_OPUS_5.id,
492
509
  CLAUDE_FABLE_5.id,
510
+ CLAUDE_FABLE_5_1.id,
493
511
  CLAUDE_SONNET_5.id,
494
512
  CLAUDE_SONNET_4_5.id,
495
513
  CLAUDE_SONNET_4_6.id,
@@ -1 +1 @@
1
- {"version":3,"file":"model-meta.js","names":[],"sources":["../../src/model-meta.ts"],"sourcesContent":["import type {\n AnthropicAdaptiveOnlyThinkingOptions,\n AnthropicAdaptiveOrDisabledThinkingOptions,\n AnthropicAdaptiveThinkingOptions,\n AnthropicCacheControlOptions,\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 */\nconst CLAUDE_OPUS_5 = {\n name: 'claude-opus-5',\n id: 'claude-opus-5',\n context_window: 1_000_000,\n max_output_tokens: 128_000,\n supports: {\n input: ['text', 'image', 'document'],\n tools: [],\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 AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n>\n\nconst CLAUDE_OPUS_5_FAST = {\n name: 'claude-opus-5-fast',\n id: 'claude-opus-5-fast',\n context_window: 1_000_000,\n max_output_tokens: 128_000,\n supports: {\n input: ['text', 'image', 'document'],\n tools: [],\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 AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n>\n\nconst CLAUDE_FABLE_5_1 = {\n name: 'claude-fable-5-1',\n id: 'claude-fable-5-1',\n context_window: 1_000_000,\n max_output_tokens: 128_000,\n supports: {\n input: ['text', 'image', 'document'],\n tools: [],\n },\n pricing: {\n input: {\n normal: 10,\n cached: 0.25,\n },\n output: {\n normal: 50,\n },\n },\n} as const satisfies ModelMeta<\n AnthropicCacheControlOptions &\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOnlyThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n>\n\nexport const ANTHROPIC_MODELS = [\n CLAUDE_FABLE_5_1.id,\n CLAUDE_OPUS_5.id,\n CLAUDE_OPUS_5_FAST.id,\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 * Claude chat models on Vertex AI / Gemini Enterprise Agent Platform.\n * This list is the Google partner catalog, not the full Anthropic API catalog.\n * Source: https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/partner-models/use-partner-models\n */\nexport const ANTHROPIC_VERTEX_CHAT_MODELS = [\n CLAUDE_OPUS_5.id,\n CLAUDE_SONNET_5.id,\n CLAUDE_FABLE_5.id,\n CLAUDE_OPUS_4_8.id,\n CLAUDE_OPUS_4_7.id,\n CLAUDE_OPUS_4_6.id,\n CLAUDE_SONNET_4_6.id,\n CLAUDE_OPUS_4_5.id,\n CLAUDE_SONNET_4_5.id,\n CLAUDE_OPUS_4_1.id,\n CLAUDE_HAIKU_4_5.id,\n] as const\n\nexport type AnthropicVertexChatModel =\n (typeof ANTHROPIC_VERTEX_CHAT_MODELS)[number]\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 [CLAUDE_OPUS_5.id]: CLAUDE_OPUS_5.max_output_tokens,\n [CLAUDE_OPUS_5_FAST.id]: CLAUDE_OPUS_5_FAST.max_output_tokens,\n [CLAUDE_FABLE_5_1.id]: CLAUDE_FABLE_5_1.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]: AnthropicCacheControlOptions &\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_SONNET_4_6.id]: AnthropicCacheControlOptions &\n 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]: AnthropicCacheControlOptions &\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_SONNET_4_5.id]: AnthropicCacheControlOptions &\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_HAIKU_4_5.id]: AnthropicCacheControlOptions &\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_OPUS_4_1.id]: AnthropicCacheControlOptions &\n 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]: AnthropicCacheControlOptions &\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOrDisabledThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n [CLAUDE_OPUS_4_8.id]: AnthropicCacheControlOptions &\n 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]: AnthropicCacheControlOptions &\n 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]: AnthropicCacheControlOptions &\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOrDisabledThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n [CLAUDE_OPUS_5.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_OPUS_5_FAST.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_FABLE_5_1.id]: AnthropicCacheControlOptions &\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOnlyThinkingOptions &\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 [CLAUDE_OPUS_5.id]: typeof CLAUDE_OPUS_5.supports.tools\n [CLAUDE_OPUS_5_FAST.id]: typeof CLAUDE_OPUS_5_FAST.supports.tools\n [CLAUDE_FABLE_5_1.id]: typeof CLAUDE_FABLE_5_1.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 [CLAUDE_OPUS_5.id]: typeof CLAUDE_OPUS_5.supports.input\n [CLAUDE_OPUS_5_FAST.id]: typeof CLAUDE_OPUS_5_FAST.supports.input\n [CLAUDE_FABLE_5_1.id]: typeof CLAUDE_FABLE_5_1.supports.input\n}\n"],"mappings":";AAmEA,IAAM,kBAAkB;CACtB,MAAM;CACN,IAAI;CACJ,gBAAgB;CAChB,mBAAmB;CACnB,kBAAkB;CAClB,SAAS;EACP,OAAO,EACL,QAAQ,EACV;EACA,QAAQ,EACN,QAAQ,GACV;CACF;CACA,UAAU;EACR,OAAO;GAAC;GAAQ;GAAS;EAAU;EACnC,mBAAmB;EACnB,mBAAmB;EACnB,eAAe;EACf,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;EACF;CACF;AACF;AAYA,IAAM,kBAAkB;CACtB,MAAM;CACN,IAAI;CACJ,gBAAgB;CAChB,mBAAmB;CACnB,kBAAkB;CAClB,SAAS;EACP,OAAO,EACL,QAAQ,GACV;EACA,QAAQ,EACN,QAAQ,GACV;CACF;CACA,UAAU;EACR,OAAO;GAAC;GAAQ;GAAS;EAAU;EACnC,mBAAmB;EACnB,eAAe;EACf,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;EACF;CACF;AACF;AAcA,IAAM,oBAAoB;CACxB,MAAM;CACN,IAAI;CACJ,gBAAgB;CAChB,mBAAmB;CACnB,kBAAkB;CAClB,SAAS;EACP,OAAO,EACL,QAAQ,EACV;EACA,QAAQ,EACN,QAAQ,GACV;CACF;CACA,UAAU;EACR,OAAO;GAAC;GAAQ;GAAS;EAAU;EACnC,mBAAmB;EACnB,mBAAmB;EACnB,eAAe;EACf,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;EACF;CACF;AACF;AAYA,IAAM,oBAAoB;CACxB,MAAM;CACN,IAAI;CACJ,gBAA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nC;CACR,MAAM,UACJ,kCAAkC,UAAA;CAEpC,OAAO,SAAS,UAAU,KAAK,IAAI,SAAS,iCAAiC;AAC/E;;;;;;;;AASA,IAAa,6DAA6C,IAAI,IAAY;CACxE,gBAAgB;CAChB,gBAAgB;CAChB,gBAAgB;CAChB,gBAAgB;CAChB,eAAe;CACf,gBAAgB;CAChB,kBAAkB;CAClB,kBAAkB;CAClB,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 AnthropicCacheControlOptions,\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 AnthropicCacheControlOptions &\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 */\nconst CLAUDE_OPUS_5 = {\n name: 'claude-opus-5',\n id: 'claude-opus-5',\n context_window: 1_000_000,\n max_output_tokens: 128_000,\n supports: {\n input: ['text', 'image', 'document'],\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 AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions &\n AnthropicOutputConfigOptions\n>\n\nconst CLAUDE_OPUS_5_FAST = {\n name: 'claude-opus-5-fast',\n id: 'claude-opus-5-fast',\n context_window: 1_000_000,\n max_output_tokens: 128_000,\n supports: {\n input: ['text', 'image', 'document'],\n tools: [],\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 AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n>\n\nconst CLAUDE_FABLE_5_1 = {\n name: 'claude-fable-5-1',\n id: 'claude-fable-5-1',\n context_window: 1_000_000,\n max_output_tokens: 128_000,\n supports: {\n input: ['text', 'image', 'document'],\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: 0.25,\n },\n output: {\n normal: 50,\n },\n },\n} as const satisfies ModelMeta<\n AnthropicCacheControlOptions &\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOnlyThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n>\n\nexport const ANTHROPIC_MODELS = [\n CLAUDE_FABLE_5_1.id,\n CLAUDE_OPUS_5.id,\n CLAUDE_OPUS_5_FAST.id,\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 * Claude chat models on Vertex AI / Gemini Enterprise Agent Platform.\n * This list is the Google partner catalog, not the full Anthropic API catalog.\n * Source: https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/partner-models/use-partner-models\n */\nexport const ANTHROPIC_VERTEX_CHAT_MODELS = [\n CLAUDE_OPUS_5.id,\n CLAUDE_SONNET_5.id,\n CLAUDE_FABLE_5.id,\n CLAUDE_OPUS_4_8.id,\n CLAUDE_OPUS_4_7.id,\n CLAUDE_OPUS_4_6.id,\n CLAUDE_SONNET_4_6.id,\n CLAUDE_OPUS_4_5.id,\n CLAUDE_SONNET_4_5.id,\n CLAUDE_OPUS_4_1.id,\n CLAUDE_HAIKU_4_5.id,\n] as const\n\nexport type AnthropicVertexChatModel =\n (typeof ANTHROPIC_VERTEX_CHAT_MODELS)[number]\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 [CLAUDE_OPUS_5.id]: CLAUDE_OPUS_5.max_output_tokens,\n [CLAUDE_OPUS_5_FAST.id]: CLAUDE_OPUS_5_FAST.max_output_tokens,\n [CLAUDE_FABLE_5_1.id]: CLAUDE_FABLE_5_1.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_OPUS_5.id,\n CLAUDE_FABLE_5.id,\n CLAUDE_FABLE_5_1.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]: AnthropicCacheControlOptions &\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_SONNET_4_6.id]: AnthropicCacheControlOptions &\n 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]: AnthropicCacheControlOptions &\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_SONNET_4_5.id]: AnthropicCacheControlOptions &\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_HAIKU_4_5.id]: AnthropicCacheControlOptions &\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_OPUS_4_1.id]: AnthropicCacheControlOptions &\n 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]: AnthropicCacheControlOptions &\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOrDisabledThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n [CLAUDE_OPUS_4_8.id]: AnthropicCacheControlOptions &\n 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]: AnthropicCacheControlOptions &\n 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]: AnthropicCacheControlOptions &\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOrDisabledThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicMaxTokensOptions &\n AnthropicOutputConfigOptions\n [CLAUDE_OPUS_5.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions &\n AnthropicOutputConfigOptions\n [CLAUDE_OPUS_5_FAST.id]: AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions\n [CLAUDE_FABLE_5_1.id]: AnthropicCacheControlOptions &\n AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicAdaptiveOnlyThinkingOptions &\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 [CLAUDE_OPUS_5.id]: typeof CLAUDE_OPUS_5.supports.tools\n [CLAUDE_OPUS_5_FAST.id]: typeof CLAUDE_OPUS_5_FAST.supports.tools\n [CLAUDE_FABLE_5_1.id]: typeof CLAUDE_FABLE_5_1.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 [CLAUDE_OPUS_5.id]: typeof CLAUDE_OPUS_5.supports.input\n [CLAUDE_OPUS_5_FAST.id]: typeof CLAUDE_OPUS_5_FAST.supports.input\n [CLAUDE_FABLE_5_1.id]: typeof CLAUDE_FABLE_5_1.supports.input\n}\n"],"mappings":";AAmEA,IAAM,kBAAkB;CACtB,MAAM;CACN,IAAI;CACJ,gBAAgB;CAChB,mBAAmB;CACnB,kBAAkB;CAClB,SAAS;EACP,OAAO,EACL,QAAQ,EACV;EACA,QAAQ,EACN,QAAQ,GACV;CACF;CACA,UAAU;EACR,OAAO;GAAC;GAAQ;GAAS;EAAU;EACnC,mBAAmB;EACnB,mBAAmB;EACnB,eAAe;EACf,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;EACF;CACF;AACF;AAYA,IAAM,kBAAkB;CACtB,MAAM;CACN,IAAI;CACJ,gBAAgB;CAChB,mBAAmB;CACnB,kBAAkB;CAClB,SAAS;EACP,OAAO,EACL,QAAQ,GACV;EACA,QAAQ,EACN,QAAQ,GACV;CACF;CACA,UAAU;EACR,OAAO;GAAC;GAAQ;GAAS;EAAU;EACnC,mBAAmB;EACnB,eAAe;EACf,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;EACF;CACF;AACF;AAcA,IAAM,oBAAoB;CACxB,MAAM;CACN,IAAI;CACJ,gBAAgB;CAChB,mBAAmB;CACnB,kBAAkB;CAClB,SAAS;EACP,OAAO,EACL,QAAQ,EACV;EACA,QAAQ,EACN,QAAQ,GACV;CACF;CACA,UAAU;EACR,OAAO;GAAC;GAAQ;GAAS;EAAU;EACnC,mBAAmB;EACnB,mBAAmB;EACnB,eAAe;EACf,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;EACF;CACF;AACF;AAYA,IAAM,oBAAoB;CACxB,MAAM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;AAiBA,IAAa,oCAAoC;;;;;;;;;;;;AAajD,SAAgB,6BACd,OACA,EAAE,SAAS,SAA+B,CAAC,GACnC;CACR,MAAM,UACJ,kCAAkC,UAAA;CAEpC,OAAO,SAAS,UAAU,KAAK,IAAI,SAAS,iCAAiC;AAC/E;;;;;;;;AASA,IAAa,6DAA6C,IAAI,IAAY;CACxE,gBAAgB;CAChB,gBAAgB;CAChB,gBAAgB;CAChB,gBAAgB;CAChB,cAAc;CACd,eAAe;CACf,iBAAiB;CACjB,gBAAgB;CAChB,kBAAkB;CAClB,kBAAkB;CAClB,iBAAiB;AACnB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/ai-anthropic",
3
- "version": "0.18.10",
3
+ "version": "0.18.13",
4
4
  "description": "Anthropic Claude adapter for TanStack AI chat, tool calling, thinking, and structured outputs.",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@anthropic-ai/vertex-sdk": "^0.19.0",
64
- "@tanstack/ai": "^0.58.0"
64
+ "@tanstack/ai": "^0.59.0"
65
65
  },
66
66
  "peerDependenciesMeta": {
67
67
  "@anthropic-ai/vertex-sdk": {
@@ -73,7 +73,7 @@
73
73
  "@anthropic-ai/vertex-sdk": "^0.19.0",
74
74
  "@vitest/coverage-v8": "4.1.10",
75
75
  "zod": "^4.2.0",
76
- "@tanstack/ai": "0.58.0"
76
+ "@tanstack/ai": "0.59.0"
77
77
  },
78
78
  "scripts": {
79
79
  "build": "vite build",
package/src/model-meta.ts CHANGED
@@ -509,7 +509,15 @@ const CLAUDE_OPUS_5 = {
509
509
  max_output_tokens: 128_000,
510
510
  supports: {
511
511
  input: ['text', 'image', 'document'],
512
- tools: [],
512
+ tools: [
513
+ 'web_search',
514
+ 'web_fetch',
515
+ 'code_execution',
516
+ 'computer_use',
517
+ 'bash',
518
+ 'text_editor',
519
+ 'memory',
520
+ ],
513
521
  },
514
522
  pricing: {
515
523
  input: {
@@ -528,7 +536,8 @@ const CLAUDE_OPUS_5 = {
528
536
  AnthropicStopSequencesOptions &
529
537
  AnthropicThinkingOptions &
530
538
  AnthropicToolChoiceOptions &
531
- AnthropicSamplingOptions
539
+ AnthropicSamplingOptions &
540
+ AnthropicOutputConfigOptions
532
541
  >
533
542
 
534
543
  const CLAUDE_OPUS_5_FAST = {
@@ -567,7 +576,15 @@ const CLAUDE_FABLE_5_1 = {
567
576
  max_output_tokens: 128_000,
568
577
  supports: {
569
578
  input: ['text', 'image', 'document'],
570
- tools: [],
579
+ tools: [
580
+ 'web_search',
581
+ 'web_fetch',
582
+ 'code_execution',
583
+ 'computer_use',
584
+ 'bash',
585
+ 'text_editor',
586
+ 'memory',
587
+ ],
571
588
  },
572
589
  pricing: {
573
590
  input: {
@@ -721,7 +738,9 @@ export const ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS = new Set<string>([
721
738
  CLAUDE_OPUS_4_6.id,
722
739
  CLAUDE_OPUS_4_7.id,
723
740
  CLAUDE_OPUS_4_8.id,
741
+ CLAUDE_OPUS_5.id,
724
742
  CLAUDE_FABLE_5.id,
743
+ CLAUDE_FABLE_5_1.id,
725
744
  CLAUDE_SONNET_5.id,
726
745
  CLAUDE_SONNET_4_5.id,
727
746
  CLAUDE_SONNET_4_6.id,
@@ -852,7 +871,8 @@ export type AnthropicChatModelProviderOptionsByName = {
852
871
  AnthropicStopSequencesOptions &
853
872
  AnthropicThinkingOptions &
854
873
  AnthropicToolChoiceOptions &
855
- AnthropicSamplingOptions
874
+ AnthropicSamplingOptions &
875
+ AnthropicOutputConfigOptions
856
876
  [CLAUDE_OPUS_5_FAST.id]: AnthropicContainerOptions &
857
877
  AnthropicContextManagementOptions &
858
878
  AnthropicMCPOptions &