This commit is contained in:
roomote-v0[bot] 2026-04-20 13:23:49 -07:00 • committed by GitHub
commit 009bcc33de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 79 additions and 1 deletions

View file

@ -70,6 +70,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-6": { "claude-opus-4-6": {
maxTokens: 128_000, // Overridden to 8k if `enableReasoningEffort` is false. maxTokens: 128_000, // Overridden to 8k if `enableReasoningEffort` is false.
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag

View file

@ -143,6 +143,30 @@ export const bedrockModels = {
maxCachePoints: 4, maxCachePoints: 4,
cachableFields: ["system", "messages", "tools"], cachableFields: ["system", "messages", "tools"],
}, },
"anthropic.claude-opus-4-7": {
maxTokens: 8192,
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag 'context-1m-2025-08-07'
supportsImages: true,
supportsPromptCache: true,
supportsReasoningBudget: 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
minTokensPerCachePoint: 1024,
maxCachePoints: 4,
cachableFields: ["system", "messages", "tools"],
// Tiered pricing for extended context (requires beta flag 'context-1m-2025-08-07')
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)
},
],
},
"anthropic.claude-opus-4-6-v1": { "anthropic.claude-opus-4-6-v1": {
maxTokens: 8192, maxTokens: 8192,
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag 'context-1m-2025-08-07' contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag 'context-1m-2025-08-07'
@ -524,6 +548,7 @@ export const BEDROCK_1M_CONTEXT_MODEL_IDS = [
"anthropic.claude-sonnet-4-20250514-v1:0", "anthropic.claude-sonnet-4-20250514-v1:0",
"anthropic.claude-sonnet-4-5-20250929-v1:0", "anthropic.claude-sonnet-4-5-20250929-v1:0",
"anthropic.claude-sonnet-4-6", "anthropic.claude-sonnet-4-6",
"anthropic.claude-opus-4-7",
"anthropic.claude-opus-4-6-v1", "anthropic.claude-opus-4-6-v1",
] as const ] as const
@ -541,6 +566,7 @@ export const BEDROCK_GLOBAL_INFERENCE_MODEL_IDS = [
"anthropic.claude-sonnet-4-6", "anthropic.claude-sonnet-4-6",
"anthropic.claude-haiku-4-5-20251001-v1:0", "anthropic.claude-haiku-4-5-20251001-v1:0",
"anthropic.claude-opus-4-5-20251101-v1:0", "anthropic.claude-opus-4-5-20251101-v1:0",
"anthropic.claude-opus-4-7",
"anthropic.claude-opus-4-6-v1", "anthropic.claude-opus-4-6-v1",
] as const ] as const

View file

@ -353,6 +353,27 @@ export const vertexModels = {
cacheReadsPrice: 0.1, cacheReadsPrice: 0.1,
supportsReasoningBudget: true, supportsReasoningBudget: true,
}, },
"claude-opus-4-7": {
maxTokens: 8192,
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag 'context-1m-2025-08-07'
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 'context-1m-2025-08-07')
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-6": { "claude-opus-4-6": {
maxTokens: 8192, maxTokens: 8192,
contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag 'context-1m-2025-08-07' contextWindow: 200_000, // Default 200K, extendable to 1M with beta flag 'context-1m-2025-08-07'
@ -592,6 +613,7 @@ export const VERTEX_1M_CONTEXT_MODEL_IDS = [
"claude-sonnet-4@20250514", "claude-sonnet-4@20250514",
"claude-sonnet-4-5@20250929", "claude-sonnet-4-5@20250929",
"claude-sonnet-4-6", "claude-sonnet-4-6",
"claude-opus-4-7",
"claude-opus-4-6", "claude-opus-4-6",
"claude-opus-4-7", "claude-opus-4-7",
] as const ] as const

View file

@ -64,11 +64,12 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
// Filter out non-Anthropic blocks (reasoning, thoughtSignature, etc.) before sending to the API // Filter out non-Anthropic blocks (reasoning, thoughtSignature, etc.) before sending to the API
const sanitizedMessages = filterNonAnthropicBlocks(messages) 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 ( if (
(modelId === "claude-sonnet-4-20250514" || (modelId === "claude-sonnet-4-20250514" ||
modelId === "claude-sonnet-4-5" || modelId === "claude-sonnet-4-5" ||
modelId === "claude-sonnet-4-6" || modelId === "claude-sonnet-4-6" ||
modelId === "claude-opus-4-7" ||
modelId === "claude-opus-4-6") && modelId === "claude-opus-4-6") &&
this.options.anthropicBeta1MContext this.options.anthropicBeta1MContext
) { ) {
@ -84,6 +85,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
case "claude-sonnet-4-6": case "claude-sonnet-4-6":
case "claude-sonnet-4-5": case "claude-sonnet-4-5":
case "claude-sonnet-4-20250514": case "claude-sonnet-4-20250514":
case "claude-opus-4-7":
case "claude-opus-4-6": case "claude-opus-4-6":
case "claude-opus-4-5-20251101": case "claude-opus-4-5-20251101":
case "claude-opus-4-1-20250805": case "claude-opus-4-1-20250805":
@ -150,6 +152,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
case "claude-sonnet-4-6": case "claude-sonnet-4-6":
case "claude-sonnet-4-5": case "claude-sonnet-4-5":
case "claude-sonnet-4-20250514": case "claude-sonnet-4-20250514":
case "claude-opus-4-7":
case "claude-opus-4-6": case "claude-opus-4-6":
case "claude-opus-4-5-20251101": case "claude-opus-4-5-20251101":
case "claude-opus-4-1-20250805": case "claude-opus-4-1-20250805":
@ -342,6 +345,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
(id === "claude-sonnet-4-20250514" || (id === "claude-sonnet-4-20250514" ||
id === "claude-sonnet-4-5" || id === "claude-sonnet-4-5" ||
id === "claude-sonnet-4-6" || id === "claude-sonnet-4-6" ||
id === "claude-opus-4-7" ||
id === "claude-opus-4-6") && id === "claude-opus-4-6") &&
this.options.anthropicBeta1MContext this.options.anthropicBeta1MContext
) { ) {

View file

@ -263,6 +263,11 @@ export const parseOpenRouterModel = ({
modelInfo.maxTokens = anthropicModels["claude-opus-4-6"].maxTokens 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 // Ensure correct reasoning handling for Claude Haiku 4.5 on OpenRouter
// Use budget control and disable effort-based reasoning fallback // Use budget control and disable effort-based reasoning fallback
if (id === "anthropic/claude-haiku-4.5") { if (id === "anthropic/claude-haiku-4.5") {