feat(ai,coding-agent): add Claude Opus 5.5 support

This commit is contained in:
Armin Ronacher 2026-09-22 18:46:17 +02:00
parent 81274f0e18
commit b4588f26af
4 changed files with 49 additions and 2 deletions

View file

@ -4,6 +4,7 @@
### Added
- Added Claude Opus 5.5 to the built-in Anthropic model catalog with adaptive thinking, 1M context, and official pricing metadata.
- Added Grok 4.7 to the built-in xAI model catalog with long-context pricing metadata.
### Fixed

View file

@ -580,14 +580,14 @@ const MID_CONVO_EFFORT_UNSUPPORTED_ANTHROPIC_MODELS = new Set(["openrouter:anthr
function supportsAnthropicMidConvoEffort(modelId: string): boolean {
const id = modelId.toLowerCase().replace(/^~?anthropic\//, "");
return (
/^claude-opus-5(?:-\d{8})?$/.test(id) ||
/^claude-opus-(?:5|5[.-]5)(?:-\d{8})?$/.test(id) ||
/^claude-(?:fable|mythos)-5(?:[.-]1)(?:-\d{8})?$/.test(id)
);
}
function supportsAnthropicMidConvoSystemMessages(modelId: string): boolean {
return (
/^claude-opus-(?:4[.-]8|5)(?:-\d{8})?$/.test(modelId) ||
/^claude-opus-(?:4[.-]8|5(?:[.-]5)?)(?:-\d{8})?$/.test(modelId) ||
/^claude-(?:fable|mythos)-5(?:[.-]1)?(?:-\d{8})?$/.test(modelId)
);
}
@ -2662,6 +2662,32 @@ 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,
});
}
// Temporary overrides until upstream model metadata is corrected.
for (const candidate of allModels) {
if (candidate.provider === "github-copilot" && GITHUB_COPILOT_EXTENDED_CONTEXT_MODELS.has(candidate.id)) {

View file

@ -23,6 +23,22 @@ describe("getSupportedThinkingLevels", () => {
expect(getSupportedThinkingLevels(model!)).toContain("max");
});
it("includes Claude Opus 5.5 with its always-on effort levels and official pricing", () => {
const model = getModel("anthropic", "claude-opus-5-5");
expect(model).toMatchObject({
cost: { input: 4, output: 20, cacheRead: 0.2, cacheWrite: 5 },
contextWindow: 1_000_000,
maxTokens: 128_000,
compat: {
forceAdaptiveThinking: true,
supportsMidConvoEffort: true,
supportsMidConvoSystemMessages: true,
supportsMidConvoToolChanges: true,
},
});
expect(getSupportedThinkingLevels(model)).toEqual(["low", "medium", "high", "xhigh", "max"]);
});
it("includes max but not xhigh for Anthropic Sonnet 4.6 on anthropic-messages API", () => {
const model = getModel("anthropic", "claude-sonnet-4-6");
expect(model).toBeDefined();

View file

@ -2,6 +2,10 @@
## [Unreleased]
### Added
- Added inherited Claude Opus 5.5 support for Anthropic with adaptive thinking and a 1M context window.
### Changed
- Changed the default xAI model to Grok 4.7.