From ce950d78f424dcaf9f5d6a03ce80ab141130eb1d Mon Sep 17 00:00:00 2001 From: David Brailovsky Date: Thu, 8 Oct 2026 11:20:26 +0200 Subject: [PATCH] fix(ai): use models.dev metadata for Claude 5.5 models Remove hardcoded Opus 5.5, Sonnet 5.5, and Haiku 5.5 fallbacks now that models.dev lists them. Fix the Sonnet 5.5 test to expect the official cache read price of 0.1. --- packages/ai/scripts/generate-models.ts | 85 ------------------------- packages/ai/test/supports-xhigh.test.ts | 2 +- 2 files changed, 1 insertion(+), 86 deletions(-) diff --git a/packages/ai/scripts/generate-models.ts b/packages/ai/scripts/generate-models.ts index 9163028c4..9b962ccc6 100644 --- a/packages/ai/scripts/generate-models.ts +++ b/packages/ai/scripts/generate-models.ts @@ -2726,91 +2726,6 @@ async function generateModels() { !((model.provider === "opencode" || model.provider === "opencode-go") && model.id === "gpt-5.3-codex-spark"), ); - // Add Claude Opus 5.5 until models.dev includes it. - // https://platform.claude.com/docs/en/models/opus-5-5/overview - if (!allModels.some((model) => model.provider === "anthropic" && model.id === "claude-opus-5-5")) { - allModels.push({ - id: "claude-opus-5-5", - name: "Claude Opus 5.5", - api: "anthropic-messages", - provider: "anthropic", - baseUrl: "https://api.anthropic.com", - reasoning: true, - thinkingLevelMap: { - off: null, - minimal: null, - low: "low", - medium: "medium", - high: "high", - xhigh: "xhigh", - max: "max", - }, - input: ["text", "image"], - cost: { input: 4, output: 20, cacheRead: 0.2, cacheWrite: 5 }, - contextWindow: 1000000, - maxTokens: 128000, - }); - } - - // Add Claude Sonnet 5.5 until models.dev includes it. - // https://platform.claude.com/docs/en/models/sonnet-5-5/overview - if (!allModels.some((model) => model.provider === "anthropic" && model.id === "claude-sonnet-5-5")) { - allModels.push({ - id: "claude-sonnet-5-5", - name: "Claude Sonnet 5.5", - api: "anthropic-messages", - provider: "anthropic", - baseUrl: "https://api.anthropic.com", - reasoning: true, - thinkingLevelMap: { - off: null, - minimal: null, - low: "low", - medium: "medium", - high: "high", - xhigh: "xhigh", - max: "max", - }, - input: ["text", "image"], - cost: { input: 2, output: 10, cacheRead: 0.2, cacheWrite: 2.5 }, - contextWindow: 1000000, - maxTokens: 128000, - }); - } - - // Add Claude Haiku 5.5 until models.dev includes it. Prompts over 100k input tokens - // are billed at 5x for the whole request. - // https://platform.claude.com/docs/en/models/haiku-5-5/overview - if (!allModels.some((model) => model.provider === "anthropic" && model.id === "claude-haiku-5-5")) { - allModels.push({ - id: "claude-haiku-5-5", - name: "Claude Haiku 5.5", - api: "anthropic-messages", - provider: "anthropic", - baseUrl: "https://api.anthropic.com", - reasoning: true, - thinkingLevelMap: { - off: null, - minimal: null, - low: "low", - medium: "medium", - high: "high", - xhigh: "xhigh", - max: "max", - }, - input: ["text", "image"], - cost: { - input: 0.1, - output: 0.5, - cacheRead: 0.01, - cacheWrite: 0.125, - tiers: [{ inputTokensAbove: 100000, input: 0.5, output: 2.5, cacheRead: 0.05, cacheWrite: 0.625 }], - }, - contextWindow: 1000000, - maxTokens: 128000, - }); - } - // The authenticated Copilot catalog advertised these models on 2026-09-22, // but models.dev did not include them yet. const missingCopilotModels: Model[] = [ diff --git a/packages/ai/test/supports-xhigh.test.ts b/packages/ai/test/supports-xhigh.test.ts index dca51aecb..664fe4043 100644 --- a/packages/ai/test/supports-xhigh.test.ts +++ b/packages/ai/test/supports-xhigh.test.ts @@ -42,7 +42,7 @@ describe("getSupportedThinkingLevels", () => { it("includes Claude Sonnet 5.5 with managed effort levels and official pricing", () => { const model = getModel("anthropic", "claude-sonnet-5-5"); expect(model).toMatchObject({ - cost: { input: 2, output: 10, cacheRead: 0.2, cacheWrite: 2.5 }, + cost: { input: 2, output: 10, cacheRead: 0.1, cacheWrite: 2.5 }, contextWindow: 1_000_000, maxTokens: 128_000, compat: {