feat: update CLAUDE_MODELS to use cc/* 9router model IDs as defaults

This commit is contained in:
Zac Gaetano 2026-05-29 01:05:01 -04:00
parent 2eb6530be3
commit 13992ef00f

View file

@ -1,28 +1,40 @@
/** /**
* Centralized Model Definitions * Centralized Model Definitions
* Single source of truth for all supported AI models * Single source of truth for all supported AI models
*
* IMPORTANT: Claude model values must be the exact string accepted by the
* Claude Code SDK's `options.model` field. When routing through 9router,
* models are prefixed with "cc/" (e.g. "cc/claude-sonnet-4-6").
* The DEFAULT is used as the initial localStorage value and as the SDK
* fallback when the user has not selected a model.
*/ */
/** /**
* Claude (Anthropic) Models * Claude (Anthropic / 9router) Models
* *
* Note: Claude uses two different formats: * When ANTHROPIC_BASE_URL points at 9router the model IDs must include the
* - SDK format ('sonnet', 'opus') - used by the UI and claude-sdk.js * "cc/" namespace prefix that 9router adds. The frontend fetches the live
* - API format ('claude-sonnet-4.5') - used by slash commands for display * list from /api/models and uses these constants only as the static fallback.
*/ */
export const CLAUDE_MODELS = { export const CLAUDE_MODELS = {
// Models in SDK format (what the actual SDK accepts) // Static fallback list — used when /api/models is unreachable.
// Values must match exactly what the Claude Code SDK (or 9router) accepts.
OPTIONS: [ OPTIONS: [
{ value: "opus", label: "Opus" }, // 9router namespaced IDs (preferred when ANTHROPIC_BASE_URL is set)
{ value: "sonnet", label: "Sonnet" }, { value: "cc/claude-sonnet-4-6", label: "Claude Sonnet 4.6 (9router)" },
{ value: "haiku", label: "Haiku" }, { value: "cc/claude-opus-4-5", label: "Claude Opus 4.5 (9router)" },
{ value: "claude-opus-4-6", label: "Opus 4.6" }, { value: "cc/claude-haiku-3-5", label: "Claude Haiku 3.5 (9router)" },
{ value: "opusplan", label: "Opus Plan" }, // Direct Anthropic SDK aliases (used when hitting Anthropic directly)
{ value: "sonnet[1m]", label: "Sonnet [1M]" }, { value: "sonnet", label: "Sonnet (latest)" },
{ value: "opus[1m]", label: "Opus [1M]" }, { value: "opus", label: "Opus (latest)" },
{ value: "haiku", label: "Haiku (latest)" },
{ value: "sonnet[1m]", label: "Sonnet [1M ctx]" },
{ value: "opus[1m]", label: "Opus [1M ctx]" },
], ],
DEFAULT: "opus", // Default selected model — prefer 9router cc/ model when available.
// Can be overridden at runtime from localStorage("claude-model").
DEFAULT: "cc/claude-sonnet-4-6",
}; };
/** /**
@ -41,7 +53,7 @@ export const CURSOR_MODELS = {
{ value: "composer-1", label: "Composer 1" }, { value: "composer-1", label: "Composer 1" },
{ value: "auto", label: "Auto" }, { value: "auto", label: "Auto" },
{ value: "sonnet-4.5", label: "Claude 4.5 Sonnet" }, { value: "sonnet-4.5", label: "Claude 4.5 Sonnet" },
{ value: "sonnet-4.5-thinking", label: "Claude 4.5 Sonnet (Thinking)" }, { value: "sonnet-4.5-thinking", label: "Claude 4.5 Sonnet (Thinking)"},
{ value: "opus-4.5", label: "Claude 4.5 Opus" }, { value: "opus-4.5", label: "Claude 4.5 Opus" },
{ value: "gpt-5.1-codex", label: "GPT-5.1 Codex" }, { value: "gpt-5.1-codex", label: "GPT-5.1 Codex" },
{ value: "gpt-5.1-codex-high", label: "GPT-5.1 Codex High" }, { value: "gpt-5.1-codex-high", label: "GPT-5.1 Codex High" },
@ -65,7 +77,7 @@ export const CODEX_MODELS = {
{ value: "gpt-5.3-codex", label: "GPT-5.3 Codex" }, { value: "gpt-5.3-codex", label: "GPT-5.3 Codex" },
{ value: "gpt-5.2-codex", label: "GPT-5.2 Codex" }, { value: "gpt-5.2-codex", label: "GPT-5.2 Codex" },
{ value: "gpt-5.2", label: "GPT-5.2" }, { value: "gpt-5.2", label: "GPT-5.2" },
{ value: "gpt-5.1-codex-max", label: "GPT-5.1 Codex Max" }, { value: "gpt-5.1-codex-max", label: "GPT-5.1 Codex Max"},
{ value: "o3", label: "O3" }, { value: "o3", label: "O3" },
{ value: "o4-mini", label: "O4-mini" }, { value: "o4-mini", label: "O4-mini" },
], ],
@ -87,10 +99,7 @@ export const GEMINI_MODELS = {
{ value: "gemini-2.5-flash-lite", label: "Gemini 2.5 Flash Lite" }, { value: "gemini-2.5-flash-lite", label: "Gemini 2.5 Flash Lite" },
{ value: "gemini-2.0-flash", label: "Gemini 2.0 Flash" }, { value: "gemini-2.0-flash", label: "Gemini 2.0 Flash" },
{ value: "gemini-2.0-pro-exp", label: "Gemini 2.0 Pro Experimental" }, { value: "gemini-2.0-pro-exp", label: "Gemini 2.0 Pro Experimental" },
{ { value: "gemini-2.0-flash-thinking-exp", label: "Gemini 2.0 Flash Thinking" },
value: "gemini-2.0-flash-thinking-exp",
label: "Gemini 2.0 Flash Thinking",
},
], ],
DEFAULT: "gemini-3.1-pro-preview", DEFAULT: "gemini-3.1-pro-preview",