Use /model in Claude Code
Point Claude Code at /model with two settings, and keep its commands and its Claude models.
Checked November 24, 2026
Claude Code reads the API's address and the key from two settings. Point them at /model and it works as before: the same commands and the same Claude models, paid from your /model balance.
Before you start
- A /model API key: create one on the API keys page and add credit on the credits page.
Set it up
For one terminal session, set the two variables and start Claude Code:
export ANTHROPIC_BASE_URL="https://api.slashmodel.com"
export ANTHROPIC_AUTH_TOKEN="$SLASHMODEL_API_KEY"
claudeTo keep them, put them in Claude Code's settings file, ~/.claude/settings.json, with your key:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.slashmodel.com",
"ANTHROPIC_AUTH_TOKEN": "sk-sm-…"
}
}- The base URL has no
/v1: Claude Code adds the path itself. - Use
ANTHROPIC_AUTH_TOKENfor the key. Claude Code sends it as a Bearer token and uses it at once; withANTHROPIC_API_KEYit first asks you to approve the key. - Keep the key out of a project's
.claude/settings.jsonif the project is shared: that file is usually committed.
Pick a model
Claude Code's own model names work as they are. With these settings, /model sonnet gets you Claude Sonnet 5.5, opus Opus 5.5, haiku Haiku 5.5 and fable Fable 5.2. The guide to the /model command covers every way to choose.
Good to know
- Only Claude models work this way. Claude Code speaks Anthropic's Messages format, which /model serves for Claude models. GPT, Gemini and Grok models need a program in between that translates. Claude Code Router is one.
- Prompt caching works, so the context Claude Code sends again on every turn is billed at the cache price. See prompt caching.
- A key can cap what a session costs. Give Claude Code a key of its own with a daily or monthly limit: see key settings.
- Every request shows under Usage with its tokens and its cost.