Kimi’s K2 Turbo variants trade some of the deep-reasoning focus for raw speed, which is exactly what you want in an interactive coding loop. Pair one with OpenCode — free, open, terminal-first — and you get a responsive agent that doesn’t keep you waiting between edits, at pay-per-token rates.
This is the speed-first OpenCode + Kimi setup. For OpenCode’s general provider model, see OpenCode custom providers.
Why Turbo for an agent
Agentic coding is a tight loop of read, edit, run, read again. A faster model shortens every step, so the session feels fluid rather than stop-start. K2 Turbo is built for that throughput. Keep K2 Thinking in reserve for the genuinely hard problems where reasoning depth beats speed.
Step 1: Install OpenCode and get a Moonshot key
npm install -g opencode-ai
Sign up on the Moonshot platform and create an API key. On Windows, WSL gives the cleaner shell — see install OpenCode on Windows with WSL.
Step 2: Add the Kimi provider
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"moonshot": {
"npm": "@ai-sdk/openai-compatible",
"name": "Moonshot Kimi",
"options": {
"baseURL": "https://api.moonshot.ai/v1",
"apiKey": "{env:MOONSHOT_API_KEY}"
},
"models": {
"kimi-k2-turbo": { "name": "Kimi K2 Turbo" },
"kimi-k2-thinking": { "name": "Kimi K2 Thinking" }
}
}
},
"model": "moonshot/kimi-k2-turbo"
}
Export the key:
export MOONSHOT_API_KEY="sk-your-key"
Confirm the exact model IDs on Moonshot’s docs.
Step 3: Run it
opencode
The default is moonshot/kimi-k2-turbo. Switch to Thinking in the TUI when a task needs more reasoning.
Kimi models in OpenCode
| moonshot/kimi-k2-turbo | Fast; best for interactive coding |
|---|---|
| moonshot/kimi-k2-thinking | Reasoning mode; slower, for hard tasks |
Pricing
Kimi is pay-per-token with cache-hit discounts and no flat coding plan. Turbo may carry a slightly different rate than the base model for its speed — confirm on Moonshot’s docs. Full picture in Kimi K2 pricing explained.
Troubleshooting
- Provider not found — the
providerkey (moonshot) must match themodelprefix. - Auth errors —
MOONSHOT_API_KEYnot set in the launching shell. - Format errors — you used
/anthropic; switch to/v1. - Model rejected — confirm the Turbo model ID on Moonshot.
Kimi Turbo + OpenCode checklist
- OpenCode installed
- Moonshot API key created and exported
- Provider block with /v1 base URL
- Turbo and Thinking model IDs listed
- Default set to Turbo; launched with opencode
Wrapping up
Kimi K2 Turbo with OpenCode is the setup for responsiveness: add a Moonshot provider on the /v1 endpoint, list the Turbo model, and set it as default. The high throughput keeps the agent loop fast, while K2 Thinking stays one switch away for hard problems. It’s pay-per-token with cache discounts, so cost stays low.
To run Kimi elsewhere, see run Kimi K2 Thinking with Claude Code or Kimi K2 + Aider on WSL.