diff --git a/src/config/unified-config-types.ts b/src/config/unified-config-types.ts index 0834ad48..4653f3a2 100644 --- a/src/config/unified-config-types.ts +++ b/src/config/unified-config-types.ts @@ -175,8 +175,12 @@ export interface CopilotConfig { rate_limit: number | null; /** Wait instead of error when rate limit is hit (default: true) */ wait_on_limit: boolean; - /** Selected model (default: claude-opus-4-5-20250514) */ + /** Default model ID (e.g., claude-opus-4-5-20250514) */ model: string; + /** Model mapping for Claude tiers - maps opus/sonnet/haiku to specific models */ + opus_model?: string; + sonnet_model?: string; + haiku_model?: string; } /** diff --git a/src/copilot/copilot-executor.ts b/src/copilot/copilot-executor.ts index da86d3cc..77fd7623 100644 --- a/src/copilot/copilot-executor.ts +++ b/src/copilot/copilot-executor.ts @@ -31,15 +31,23 @@ export async function getCopilotStatus(config: CopilotConfig): Promise { + // Use mapped models if configured, otherwise fall back to default model + const opusModel = config.opus_model || config.model; + const sonnetModel = config.sonnet_model || config.model; + const haikuModel = config.haiku_model || config.model; + return { ANTHROPIC_BASE_URL: `http://localhost:${config.port}`, ANTHROPIC_AUTH_TOKEN: 'dummy', // copilot-api handles auth internally ANTHROPIC_MODEL: config.model, - ANTHROPIC_DEFAULT_SONNET_MODEL: config.model, - ANTHROPIC_SMALL_FAST_MODEL: config.model, - ANTHROPIC_DEFAULT_HAIKU_MODEL: config.model, + // Model tier mapping - allows different models for opus/sonnet/haiku + ANTHROPIC_DEFAULT_OPUS_MODEL: opusModel, + ANTHROPIC_DEFAULT_SONNET_MODEL: sonnetModel, + ANTHROPIC_SMALL_FAST_MODEL: haikuModel, + ANTHROPIC_DEFAULT_HAIKU_MODEL: haikuModel, // Disable non-essential traffic to avoid rate limiting DISABLE_NON_ESSENTIAL_MODEL_CALLS: '1', CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: '1',