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

This commit is contained in:
Armin Ronacher 2026-09-28 20:46:38 +02:00
parent 11894012dd
commit c90d9ea586
4 changed files with 53 additions and 3 deletions

View file

@ -591,6 +591,7 @@ function supportsAnthropicMidConvoEffort(modelId: string): boolean {
const id = modelId.toLowerCase().replace(/^~?anthropic\//, "");
return (
/^claude-opus-(?:5|5[.-]5)(?:-\d{8})?$/.test(id) ||
/^claude-sonnet-5[.-]5(?:-\d{8})?$/.test(id) ||
/^claude-(?:fable|mythos)-5(?:[.-]1)(?:-\d{8})?$/.test(id)
);
}
@ -598,6 +599,7 @@ function supportsAnthropicMidConvoEffort(modelId: string): boolean {
function supportsAnthropicMidConvoSystemMessages(modelId: string): boolean {
return (
/^claude-opus-(?:4[.-]8|5(?:[.-]5)?)(?:-\d{8})?$/.test(modelId) ||
/^claude-sonnet-5[.-]5(?:-\d{8})?$/.test(modelId) ||
/^claude-(?:fable|mythos)-5(?:[.-]1)?(?:-\d{8})?$/.test(modelId)
);
}
@ -629,7 +631,9 @@ function isAnthropicTemperatureUnsupportedModel(modelId: string): boolean {
id.includes("opus-4-8") ||
id.includes("opus-4.8") ||
id.includes("opus-5") ||
id.includes("opus.5")
id.includes("opus.5") ||
id.includes("sonnet-5-5") ||
id.includes("sonnet-5.5")
);
}
@ -2720,6 +2724,32 @@ async function generateModels() {
});
}
// 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,
});
}
// The authenticated Copilot catalog advertised these models on 2026-09-22,
// but models.dev did not include them yet.
const missingCopilotModels: Model<Api>[] = [
@ -2771,9 +2801,10 @@ async function generateModels() {
candidate.contextWindow = 1000000;
}
// models.dev may list Opus 5.5 before its effort metadata is complete.
// models.dev may list Opus 5.5 and Sonnet 5.5 before their effort metadata is complete.
if (
(candidate.provider === "anthropic" && candidate.id === "claude-opus-5-5") ||
(candidate.provider === "anthropic" &&
(candidate.id === "claude-opus-5-5" || candidate.id === "claude-sonnet-5-5")) ||
(candidate.provider === "github-copilot" && candidate.id === "claude-opus-5.5")
) {
mergeThinkingLevelMap(candidate, {