Skip to content

Commit 2a1c664

Browse files
authored
feat(provider/anthropic): add support for new Claude Sonnet 4.6 model (#12645)
## Background Anthropic released Claude Sonnet 4.6: https://www.anthropic.com/news/claude-sonnet-4-6 This PR adds the new model string across the SDK so it's recognized with correct capabilities. ## Summary Adds `claude-sonnet-4-6` as a recognized model ID in the `anthropic`, `amazon-bedrock`, and `google-vertex` provider packages. The model is registered with 128k max output tokens and structured output support (same tier as `claude-opus-4-6`). It supports both adaptive and enabled thinking modes. Documentation model tables and capability lists are updated to include the new model. A few relevant examples (`anthropic-reasoning`, `anthropic-context-management`) are updated to use the new model string. ## Manual Verification N/A — model string addition, verified via type check (`pnpm type-check:full`). ## Checklist - [x] Tests have been added / updated (for bug fixes / features) - [x] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review) ## Future Work N/A ## Related Issues N/A
1 parent d6245af commit 2a1c664

File tree

13 files changed

+29
-9
lines changed

13 files changed

+29
-9
lines changed

.changeset/clean-students-unite.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@ai-sdk/amazon-bedrock': patch
3+
'@ai-sdk/gateway': patch
4+
'@ai-sdk/google-vertex': patch
5+
'@ai-sdk/anthropic': patch
6+
---
7+
8+
feat(provider/anthropic): add support for new Claude Sonnet 4.6 model

content/docs/02-foundations/02-providers-and-models.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ Here are the capabilities of popular models:
132132
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5-codex` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
133133
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5-chat-latest` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
134134
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-opus-4-6` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
135+
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-sonnet-4-6` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
135136
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-opus-4-5` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
136137
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-opus-4-1` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
137138
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-opus-4-0` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |

content/providers/01-ai-sdk-providers/05-anthropic.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,8 +1148,9 @@ In this flow:
11481148
3. Claude processes the results in code and generates the final response
11491149

11501150
<Note>
1151-
Programmatic tool calling requires `claude-sonnet-4-5` or `claude-opus-4-5`
1152-
models and uses the `code_execution_20250825` tool.
1151+
Programmatic tool calling requires `claude-sonnet-4-6`, `claude-sonnet-4-5`,
1152+
`claude-opus-4-6`, or `claude-opus-4-5` models and uses the
1153+
`code_execution_20250825` tool.
11531154
</Note>
11541155

11551156
#### Container Persistence
@@ -1297,6 +1298,7 @@ and the `mediaType` should be set to `'application/pdf'`.
12971298
| Model | Image Input | Object Generation | Tool Usage | Computer Use | Web Search | Tool Search | Compaction |
12981299
| -------------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- |
12991300
| `claude-opus-4-6` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
1301+
| `claude-sonnet-4-6` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | |
13001302
| `claude-opus-4-5` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | |
13011303
| `claude-haiku-4-5` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | | |
13021304
| `claude-sonnet-4-5` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | |

content/providers/01-ai-sdk-providers/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Not all providers support all AI SDK features. Here's a quick comparison of the
3737
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-4o` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
3838
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-4o-mini` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
3939
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-opus-4-6` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
40+
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-sonnet-4-6` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
4041
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-opus-4-5` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
4142
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-sonnet-4-5` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
4243
| [Anthropic](/providers/ai-sdk-providers/anthropic) | `claude-haiku-4-5` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |

examples/ai-functions/src/generate-text/anthropic-context-management.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { run } from '../lib/run';
88

99
run(async () => {
1010
const result = await generateText({
11-
model: anthropic('claude-haiku-4-5'),
11+
model: anthropic('claude-sonnet-4-6'),
1212
messages: [
1313
{
1414
role: 'user',

examples/ai-functions/src/generate-text/anthropic-reasoning.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { run } from '../lib/run';
77

88
run(async () => {
99
const result = await generateText({
10-
model: anthropic('claude-3-7-sonnet-20250219'),
10+
model: anthropic('claude-sonnet-4-6'),
1111
prompt: 'How many "r"s are in the word "strawberry"?',
1212
temperature: 0.5, // should get ignored (warning)
1313
providerOptions: {

examples/ai-functions/src/stream-text/anthropic-context-management.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ run(async () => {
1818
}
1919
}
2020
},
21-
model: anthropic('claude-haiku-4-5'),
21+
model: anthropic('claude-sonnet-4-6'),
2222
messages: [
2323
{ role: 'user', content: 'What is the weather in San Francisco?' },
2424
{

examples/ai-functions/src/stream-text/anthropic-reasoning.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { run } from '../lib/run';
77

88
run(async () => {
99
const result = streamText({
10-
model: anthropic('claude-3-7-sonnet-20250219'),
10+
model: anthropic('claude-sonnet-4-6'),
1111
prompt: 'How many "r"s are in the word "strawberry"?',
1212
temperature: 0.5, // should get ignored (warning)
1313
onError: error => {

packages/amazon-bedrock/src/anthropic/bedrock-anthropic-options.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export type BedrockAnthropicModelId =
22
| 'anthropic.claude-opus-4-6-v1'
3+
| 'anthropic.claude-sonnet-4-6-v1'
34
| 'anthropic.claude-opus-4-5-20251101-v1:0'
45
| 'anthropic.claude-sonnet-4-5-20250929-v1:0'
56
| 'anthropic.claude-opus-4-20250514-v1:0'
@@ -14,6 +15,7 @@ export type BedrockAnthropicModelId =
1415
| 'anthropic.claude-3-sonnet-20240229-v1:0'
1516
| 'anthropic.claude-3-haiku-20240307-v1:0'
1617
| 'us.anthropic.claude-opus-4-6-v1'
18+
| 'us.anthropic.claude-sonnet-4-6-v1'
1719
| 'us.anthropic.claude-opus-4-5-20251101-v1:0'
1820
| 'us.anthropic.claude-sonnet-4-5-20250929-v1:0'
1921
| 'us.anthropic.claude-opus-4-20250514-v1:0'

packages/anthropic/src/anthropic-messages-language-model.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2182,7 +2182,10 @@ function getModelCapabilities(modelId: string): {
21822182
supportsStructuredOutput: boolean;
21832183
isKnownModel: boolean;
21842184
} {
2185-
if (modelId.includes('claude-opus-4-6')) {
2185+
if (
2186+
modelId.includes('claude-sonnet-4-6') ||
2187+
modelId.includes('claude-opus-4-6')
2188+
) {
21862189
return {
21872190
maxOutputTokens: 128000,
21882191
supportsStructuredOutput: true,

0 commit comments

Comments
 (0)