Model Slot Mapping
Claude Code has a built-in /model command that switches between three model slots: haiku (fast), sonnet (balanced), and opus (powerful). By default, these map to Anthropic models, but Claudex lets you map each slot to any provider’s model.
Configuration
Section titled “Configuration”Add a [profiles.models] table to any profile:
[[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"When you type /model sonnet inside Claude Code, Claudex resolves it to grok-3-beta. The /model opus command maps to grok-3-beta, and so on.
How It Works
Section titled “How It Works”When launching Claude Code, Claudex sets three environment variables:
| Environment Variable | Description |
|---|---|
ANTHROPIC_DEFAULT_HAIKU_MODEL | Model name for the haiku slot |
ANTHROPIC_DEFAULT_SONNET_MODEL | Model name for the sonnet slot |
ANTHROPIC_DEFAULT_OPUS_MODEL | Model name for the opus slot |
Claude Code reads these variables to populate its /model switcher. If a slot is not configured in the profile, the profile’s default_model is used as the fallback.
Provider Model Mapping Examples
Section titled “Provider Model Mapping Examples”Grok (xAI)
Section titled “Grok (xAI)”[profiles.models]haiku = "grok-3-mini-beta"sonnet = "grok-3-beta"opus = "grok-3-beta"OpenAI
Section titled “OpenAI”[profiles.models]haiku = "gpt-4o-mini"sonnet = "gpt-4o"opus = "o1"DeepSeek
Section titled “DeepSeek”[profiles.models]haiku = "deepseek-chat"sonnet = "deepseek-chat"opus = "deepseek-reasoner"Google Gemini
Section titled “Google Gemini”[profiles.models]haiku = "gemini-2.0-flash"sonnet = "gemini-2.5-pro"opus = "gemini-2.5-pro"ChatGPT Codex (Subscription)
Section titled “ChatGPT Codex (Subscription)”[profiles.models]haiku = "codex-mini-latest"sonnet = "gpt-5.3-codex"opus = "gpt-5.3-codex"Claude (Subscription)
Section titled “Claude (Subscription)”[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"Mistral
Section titled “Mistral”[profiles.models]haiku = "mistral-small-latest"sonnet = "mistral-large-latest"opus = "mistral-large-latest"Ollama (Local)
Section titled “Ollama (Local)”[profiles.models]haiku = "qwen2.5:7b"sonnet = "qwen2.5:32b"opus = "qwen2.5:72b"Default Behavior
Section titled “Default Behavior”If [profiles.models] is not specified, all three slots fall back to the profile’s default_model. This means /model haiku, /model sonnet, and /model opus all use the same model.
Environment Variable Override
Section titled “Environment Variable Override”You can override slots without modifying the config by setting environment variables directly:
ANTHROPIC_DEFAULT_HAIKU_MODEL=my-fast-model claudex run grokEnvironment variables take precedence over profile configuration.