콘텐츠로 이동

모델 슬롯 매핑

Claude Code에는 haiku(빠름), sonnet(균형), opus(강력) 세 가지 모델 슬롯 간에 전환하는 내장 /model 명령이 있습니다. 기본적으로 Anthropic 모델에 매핑되지만, Claudex를 통해 각 슬롯을 임의의 프로바이더 모델에 매핑할 수 있습니다.

프로파일에 [profiles.models] 테이블을 추가합니다:

[[profiles]]
name = "grok"
provider_type = "OpenAICompatible"
base_url = "https://api.x.ai/v1"
api_key = "xai-..."
default_model = "grok-3-beta"
[profiles.models]
haiku = "grok-3-mini-beta"
sonnet = "grok-3-beta"
opus = "grok-3-beta"

Claude Code 내에서 /model sonnet을 입력하면 Claudex가 grok-3-beta로 해석합니다. /model opus 명령은 grok-3-beta에, 나머지도 같은 방식으로 매핑됩니다.

Claude Code를 실행할 때 Claudex는 세 가지 환경 변수를 설정합니다:

환경 변수설명
ANTHROPIC_DEFAULT_HAIKU_MODELhaiku 슬롯의 모델 이름
ANTHROPIC_DEFAULT_SONNET_MODELsonnet 슬롯의 모델 이름
ANTHROPIC_DEFAULT_OPUS_MODELopus 슬롯의 모델 이름

Claude Code가 이 변수를 읽어 /model 전환기를 구성합니다. 프로파일에서 슬롯이 설정되지 않은 경우, 프로파일의 default_model이 폴백으로 사용됩니다.

[profiles.models]
haiku = "grok-3-mini-beta"
sonnet = "grok-3-beta"
opus = "grok-3-beta"
[profiles.models]
haiku = "gpt-4o-mini"
sonnet = "gpt-4o"
opus = "o1"
[profiles.models]
haiku = "deepseek-chat"
sonnet = "deepseek-chat"
opus = "deepseek-reasoner"
[profiles.models]
haiku = "gemini-2.0-flash"
sonnet = "gemini-2.5-pro"
opus = "gemini-2.5-pro"
[profiles.models]
haiku = "codex-mini-latest"
sonnet = "gpt-5.3-codex"
opus = "gpt-5.3-codex"
[profiles.models]
haiku = "claude-haiku-4-20250514"
sonnet = "claude-sonnet-4-20250514"
opus = "claude-opus-4-20250514"
[profiles.models]
haiku = "gemma2-9b-it"
sonnet = "llama-3.3-70b-versatile"
opus = "llama-3.3-70b-versatile"
[profiles.models]
haiku = "mistral-small-latest"
sonnet = "mistral-large-latest"
opus = "mistral-large-latest"
[profiles.models]
haiku = "qwen2.5:7b"
sonnet = "qwen2.5:32b"
opus = "qwen2.5:72b"

[profiles.models]가 지정되지 않으면 세 슬롯 모두 프로파일의 default_model로 폴백됩니다. 즉, /model haiku, /model sonnet, /model opus 모두 같은 모델을 사용합니다.

설정을 수정하지 않고 환경 변수를 직접 설정하여 슬롯을 오버라이드할 수 있습니다:

Terminal window
ANTHROPIC_DEFAULT_HAIKU_MODEL=my-fast-model claudex run grok

환경 변수가 프로파일 설정보다 우선합니다.