Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/add-opus-4-1-model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@roo-code/types": patch
"roo-code": patch
---

Add support for Claude Opus 4.1 (claude-opus-4-1-20250805)

- Added claude-opus-4-1-20250805 to anthropicModels with 8192 max tokens and reasoning budget support
- Added support across all providers: Anthropic, Claude Code, Bedrock, Vertex AI, OpenRouter, and LiteLLM
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changeset claims support was added across all providers including OpenRouter, but the PR description explicitly states OpenRouter support wasn't added. Could we update this to accurately reflect what was implemented?

- Updated anthropic.ts provider to handle prompt caching for the new model
- Pricing: $15/M input tokens, $75/M output tokens, $18.75/M cache writes, $1.5/M cache reads
12 changes: 12 additions & 0 deletions packages/types/src/providers/anthropic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ export const anthropicModels = {
cacheReadsPrice: 0.3, // $0.30 per million tokens
supportsReasoningBudget: true,
},
"claude-opus-4-1-20250805": {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsComputerUse: true,
supportsPromptCache: true,
inputPrice: 15.0, // $15 per million input tokens
outputPrice: 75.0, // $75 per million output tokens
cacheWritesPrice: 18.75, // $18.75 per million tokens
cacheReadsPrice: 1.5, // $1.50 per million tokens
supportsReasoningBudget: true,
},
"claude-opus-4-20250514": {
maxTokens: 32_000, // Overridden to 8k if `enableReasoningEffort` is false.
contextWindow: 200_000,
Expand Down
15 changes: 15 additions & 0 deletions packages/types/src/providers/bedrock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@ export const bedrockModels = {
maxCachePoints: 4,
cachableFields: ["system", "messages", "tools"],
},
"anthropic.claude-opus-4-1-20250805-v1:0": {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsComputerUse: true,
supportsPromptCache: true,
supportsReasoningBudget: true,
inputPrice: 15.0,
outputPrice: 75.0,
cacheWritesPrice: 18.75,
cacheReadsPrice: 1.5,
minTokensPerCachePoint: 1024,
maxCachePoints: 4,
cachableFields: ["system", "messages", "tools"],
},
"anthropic.claude-opus-4-20250514-v1:0": {
maxTokens: 8192,
contextWindow: 200_000,
Expand Down
8 changes: 8 additions & 0 deletions packages/types/src/providers/claude-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ export const claudeCodeModels = {
supportsReasoningBudget: false,
requiredReasoningBudget: false,
},
"claude-opus-4-1-20250805": {
...anthropicModels["claude-opus-4-1-20250805"],
supportsImages: false,
supportsPromptCache: true, // Claude Code does report cache tokens
supportsReasoningEffort: false,
supportsReasoningBudget: false,
requiredReasoningBudget: false,
},
"claude-opus-4-20250514": {
...anthropicModels["claude-opus-4-20250514"],
supportsImages: false,
Expand Down
5 changes: 5 additions & 0 deletions packages/types/src/providers/lite-llm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const litellmDefaultModelInfo: ModelInfo = {

export const LITELLM_COMPUTER_USE_MODELS = new Set([
"claude-3-5-sonnet-latest",
"claude-opus-4-1-20250805",
"claude-opus-4-20250514",
"claude-sonnet-4-20250514",
"claude-3-7-sonnet-latest",
Expand All @@ -26,22 +27,26 @@ export const LITELLM_COMPUTER_USE_MODELS = new Set([
"vertex_ai/claude-3-5-sonnet-v2",
"vertex_ai/claude-3-5-sonnet-v2@20241022",
"vertex_ai/claude-3-7-sonnet@20250219",
"vertex_ai/claude-opus-4-1@20250805",
"vertex_ai/claude-opus-4@20250514",
"vertex_ai/claude-sonnet-4@20250514",
"openrouter/anthropic/claude-3.5-sonnet",
"openrouter/anthropic/claude-3.5-sonnet:beta",
"openrouter/anthropic/claude-3.7-sonnet",
"openrouter/anthropic/claude-3.7-sonnet:beta",
"anthropic.claude-opus-4-1-20250805-v1:0",
"anthropic.claude-opus-4-20250514-v1:0",
"anthropic.claude-sonnet-4-20250514-v1:0",
"anthropic.claude-3-7-sonnet-20250219-v1:0",
"anthropic.claude-3-5-sonnet-20241022-v2:0",
"us.anthropic.claude-3-5-sonnet-20241022-v2:0",
"us.anthropic.claude-3-7-sonnet-20250219-v1:0",
"us.anthropic.claude-opus-4-1-20250805-v1:0",
"us.anthropic.claude-opus-4-20250514-v1:0",
"us.anthropic.claude-sonnet-4-20250514-v1:0",
"eu.anthropic.claude-3-5-sonnet-20241022-v2:0",
"eu.anthropic.claude-3-7-sonnet-20250219-v1:0",
"eu.anthropic.claude-opus-4-1-20250805-v1:0",
"eu.anthropic.claude-opus-4-20250514-v1:0",
"eu.anthropic.claude-sonnet-4-20250514-v1:0",
"snowflake/claude-3-5-sonnet",
Expand Down
3 changes: 3 additions & 0 deletions packages/types/src/providers/openrouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const OPEN_ROUTER_PROMPT_CACHING_MODELS = new Set([
"anthropic/claude-3.7-sonnet:thinking",
"anthropic/claude-sonnet-4",
"anthropic/claude-opus-4",
"anthropic/claude-opus-4.1",
"google/gemini-2.5-flash-preview",
"google/gemini-2.5-flash-preview:thinking",
"google/gemini-2.5-flash-preview-05-20",
Expand All @@ -59,6 +60,7 @@ export const OPEN_ROUTER_COMPUTER_USE_MODELS = new Set([
"anthropic/claude-3.7-sonnet:thinking",
"anthropic/claude-sonnet-4",
"anthropic/claude-opus-4",
"anthropic/claude-opus-4.1",
])

// When we first launched these models we didn't have support for
Expand All @@ -77,6 +79,7 @@ export const OPEN_ROUTER_REQUIRED_REASONING_BUDGET_MODELS = new Set([
export const OPEN_ROUTER_REASONING_BUDGET_MODELS = new Set([
"anthropic/claude-3.7-sonnet:beta",
"anthropic/claude-opus-4",
"anthropic/claude-opus-4.1",
"anthropic/claude-sonnet-4",
"google/gemini-2.5-pro-preview",
"google/gemini-2.5-pro",
Expand Down
12 changes: 12 additions & 0 deletions packages/types/src/providers/vertex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,18 @@ export const vertexModels = {
cacheReadsPrice: 0.3,
supportsReasoningBudget: true,
},
"claude-opus-4-1@20250805": {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsComputerUse: true,
supportsPromptCache: true,
inputPrice: 15.0,
outputPrice: 75.0,
cacheWritesPrice: 18.75,
cacheReadsPrice: 1.5,
supportsReasoningBudget: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentional? I noticed that claude-opus-4@20250514 (line 190) doesn't have supportsReasoningBudget: true, but the new claude-opus-4-1@20250805 does. Should we add it to the 4.0 model for consistency, or is there a specific reason for this difference?

},
"claude-opus-4@20250514": {
maxTokens: 8192,
contextWindow: 200_000,
Expand Down
2 changes: 2 additions & 0 deletions src/api/providers/anthropic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa

switch (modelId) {
case "claude-sonnet-4-20250514":
case "claude-opus-4-1-20250805":
case "claude-opus-4-20250514":
case "claude-3-7-sonnet-20250219":
case "claude-3-5-sonnet-20241022":
Expand Down Expand Up @@ -105,6 +106,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
// Then check for models that support prompt caching
switch (modelId) {
case "claude-sonnet-4-20250514":
case "claude-opus-4-1-20250805":
case "claude-opus-4-20250514":
case "claude-3-7-sonnet-20250219":
case "claude-3-5-sonnet-20241022":
Expand Down
13 changes: 12 additions & 1 deletion src/api/providers/fetchers/__tests__/openrouter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe("OpenRouter API", () => {
"google/gemini-2.5-pro-preview", // Excluded due to lag issue (#4487)
"google/gemini-2.5-flash", // OpenRouter doesn't report this as supporting prompt caching
"google/gemini-2.5-flash-lite-preview-06-17", // OpenRouter doesn't report this as supporting prompt caching
"anthropic/claude-opus-4.1", // Not yet available in OpenRouter API
])

const ourCachingModels = Array.from(OPEN_ROUTER_PROMPT_CACHING_MODELS).filter(
Expand All @@ -48,12 +49,20 @@ describe("OpenRouter API", () => {

expect(ourCachingModels.sort()).toEqual(expectedCachingModels)

const excludedComputerUseModels = new Set([
"anthropic/claude-opus-4.1", // Not yet available in OpenRouter API
])

const expectedComputerUseModels = Array.from(OPEN_ROUTER_COMPUTER_USE_MODELS)
.filter((id) => !excludedComputerUseModels.has(id))
.sort()

expect(
Object.entries(models)
.filter(([_, model]) => model.supportsComputerUse)
.map(([id, _]) => id)
.sort(),
).toEqual(Array.from(OPEN_ROUTER_COMPUTER_USE_MODELS).sort())
).toEqual(expectedComputerUseModels)

expect(
Object.entries(models)
Expand All @@ -67,6 +76,7 @@ describe("OpenRouter API", () => {
"anthropic/claude-3.7-sonnet:beta",
"anthropic/claude-3.7-sonnet:thinking",
"anthropic/claude-opus-4",
// "anthropic/claude-opus-4.1", // Not yet available in OpenRouter API
"anthropic/claude-sonnet-4",
"arliai/qwq-32b-arliai-rpr-v1:free",
"cognitivecomputations/dolphin3.0-r1-mistral-24b:free",
Expand Down Expand Up @@ -122,6 +132,7 @@ describe("OpenRouter API", () => {
"google/gemini-2.5-flash",
"google/gemini-2.5-flash-lite-preview-06-17",
"google/gemini-2.5-pro",
"anthropic/claude-opus-4.1", // Not yet available in OpenRouter API
])

const expectedReasoningBudgetModels = Array.from(OPEN_ROUTER_REASONING_BUDGET_MODELS)
Expand Down
5 changes: 5 additions & 0 deletions src/api/providers/fetchers/openrouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ export const parseOpenRouterModel = ({
modelInfo.maxTokens = anthropicModels["claude-3-7-sonnet-20250219:thinking"].maxTokens
}

// Set claude-opus-4.1 model to use the correct configuration
if (id === "anthropic/claude-opus-4.1") {
modelInfo.maxTokens = anthropicModels["claude-opus-4-1-20250805"].maxTokens
}

// Set horizon-alpha model to 32k max tokens
if (id === "openrouter/horizon-alpha") {
modelInfo.maxTokens = 32768
Expand Down
Loading