From e313a3391fd5a6c55421e54f58af86adf241114a Mon Sep 17 00:00:00 2001 From: jackmazac Date: Thu, 30 Apr 2026 17:14:25 -0700 Subject: [PATCH] provider: split Bedrock Claude into 200K and 1M catalog entries splitBedrock1m duplicates supported Opus/Sonnet rows with -1m suffix, 200K default without anthropicBeta, 1M row with context-1m beta except native Opus 4.7 which keeps existing betas. --- packages/opencode/src/provider/provider.ts | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/packages/opencode/src/provider/provider.ts b/packages/opencode/src/provider/provider.ts index 24b599db08fd..4ec39c787565 100644 --- a/packages/opencode/src/provider/provider.ts +++ b/packages/opencode/src/provider/provider.ts @@ -1037,6 +1037,37 @@ function fromModelsDevModel(provider: ModelsDev.Provider, model: ModelsDev.Model } } +const BEDROCK_1M_MODELS = ["claude-opus-4-6", "claude-opus-4-7", "claude-sonnet-4-5", "claude-sonnet-4-6"] +const BEDROCK_1M_BETA = "context-1m-2025-08-07" +const BEDROCK_1M_NATIVE = ["claude-opus-4-7"] + +function splitBedrock1m(pid: string, models: Record) { + if (pid !== "amazon-bedrock") return + for (const [id, model] of Object.entries(models)) { + if (!BEDROCK_1M_MODELS.some((m) => model.api.id.includes(m))) continue + if (id.endsWith("-1m")) continue + const native = BEDROCK_1M_NATIVE.some((m) => model.api.id.includes(m)) + const name = model.name.replace(/\s+\((200K|1M Experimental)\)$/i, "") + const opts = { ...model.options } + const raw = opts["anthropicBeta"] + const existing = (Array.isArray(raw) ? raw : typeof raw === "string" ? [raw] : []).filter( + (item): item is string => typeof item === "string", + ) + delete opts["anthropicBeta"] + model.name = `${name} (200K)` + model.options = opts + model.limit = { ...model.limit, context: Math.min(model.limit.context, 200_000) } + const betas = native ? existing : [...new Set([...existing, BEDROCK_1M_BETA])] + models[`${id}-1m`] = { + ...model, + id: ModelID.make(`${id}-1m`), + name: `${name} (1M)`, + limit: { ...model.limit, context: 1_000_000 }, + options: { ...model.options, ...(betas.length > 0 ? { anthropicBeta: betas } : {}) }, + } + } +} + export function fromModelsDevProvider(provider: ModelsDev.Provider): Info { const models: Record = {} for (const [key, model] of Object.entries(provider.models)) { @@ -1061,6 +1092,7 @@ export function fromModelsDevProvider(provider: ModelsDev.Provider): Info { } } } + splitBedrock1m(provider.id, models) return { id: ProviderID.make(provider.id), source: "custom",