Kimi K2 Thinking is Moonshot’s reasoning model, tuned for multi-step problem solving and strong agentic behavior — a good fit when a task needs deliberate thinking rather than a quick guess. And because Moonshot ships an Anthropic-compatible endpoint, running it with Claude Code takes no proxy at all, just two environment variables.
This is the setup, the model choice, and the pricing picture. For the no-proxy approach generally, see anthropic-compatible endpoints.
Step 1: Get a Moonshot API key
Sign up on the Moonshot platform, add a little credit, and generate an API key. Kimi is pay-per-token, so a small top-up covers a lot of coding.
Step 2: Make sure Claude Code is installed
npm install -g @anthropic-ai/claude-code
Step 3: Point Claude Code at Kimi
Moonshot’s Anthropic-compatible endpoint is the key. In WSL (recommended on Windows):
export ANTHROPIC_BASE_URL="https://api.moonshot.ai/anthropic"
export ANTHROPIC_AUTH_TOKEN="sk-your-moonshot-key"
export ANTHROPIC_MODEL="kimi-k2-thinking"
claude
On native Windows PowerShell:
$env:ANTHROPIC_BASE_URL = "https://api.moonshot.ai/anthropic"
$env:ANTHROPIC_AUTH_TOKEN = "sk-your-moonshot-key"
$env:ANTHROPIC_MODEL = "kimi-k2-thinking"
claude
Confirm the exact base URL and model ID in Moonshot’s docs, since they change with releases.
Step 4: Pick the model
Kimi K2 models (confirm IDs on Moonshot)
| kimi-k2-thinking | Reasoning mode; multi-step problem solving |
|---|---|
| kimi-k2 (turbo variants) | Faster, cheaper responses |
Use K2 Thinking for hard, multi-step tasks and a faster K2 variant for quick everyday work. Set ANTHROPIC_MODEL accordingly.
Pricing
Kimi is primarily pay-per-token, billed per million input/output tokens, with cache-hit discounts when prompts reuse context. There isn’t a flat coding plan in the GLM/Alibaba sense, so cost scales with use — though the rates are low and cache hits help during agent sessions. Confirm current numbers on Moonshot’s docs; full detail in Kimi K2 pricing explained.
Verify
claude
# then: "explain this module and suggest a refactor"
If it reads files and reasons through the answer, Kimi is serving Claude Code.
Troubleshooting
- Auth errors — token not set in the current shell, or wrong key.
- Format errors — you’re on
/v1; switch to/anthropic. - “Model not found” — confirm the exact Kimi model ID on Moonshot’s docs.
- Slow/expensive — you’re on Thinking mode; switch to a faster variant for routine work.
Kimi + Claude Code checklist
- Moonshot API key created and funded
- Claude Code installed
- ANTHROPIC_BASE_URL set to the /anthropic endpoint
- ANTHROPIC_AUTH_TOKEN and ANTHROPIC_MODEL set
- Thinking for hard tasks, fast variant for routine work
Wrapping up
Running Kimi K2 Thinking with Claude Code needs no proxy: set ANTHROPIC_BASE_URL to Moonshot’s /anthropic endpoint, add your token, and choose kimi-k2-thinking. It’s pay-per-token with cache discounts, so reserve Thinking mode for tasks that need it and use a faster variant otherwise.
To use Kimi elsewhere, see Kimi K2 with Codex CLI or Kimi K2.5 Turbo + OpenCode.