From 487f01010102c478b4049fff470d654221eb773d Mon Sep 17 00:00:00 2001 From: jeremyphilemon Date: Thu, 22 May 2025 09:48:46 -0700 Subject: [PATCH 1/2] feat (providers/anthropic): add claude v4 models --- .changeset/six-olives-rest.md | 5 ++++ .../02-providers-and-models.mdx | 2 ++ .../01-ai-sdk-providers/05-anthropic.mdx | 24 ++++++++++--------- .../src/anthropic-messages-settings.ts | 2 ++ 4 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 .changeset/six-olives-rest.md diff --git a/.changeset/six-olives-rest.md b/.changeset/six-olives-rest.md new file mode 100644 index 000000000000..4105dbab3be5 --- /dev/null +++ b/.changeset/six-olives-rest.md @@ -0,0 +1,5 @@ +--- +'@ai-sdk/anthropic': patch +--- + +feat (providers/anthropic): add claude v4 models diff --git a/content/docs/02-foundations/02-providers-and-models.mdx b/content/docs/02-foundations/02-providers-and-models.mdx index 2b9ac78bf0be..a87bee6fe6d0 100644 --- a/content/docs/02-foundations/02-providers-and-models.mdx +++ b/content/docs/02-foundations/02-providers-and-models.mdx @@ -113,6 +113,8 @@ Here are the capabilities of popular models: | [OpenAI](/providers/ai-sdk-providers/openai) | `o1` | | | | | | [OpenAI](/providers/ai-sdk-providers/openai) | `o1-mini` | | | | | | [OpenAI](/providers/ai-sdk-providers/openai) | `o1-preview` | | | | | +| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-4-opus-20250514` | | | | | +| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-4-sonnet-20250514` | | | | | | [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-3-7-sonnet-20250219` | | | | | | [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-3-5-sonnet-20241022` | | | | | | [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-3-5-sonnet-20240620` | | | | | diff --git a/content/providers/01-ai-sdk-providers/05-anthropic.mdx b/content/providers/01-ai-sdk-providers/05-anthropic.mdx index 82f95360c7cc..36a21ef4e2be 100644 --- a/content/providers/01-ai-sdk-providers/05-anthropic.mdx +++ b/content/providers/01-ai-sdk-providers/05-anthropic.mdx @@ -106,7 +106,7 @@ The following optional settings are available for Anthropic models: ### Reasoning -Anthropic has reasoning support for the `claude-3-7-sonnet-20250219` model. +Anthropic has reasoning support for `claude-4-opus-20250514`, `claude-4-sonnet-20250514`, and `claude-3-7-sonnet-20250219` models. You can enable it using the `thinking` provider option and specifying a thinking budget in tokens. @@ -116,7 +116,7 @@ import { anthropic, AnthropicProviderOptions } from '@ai-sdk/anthropic'; import { generateText } from 'ai'; const { text, reasoning, reasoningDetails } = await generateText({ - model: anthropic('claude-3-7-sonnet-20250219'), + model: anthropic('claude-4-opus-20250514'), prompt: 'How many people will live in the world in 2040?', providerOptions: { anthropic: { @@ -409,15 +409,17 @@ and the `mimeType` should be set to `'application/pdf'`. ### Model Capabilities -| Model | Image Input | Object Generation | Tool Usage | Computer Use | -| ---------------------------- | ------------------- | ------------------- | ------------------- | ------------------- | -| `claude-3-7-sonnet-20250219` | | | | | -| `claude-3-5-sonnet-20241022` | | | | | -| `claude-3-5-sonnet-20240620` | | | | | -| `claude-3-5-haiku-20241022` | | | | | -| `claude-3-opus-20240229` | | | | | -| `claude-3-sonnet-20240229` | | | | | -| `claude-3-haiku-20240307` | | | | | +| Model | Image Input | Object Generation | Tool Usage | Computer Use +| ---------------------------- | ------------------- | ------------------- | ------------------- | ------------------- +| `claude-4-opus-20250514` | | | | +| `claude-4-sonnet-20250514` | | | | +| `claude-3-7-sonnet-20250219` | | | | +| `claude-3-5-sonnet-20241022` | | | | +| `claude-3-5-sonnet-20240620` | | | | +| `claude-3-5-haiku-20241022` | | | | +| `claude-3-opus-20240229` | | | | +| `claude-3-sonnet-20240229` | | | | +| `claude-3-haiku-20240307` | | | | The table above lists popular models. Please see the [Anthropic diff --git a/packages/anthropic/src/anthropic-messages-settings.ts b/packages/anthropic/src/anthropic-messages-settings.ts index 4d78dacfdc9f..c080739d0ead 100644 --- a/packages/anthropic/src/anthropic-messages-settings.ts +++ b/packages/anthropic/src/anthropic-messages-settings.ts @@ -1,5 +1,7 @@ // https://docs.anthropic.com/claude/docs/models-overview export type AnthropicMessagesModelId = + | 'claude-4-opus-20250514' + | 'claude-4-sonnet-20250514' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-sonnet-latest' | 'claude-3-5-sonnet-20241022' From e367ca6ca4d968d627a9d8ac8c0ac94706a91510 Mon Sep 17 00:00:00 2001 From: jeremyphilemon Date: Thu, 22 May 2025 10:05:41 -0700 Subject: [PATCH 2/2] format --- .../01-ai-sdk-providers/05-anthropic.mdx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/content/providers/01-ai-sdk-providers/05-anthropic.mdx b/content/providers/01-ai-sdk-providers/05-anthropic.mdx index 36a21ef4e2be..64cc4bce8d35 100644 --- a/content/providers/01-ai-sdk-providers/05-anthropic.mdx +++ b/content/providers/01-ai-sdk-providers/05-anthropic.mdx @@ -409,17 +409,17 @@ and the `mimeType` should be set to `'application/pdf'`. ### Model Capabilities -| Model | Image Input | Object Generation | Tool Usage | Computer Use -| ---------------------------- | ------------------- | ------------------- | ------------------- | ------------------- -| `claude-4-opus-20250514` | | | | -| `claude-4-sonnet-20250514` | | | | -| `claude-3-7-sonnet-20250219` | | | | -| `claude-3-5-sonnet-20241022` | | | | -| `claude-3-5-sonnet-20240620` | | | | -| `claude-3-5-haiku-20241022` | | | | -| `claude-3-opus-20240229` | | | | -| `claude-3-sonnet-20240229` | | | | -| `claude-3-haiku-20240307` | | | | +| Model | Image Input | Object Generation | Tool Usage | Computer Use | +| ---------------------------- | ------------------- | ------------------- | ------------------- | ------------------- | +| `claude-4-opus-20250514` | | | | | +| `claude-4-sonnet-20250514` | | | | | +| `claude-3-7-sonnet-20250219` | | | | | +| `claude-3-5-sonnet-20241022` | | | | | +| `claude-3-5-sonnet-20240620` | | | | | +| `claude-3-5-haiku-20241022` | | | | | +| `claude-3-opus-20240229` | | | | | +| `claude-3-sonnet-20240229` | | | | | +| `claude-3-haiku-20240307` | | | | | The table above lists popular models. Please see the [Anthropic