mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-08 03:07:53 +00:00
feat: add Claude Opus 4.7 support across all providers
Add claude-opus-4-7 model definitions and references to: - Anthropic direct API types and handler (1M context, prompt caching, extended thinking) - OpenRouter model sets and fetcher maxTokens override - Vercel AI Gateway prompt caching and vision+tools sets - WebView 1M context beta tier pricing check
This commit is contained in:
parent
f4b829baa1
commit
7747f6a10b
6 changed files with 39 additions and 4 deletions
|
|
@ -91,6 +91,27 @@ export const anthropicModels = {
|
|||
},
|
||||
],
|
||||
},
|
||||
"claude-opus-4-7": {
|
||||
maxTokens: 128_000, // Overridden to 8k if `enableReasoningEffort` is false.
|
||||
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag
|
||||
supportsImages: true,
|
||||
supportsPromptCache: true,
|
||||
inputPrice: 5.0, // $5 per million input tokens (≤200K context)
|
||||
outputPrice: 25.0, // $25 per million output tokens (≤200K context)
|
||||
cacheWritesPrice: 6.25, // $6.25 per million tokens
|
||||
cacheReadsPrice: 0.5, // $0.50 per million tokens
|
||||
supportsReasoningBudget: true,
|
||||
// Tiered pricing for extended context (requires beta flag)
|
||||
tiers: [
|
||||
{
|
||||
contextWindow: 1_000_000, // 1M tokens with beta flag
|
||||
inputPrice: 10.0, // $10 per million input tokens (>200K context)
|
||||
outputPrice: 37.5, // $37.50 per million output tokens (>200K context)
|
||||
cacheWritesPrice: 12.5, // $12.50 per million tokens (>200K context)
|
||||
cacheReadsPrice: 1.0, // $1.00 per million tokens (>200K context)
|
||||
},
|
||||
],
|
||||
},
|
||||
"claude-opus-4-5-20251101": {
|
||||
maxTokens: 32_000, // Overridden to 8k if `enableReasoningEffort` is false.
|
||||
contextWindow: 200_000,
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ export const OPEN_ROUTER_PROMPT_CACHING_MODELS = new Set([
|
|||
"anthropic/claude-opus-4.1",
|
||||
"anthropic/claude-opus-4.5",
|
||||
"anthropic/claude-opus-4.6",
|
||||
"anthropic/claude-opus-4.7",
|
||||
"anthropic/claude-haiku-4.5",
|
||||
"google/gemini-2.5-flash-preview",
|
||||
"google/gemini-2.5-flash-preview:thinking",
|
||||
|
|
@ -74,6 +75,7 @@ export const OPEN_ROUTER_REASONING_BUDGET_MODELS = new Set([
|
|||
"anthropic/claude-opus-4.1",
|
||||
"anthropic/claude-opus-4.5",
|
||||
"anthropic/claude-opus-4.6",
|
||||
"anthropic/claude-opus-4.7",
|
||||
"anthropic/claude-sonnet-4",
|
||||
"anthropic/claude-sonnet-4.5",
|
||||
"anthropic/claude-sonnet-4.6",
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ export const VERCEL_AI_GATEWAY_PROMPT_CACHING_MODELS = new Set([
|
|||
"anthropic/claude-opus-4.1",
|
||||
"anthropic/claude-opus-4.5",
|
||||
"anthropic/claude-opus-4.6",
|
||||
"anthropic/claude-opus-4.7",
|
||||
"anthropic/claude-sonnet-4",
|
||||
"anthropic/claude-sonnet-4.6",
|
||||
"openai/gpt-4.1",
|
||||
|
|
@ -55,6 +56,7 @@ export const VERCEL_AI_GATEWAY_VISION_AND_TOOLS_MODELS = new Set([
|
|||
"anthropic/claude-opus-4.1",
|
||||
"anthropic/claude-opus-4.5",
|
||||
"anthropic/claude-opus-4.6",
|
||||
"anthropic/claude-opus-4.7",
|
||||
"anthropic/claude-sonnet-4",
|
||||
"anthropic/claude-sonnet-4.6",
|
||||
"google/gemini-1.5-flash",
|
||||
|
|
|
|||
|
|
@ -62,12 +62,13 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
|
|||
// Filter out non-Anthropic blocks (reasoning, thoughtSignature, etc.) before sending to the API
|
||||
const sanitizedMessages = filterNonAnthropicBlocks(messages)
|
||||
|
||||
// Add 1M context beta flag if enabled for supported models (Claude Sonnet 4/4.5/4.6, Opus 4.6)
|
||||
// Add 1M context beta flag if enabled for supported models (Claude Sonnet 4/4.5/4.6, Opus 4.6/4.7)
|
||||
if (
|
||||
(modelId === "claude-sonnet-4-20250514" ||
|
||||
modelId === "claude-sonnet-4-5" ||
|
||||
modelId === "claude-sonnet-4-6" ||
|
||||
modelId === "claude-opus-4-6") &&
|
||||
modelId === "claude-opus-4-6" ||
|
||||
modelId === "claude-opus-4-7") &&
|
||||
this.options.anthropicBeta1MContext
|
||||
) {
|
||||
betas.push("context-1m-2025-08-07")
|
||||
|
|
@ -82,6 +83,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
|
|||
case "claude-sonnet-4-6":
|
||||
case "claude-sonnet-4-5":
|
||||
case "claude-sonnet-4-20250514":
|
||||
case "claude-opus-4-7":
|
||||
case "claude-opus-4-6":
|
||||
case "claude-opus-4-5-20251101":
|
||||
case "claude-opus-4-1-20250805":
|
||||
|
|
@ -147,6 +149,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
|
|||
case "claude-sonnet-4-6":
|
||||
case "claude-sonnet-4-5":
|
||||
case "claude-sonnet-4-20250514":
|
||||
case "claude-opus-4-7":
|
||||
case "claude-opus-4-6":
|
||||
case "claude-opus-4-5-20251101":
|
||||
case "claude-opus-4-1-20250805":
|
||||
|
|
@ -316,7 +319,8 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
|
|||
(id === "claude-sonnet-4-20250514" ||
|
||||
id === "claude-sonnet-4-5" ||
|
||||
id === "claude-sonnet-4-6" ||
|
||||
id === "claude-opus-4-6") &&
|
||||
id === "claude-opus-4-6" ||
|
||||
id === "claude-opus-4-7") &&
|
||||
this.options.anthropicBeta1MContext
|
||||
) {
|
||||
// Use the tier pricing for 1M context
|
||||
|
|
|
|||
|
|
@ -263,6 +263,11 @@ export const parseOpenRouterModel = ({
|
|||
modelInfo.maxTokens = anthropicModels["claude-opus-4-6"].maxTokens
|
||||
}
|
||||
|
||||
// Set claude-opus-4.7 model to use the correct configuration
|
||||
if (id === "anthropic/claude-opus-4.7") {
|
||||
modelInfo.maxTokens = anthropicModels["claude-opus-4-7"].maxTokens
|
||||
}
|
||||
|
||||
// Ensure correct reasoning handling for Claude Haiku 4.5 on OpenRouter
|
||||
// Use budget control and disable effort-based reasoning fallback
|
||||
if (id === "anthropic/claude-haiku-4.5") {
|
||||
|
|
|
|||
|
|
@ -349,7 +349,8 @@ function getSelectedModel({
|
|||
(id === "claude-sonnet-4-20250514" ||
|
||||
id === "claude-sonnet-4-5" ||
|
||||
id === "claude-sonnet-4-6" ||
|
||||
id === "claude-opus-4-6") &&
|
||||
id === "claude-opus-4-6" ||
|
||||
id === "claude-opus-4-7") &&
|
||||
apiConfiguration.anthropicBeta1MContext &&
|
||||
baseInfo
|
||||
) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue