fix(agent-execute): refresh retired OpenRouter Claude slugs (#2357 Finding C) (#2365)

The OpenAI-compat path (used for OPENROUTER_API_KEY callers) still
referenced the Oct-2025 retired model IDs:

- defaultModel: anthropic/claude-3.5-sonnet    → anthropic/claude-sonnet-4-6
- haiku alias:  anthropic/claude-3.5-haiku     → anthropic/claude-haiku-4-5
- sonnet alias: anthropic/claude-3.5-sonnet    → anthropic/claude-sonnet-4-6
- opus alias:   anthropic/claude-3-opus        → anthropic/claude-opus-4-8

Aligns with MODEL_MAP (the canonical Anthropic resolution table).
OPENROUTER_DEFAULT_MODEL still wins for callers who want to pin a
different slug.

Companion fix to PR #2358 (Finding A, merged in b12788777). Together
the two cover the entire current frontier family across both the
Anthropic native path and the OpenRouter vendored path.

Refs #2357.
This commit is contained in:
rUv authored and GitHub committed 2026-06-12 09:48:20 -04:00
1 parent b12788777a
commit 99bd9db590
1 file changed
+11 -5
@@ -132,7 +132,11 @@ export async function callAnthropicMessages(input: AnthropicCallInput): Promise<
apiKey: openrouterKey,
baseUrl: process.env.OPENROUTER_BASE_URL || 'https://openrouter.ai/api',
providerLabel: 'openrouter',
defaultModel: process.env.OPENROUTER_DEFAULT_MODEL || 'anthropic/claude-3.5-sonnet',
// #2357 Finding C: anthropic/claude-3.5-sonnet was retired Oct 2025.
// Default to the same canonical family the rest of the resolver uses
// (MODEL_MAP). `OPENROUTER_DEFAULT_MODEL` still wins for callers who
// want to pin a specific OpenRouter slug.
defaultModel: process.env.OPENROUTER_DEFAULT_MODEL || 'anthropic/claude-sonnet-4-6',
});
}
if (useOllama && ollamaKey) {
@@ -392,10 +396,12 @@ async function callOpenAICompat(
function resolveOpenAICompatModel(input: string | undefined, fallback: string): string {
if (!input) return fallback;
// Logical Claude names → OpenRouter Anthropic-vendored names
if (input === 'haiku') return 'anthropic/claude-3.5-haiku';
if (input === 'sonnet' || input === 'inherit') return 'anthropic/claude-3.5-sonnet';
if (input === 'opus') return 'anthropic/claude-3-opus';
// Logical Claude names → OpenRouter Anthropic-vendored names.
// #2357 Finding C: the 3.5 / 3-opus slugs were retired Oct 2025; align with
// MODEL_MAP (claude-haiku-4-5 / claude-sonnet-4-6 / claude-opus-4-8).
if (input === 'haiku') return 'anthropic/claude-haiku-4-5';
if (input === 'sonnet' || input === 'inherit') return 'anthropic/claude-sonnet-4-6';
if (input === 'opus') return 'anthropic/claude-opus-4-8';
return input;
}