feat(providers): add Claude Opus 5 model (#5925)

* feat(providers): add Claude Opus 5 model

* fix(providers): route Opus 5 through adaptive thinking

Opus 5 supports only adaptive thinking (no extended thinking / budget_tokens),
same as Opus 4.8/4.7. Add opus-5 to supportsAdaptiveThinking so thinking
requests use thinking.type: adaptive instead of falling through to budget_tokens
extended thinking, which Opus 4.7+ rejects with a 400.

* docs(agent): regenerate agent-stream docs for Opus 5
This commit is contained in:
Waleed
2026-07-24 10:33:47 -07:00
committed by GitHub
parent 513292f17b
commit 70313cd2ad
4 changed files with 27 additions and 4 deletions
@@ -108,7 +108,7 @@ Live tool-call chips stream for **Anthropic, Azure Anthropic, Google, Vertex AI,
|----------|-------------------|--------|
| OpenAI | Summaries only — Requires OpenAI organization verification; falls back to no summaries. | `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna`, `gpt-5.5-pro`, `gpt-5.5`, `gpt-5.4-pro`, `gpt-5.4`, `gpt-5.4-mini`, `gpt-5.4-nano`, `gpt-5.2-pro`, `gpt-5.2`, `gpt-5.1`, `gpt-5-pro`, `gpt-5`, `gpt-5-mini`, `gpt-5-nano`, `o4-mini`, `o3`, `o3-mini`, `o1` |
| Anthropic | Full thinking deltas | `claude-opus-4-6`, `claude-sonnet-4-6`, `claude-opus-4-5`, `claude-opus-4-1`, `claude-sonnet-4-5`, `claude-haiku-4-5` |
| Anthropic | Summaries only — These generations omit full thinking; Sim requests summarized thinking on streaming runs. | `claude-fable-5`, `claude-sonnet-5`, `claude-opus-4-8`, `claude-opus-4-7` |
| Anthropic | Summaries only — These generations omit full thinking; Sim requests summarized thinking on streaming runs. | `claude-fable-5`, `claude-sonnet-5`, `claude-opus-5`, `claude-opus-4-8`, `claude-opus-4-7` |
| Azure OpenAI | Summaries only — Requires OpenAI organization verification; falls back to no summaries. | `azure/gpt-5.4`, `azure/gpt-5.4-mini`, `azure/gpt-5.4-nano`, `azure/gpt-5.2`, `azure/gpt-5.1`, `azure/gpt-5.1-codex`, `azure/gpt-5`, `azure/gpt-5-mini`, `azure/gpt-5-nano`, `azure/o3`, `azure/o4-mini` |
| Azure Anthropic | Full thinking deltas | `azure-anthropic/claude-opus-4-6`, `azure-anthropic/claude-opus-4-5`, `azure-anthropic/claude-sonnet-4-5`, `azure-anthropic/claude-opus-4-1`, `azure-anthropic/claude-haiku-4-5` |
| Google | Summaries only | `gemini-3.6-flash`, `gemini-3.5-flash-lite`, `gemini-3.5-flash`, `gemini-3.1-pro-preview`, `gemini-3.1-flash-lite`, `gemini-3-flash-preview`, `gemini-2.5-pro`, `gemini-2.5-flash`, `gemini-2.5-flash-lite` |
@@ -14,6 +14,7 @@ describe('buildThinkingConfig', () => {
for (const model of [
'claude-fable-5',
'claude-sonnet-5',
'claude-opus-5',
'claude-opus-4-8',
'claude-opus-4-7',
]) {
@@ -27,6 +28,7 @@ describe('buildThinkingConfig', () => {
for (const model of [
'claude-fable-5',
'claude-sonnet-5',
'claude-opus-5',
'claude-opus-4-8',
'claude-opus-4-7',
]) {
+3 -2
View File
@@ -98,7 +98,7 @@ const ANTHROPIC_THINKING_OUTPUT_HEADROOM = 4096
* Checks if a model supports adaptive thinking (thinking.type: "adaptive").
* Fable 5 supports ONLY adaptive thinking (always on; type: "disabled" is rejected).
* Sonnet 5 supports ONLY adaptive thinking (manual budget_tokens returns a 400 error).
* Opus 4.8 and Opus 4.7 support ONLY adaptive thinking (no extended thinking / budget_tokens).
* Opus 5, Opus 4.8, and Opus 4.7 support ONLY adaptive thinking (no extended thinking / budget_tokens).
* Opus 4.6 and Sonnet 4.6 support both extended and adaptive thinking — use adaptive.
* Opus 4.5 supports effort but NOT adaptive thinking — it uses budget_tokens with type: "enabled".
*/
@@ -107,6 +107,7 @@ function supportsAdaptiveThinking(modelId: string): boolean {
return (
normalizedModel.includes('fable-5') ||
normalizedModel.includes('sonnet-5') ||
normalizedModel.includes('opus-5') ||
normalizedModel.includes('opus-4-8') ||
normalizedModel.includes('opus-4.8') ||
normalizedModel.includes('opus-4-7') ||
@@ -121,7 +122,7 @@ function supportsAdaptiveThinking(modelId: string): boolean {
/**
* Builds the thinking configuration for the Anthropic API based on model capabilities and level.
*
* - Fable 5, Sonnet 5, Opus 4.8, Opus 4.7: Uses adaptive thinking only (no extended thinking support)
* - Fable 5, Sonnet 5, Opus 5, Opus 4.8, Opus 4.7: Uses adaptive thinking only (no extended thinking support)
* - Opus 4.6, Sonnet 4.6: Uses adaptive thinking with effort parameter
* - Other models: Uses budget_tokens-based extended thinking
*
+21 -1
View File
@@ -797,6 +797,27 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
releaseDate: '2026-06-30',
recommended: true,
},
{
id: 'claude-opus-5',
pricing: {
input: 5.0,
cachedInput: 0.5,
output: 25.0,
updatedAt: '2026-07-24',
},
capabilities: {
nativeStructuredOutputs: true,
maxOutputTokens: 128000,
thinking: {
levels: ['low', 'medium', 'high', 'xhigh', 'max'],
default: 'high',
streamed: 'summary',
},
},
contextWindow: 1000000,
releaseDate: '2026-07-24',
recommended: true,
},
{
id: 'claude-opus-4-8',
pricing: {
@@ -816,7 +837,6 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
},
contextWindow: 1000000,
releaseDate: '2026-05-28',
recommended: true,
},
{
id: 'claude-opus-4-7',