Use Kimi in Claude Code
Run Claude Code on Moonshot AI's Kimi K3.1 Pro with four settings and a /model key. Kimi answers in Anthropic's format, so no router is needed.
Checked November 28, 2026
Kimi models answer in Anthropic's Messages format, the one Claude Code speaks, so Claude Code runs them straight from /model, with no program in between. We ran these steps with Claude Code 2.1.332 against /model, on 28 Nov 2026.
Before you start
- A /model API key: create one on the API keys page and add credit on the credits page.
- Claude Code.
Set it up
For one terminal session, set four variables and start Claude Code:
export ANTHROPIC_BASE_URL="https://api.slashmodel.com"
export ANTHROPIC_AUTH_TOKEN="$SLASHMODEL_API_KEY"
export ANTHROPIC_MODEL="kimi-k3.1-pro"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="kimi-k3.1-pro"
claudeANTHROPIC_BASE_URLandANTHROPIC_AUTH_TOKENpoint Claude Code at /model, as in the Claude Code guide. The base URL has no/v1.ANTHROPIC_MODELis the model Claude Code runs on.ANTHROPIC_DEFAULT_HAIKU_MODELis the model behind Claude Code'shaikuname, which Claude Code also uses for small jobs in the background. Kimi has no smaller model here, so it is Kimi K3.1 Pro too. Without it,haikustays Claude Haiku 5.5.
To 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-…",
"ANTHROPIC_MODEL": "kimi-k3.1-pro",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-k3.1-pro"
}
}Every session then starts on that model. Keep the key out of a project's .claude/settings.json if the project is shared: that file is usually committed.
Pick a model
- Kimi K3.1 Pro,
kimi-k3.1-pro: the model in the settings above. It reads images as well as text. - Kimi K3,
kimi-k3: the model before it, which costs more and takes text only. To use it, setANTHROPIC_MODELtokimi-k3.
Each model's price is on the pricing page.
Good to know
- Little of the prompt was read from the cache. Claude Code sends its long instructions again with every request, and in our runs under 2% of the prompt tokens came from the cache. Most of each request is billed at the input price.
- Claude Code warns that it doesn't recognise the model's name, then goes on: in our runs it wrote a file and ran it, as it does on Claude.
- Claude Code's other names, such as
sonnet, still mean Claude models.claude --model sonnetstarts a session on Claude Sonnet 5.5: see the /model command. - 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 model, its tokens and its cost.