@ai-sdk/anthropic 4.0.104 → 4.0.105

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.
@@ -1,6 +1,11 @@
1
1
  ---
2
2
  title: Anthropic
3
3
  description: Learn how to use Anthropic with AI Gateway and the direct provider.
4
+ keywords:
5
+ - claude
6
+ - claude sonnet
7
+ - claude opus
8
+ - claude haiku
4
9
  ---
5
10
 
6
11
  # Anthropic Provider
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/anthropic",
3
- "version": "4.0.104",
3
+ "version": "4.0.105",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -4,35 +4,10 @@ import {
4
4
  type InferSchema,
5
5
  } from '@ai-sdk/provider-utils';
6
6
  import { z } from 'zod/v4';
7
+ import type { AnthropicModelIds } from './anthropic-model-catalog';
7
8
 
8
9
  // https://docs.claude.com/en/docs/about-claude/models/overview
9
- export type AnthropicModelId =
10
- | 'claude-3-haiku-20240307'
11
- | 'claude-haiku-4-5-20251001'
12
- | 'claude-haiku-4-5'
13
- | 'claude-haiku-5-5'
14
- | 'claude-opus-4-0'
15
- | 'claude-opus-4-20250514'
16
- | 'claude-opus-4-1-20250805'
17
- | 'claude-opus-4-1'
18
- | 'claude-opus-4-5'
19
- | 'claude-opus-4-5-20251101'
20
- | 'claude-sonnet-4-0'
21
- | 'claude-sonnet-4-20250514'
22
- | 'claude-sonnet-4-5-20250929'
23
- | 'claude-sonnet-4-5'
24
- | 'claude-sonnet-4-6'
25
- | 'claude-opus-4-6'
26
- | 'claude-opus-4-7'
27
- | 'claude-opus-4-8'
28
- | 'claude-opus-5'
29
- | 'claude-opus-5-5'
30
- | 'claude-fable-5'
31
- | 'claude-fable-5-1'
32
- | 'claude-fable-5-2'
33
- | 'claude-sonnet-5'
34
- | 'claude-sonnet-5-5'
35
- | (string & {});
10
+ export type AnthropicModelId = AnthropicModelIds['language'] | (string & {});
36
11
 
37
12
  /**
38
13
  * Anthropic file part provider options for document-specific features.
@@ -248,7 +248,7 @@ const runtimeRules: readonly {
248
248
  },
249
249
  ];
250
250
 
251
- const documentedModels: Readonly<Record<string, DocumentedCapabilities>> = {
251
+ const languageModelDefinitions = {
252
252
  'claude-opus-5-5': { toolSearch: true, compaction: true, effort: true },
253
253
  'claude-opus-5': { toolSearch: true, compaction: true, effort: true },
254
254
  'claude-sonnet-5-5': { toolSearch: true, compaction: true, effort: true },
@@ -267,15 +267,25 @@ const documentedModels: Readonly<Record<string, DocumentedCapabilities>> = {
267
267
  'claude-opus-4-1': { toolSearch: false, compaction: false, effort: false },
268
268
  'claude-opus-4-0': { toolSearch: false, compaction: false, effort: false },
269
269
  'claude-sonnet-4-0': { toolSearch: false, compaction: false, effort: false },
270
- };
270
+ // Known IDs without declared capabilities retain the custom-model fallback.
271
+ 'claude-3-haiku-20240307': undefined,
272
+ 'claude-haiku-4-5-20251001': undefined,
273
+ 'claude-opus-4-1-20250805': undefined,
274
+ 'claude-opus-4-20250514': undefined,
275
+ 'claude-opus-4-5-20251101': undefined,
276
+ 'claude-sonnet-4-20250514': undefined,
277
+ 'claude-sonnet-4-5-20250929': undefined,
278
+ } satisfies Readonly<Record<string, DocumentedCapabilities | undefined>>;
271
279
 
272
280
  export const anthropicModelCatalog: Readonly<
273
281
  Record<string, AnthropicLanguageModelEntry>
274
282
  > = Object.fromEntries(
275
- Object.entries(documentedModels).map(([modelId, capabilities]) => [
276
- modelId,
277
- createAnthropicLanguageModelEntry(modelId, capabilities),
278
- ]),
283
+ Object.entries(languageModelDefinitions)
284
+ .filter(([, definition]) => definition != null)
285
+ .map(([modelId, capabilities]) => [
286
+ modelId,
287
+ createAnthropicLanguageModelEntry(modelId, capabilities),
288
+ ]),
279
289
  );
280
290
 
281
291
  export function getAnthropicLanguageModelEntry(
@@ -413,3 +423,8 @@ export function getAnthropicModelCapabilities(modelId: string) {
413
423
 
414
424
  // Compatibility name also exported by the Anthropic runtime adapter.
415
425
  export { getAnthropicModelCapabilities as getModelCapabilities };
426
+
427
+ /** Known model IDs, derived from the declarations used to build the catalog. */
428
+ export type AnthropicModelIds = {
429
+ language: keyof typeof languageModelDefinitions;
430
+ };