Kimi Code K3 Setup: CLI Install, Plans, Claude Code & Model Choice
September 25, 2026 · kimi code · kimi code cli · kimi k3 claude code · kimi code k3 setup · kimi code pricing · kimi for coding · kimi k2.7 code · kimi k3 cline
To run Kimi K3 in Kimi Code, install the CLI (curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash on macOS/Linux, irm https://code.kimi.com/kimi-code/install.ps1 | iex on Windows), type kimi, run /login, then pick K3 with /model. You need either a Kimi membership at Plus tier or above (K3 at 256K context; Pro for the full 1M window) or a pay-as-you-go platform API key with at least $1 topped up. The harder question is not setup but model choice: K2.7 Code is roughly a quarter of K3’s output price, and K2.8 Preview now sits between them.
This guide reflects Kimi Code as of September 25, 2026: CLI 2.1.1, the Go/Plus/Pro/Max plans from September 18, and the K2.8 Preview swap on September 11. If you followed an early-August tutorial, some of your model IDs now point somewhere else.
Quick reference
| Task | Command or value |
|---|---|
| Install (macOS/Linux) | curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash |
| Install (Windows) | irm https://code.kimi.com/kimi-code/install.ps1 | iex |
| Install (Homebrew / npm) | brew install kimi-code / npm install -g @moonshot-ai/kimi-code |
| Start in a project | kimi (one-shot: kimi -p "...", resume: kimi -c) |
| Log in | /login then Kimi Code OAuth or Kimi Platform API key |
| Switch to K3 | /model, or default_model = "kimi-code/k3" in config |
| Config / MCP files | ~/.kimi-code/config.toml, ~/.kimi-code/mcp.json |
| Check state / quota | /status, /usage |
| IDE bridge | kimi acp (Zed, JetBrains), VS Code extension moonshot-ai.kimi-code |
What changed in Kimi Code since the K3 launch
Four things moved since July:
- The CLI was rewritten and renamed. The old Python
MoonshotAI/kimi-clirepo is archived in favor of MoonshotAI/kimi-code (MIT). Installing the new CLI migrates config and sessions; the binary is stillkimi. - Version 2.0 shipped on September 17. The changelog runs from 2.0.0 (Sep 17,
/desktopcommand) to 2.1.1 (Sep 24). The same week Moonshot launched Kimi Code Desktop, a GUI client for macOS and Windows. kimi-for-codingis now K2.8 Preview. On September 11, per Moonshot’s Kimi Code models page and news coverage, the default coding model ID moved from K2.7 Code to K2.8 Preview with no config change. Our K2.8 Preview breakdown covers the model itself.- New plans, with Kimi Code moved up a tier. Subscriptions, paused since mid-July when K3 demand saturated Moonshot’s GPUs, reopened on September 18 with new tiers (Go, Plus, Pro, Max). Kimi Code now starts at Plus, not the entry tier (report).
Step 1: Install Kimi Code CLI
The official script installs a single binary and needs no Node.js. From the getting-started guide:
macOS and Linux
curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash
Windows (PowerShell)
Install Git for Windows first. Kimi Code runs its shell tool through the bundled Git Bash, and if yours lives in a non-standard location you point to it with the KIMI_SHELL_PATH environment variable (absolute path to bash.exe).
irm https://code.kimi.com/kimi-code/install.ps1 | iex
Homebrew or npm (any OS)
brew install kimi-code
# or
npm install -g @moonshot-ai/kimi-code # needs Node.js 22.19.0+
Then open a new terminal so your PATH refreshes, and check it worked:
kimi --version
cd /path/to/your-project
kimi
On first launch in a repo, run /init: it analyzes the codebase and writes an AGENTS.md file the agent reads every session.
Step 2: Log in (and pick how you pay)
Type /login inside the TUI. You get two options, and they are genuinely different billing systems:
| Kimi Code OAuth (membership) | Kimi Platform API key (pay-as-you-go) | |
|---|---|---|
| Where the key comes from | Device-code login, or keys from kimi.com/code/console (max 5 active) | platform.kimi.ai console |
| Billing | Plan quota: rolling 5-hour window plus a monthly total | Per token: K3 at $0.30 cached / $3 input / $15 output per 1M |
| K3 model IDs | k3, k3-256k | kimi-k3 |
| Endpoint | api.kimi.com/coding/v1 (overseas: api.kimi.ai/coding/v1) | api.moonshot.ai/v1 |
| Unlock requirement | Plus tier or above | Minimum $1 top-up for K3 |
| Best for | Daily interactive coding with a predictable monthly cost | CI jobs, bursty usage, teams already on the API |
The keys are not interchangeable: each only works against its own endpoint. If you see a 401, check this first.
With a platform key you can skip the interactive flow: the CLI reads KIMI_API_KEY (and optionally KIMI_BASE_URL) from the environment, per the providers documentation.
Step 3: Select K3 and set the effort level
Type /model and choose K3. On the membership side, the models page lists four IDs:
| Model ID | What it runs | Context | Effort levels | Minimum tier (new / legacy) |
|---|---|---|---|---|
k3 | Kimi K3 | 1,048,576 on Pro+; 262,144 on Plus | low / high / max | Plus / Moderato |
k3-256k | Kimi K3 | 262,144 | low / high / max | Plus / Moderato |
kimi-for-coding | K2.8 Preview (since Sep 11) | 1,048,576 | low / high / max | Plus / Andante |
kimi-for-coding-highspeed | K2.7 Code HighSpeed | 262,144 | thinking on | Pro / Allegretto |
K3 always thinks; you cannot switch reasoning off, only tune how hard it works. The API default is max (K3 quickstart), and that is also the default effort in the CLI’s shipped K3 model definition. In practice:
- low: renames, explaining a file, quick scripts. Cheapest on quota.
- high: most feature work and bug fixes. The sensible everyday setting.
- max: gnarly debugging, architecture changes, multi-hour tasks.
Set it permanently in the [thinking] block of your config (next section). The config accepts medium and xhigh too, but K3 exposes only three levels; when tools send other values, Moonshot maps medium to high, xhigh/ultra to max, and none disables thinking.
The config file, explained
Everything lives under ~/.kimi-code/ (override with KIMI_CODE_HOME): config.toml for runtime settings, tui.toml for display preferences, mcp.json for MCP servers, and an optional per-project .kimi-code/local.toml. A trimmed version of the documented example that makes K3 your default:
default_model = "kimi-code/k3"
default_permission_mode = "manual" # manual | yolo | auto
default_plan_mode = false
[providers."managed:kimi-code"]
type = "kimi"
base_url = "https://api.kimi.com/coding/v1"
api_key = ""
[models."kimi-code/k3"]
provider = "managed:kimi-code"
model = "k3"
max_context_size = 1048576
capabilities = [ "thinking", "always_thinking", "image_in", "video_in", "tool_use" ]
display_name = "K3"
support_efforts = [ "low", "high", "max" ]
default_effort = "max"
[thinking]
enabled = true
effort = "high"
keep = "all"
Three settings deserve attention:
max_context_size: on Plus,k3tops out at 262,144 tokens. Setting 1,048,576 does not buy a bigger window; it invites context errors.keep = "all": K3 was trained to see its own previous reasoning. Changelog 0.23.0 made keeping prior reasoning across turns the default for Kimi models, which matters because K3 can lose the thread in harnesses that stripreasoning_content.default_permission_mode:yoloauto-approves routine edits but still prompts on risky actions;autonever asks. Start onmanualin unfamiliar repos.
For a pay-as-you-go key, point the provider at base_url = "https://api.moonshot.ai/v1" and set the model to kimi-k3. The CLI also supports anthropic, openai, google-genai and other provider types if you want a second vendor for comparison.
MCP servers and IDE integration
MCP. Kimi Code reads servers from ~/.kimi-code/mcp.json (user) and .kimi-code/mcp.json (project), using the usual mcpServers object. Per the MCP docs it supports stdio (local child process), HTTP and legacy SSE transports, plus static headers or a bearerTokenEnvVar for auth. You rarely need to hand-edit JSON:
/mcp-config # add, edit or delete servers interactively
/mcp-config login <server-name> # browser OAuth for servers that need it
/mcp # show connection status
Zed talks to Kimi Code over the Agent Client Protocol. Add this to ~/.config/zed/settings.json (IDE guide):
{
"agent_servers": {
"Kimi Code CLI": {
"type": "custom",
"command": "kimi",
"args": ["acp"],
"env": {}
}
}
}
JetBrains IDEs use the same agent_servers block under “Configure ACP agents” in the AI chat panel, but the command must be an absolute path (find it with which kimi). VS Code has a dedicated extension, “Kimi Code for VS Code” (marketplace ID moonshot-ai.kimi-code), with browser login or API-key mode and a model dropdown under the input bar. For a full GUI, /desktop installs Kimi Code Desktop.
What K3 in Kimi Code actually costs
Membership plans (new tiers from September 18, 2026; CNY prices from Kimi’s help center, plan tracker and launch coverage):
| Tier | Monthly | Annual | Kimi Code | K3 | K3 at 1M | HighSpeed (K2.7) |
|---|---|---|---|---|---|---|
| Free | ¥0 | n/a | No | No | No | No |
| Go | ¥49 | ¥468 | No | No | No | No |
| Plus | ¥99 | ¥948 | Yes | Yes (256K) | No | No |
| Pro | ¥199 | ¥1,908 | Yes | Yes | Yes | Yes |
| Max | ¥699 | ¥6,708 | Yes | Yes | Yes | Yes |
New members have no weekly quota reset; usage runs on a rolling 5-hour window against a monthly total shared with the Kimi web app (membership docs). Legacy subscribers (Andante, Moderato, Allegretto) keep their old terms, including the 7-day refresh. One tracker reports that k3-256k consumes roughly half the quota of full-context k3, and Moonshot says HighSpeed burns about 3x the quota of the standard model.
A caveat on dollars: every official pricing page we could load shows CNY. Third-party write-ups quote USD prices for international accounts that we could not confirm officially, so check the price in your own account.
Pay-as-you-go API (from the official price list, per 1M tokens):
| Model | API ID | Cached input | Input | Output | Context |
|---|---|---|---|---|---|
| Kimi K3 | kimi-k3 | $0.30 | $3.00 | $15.00 | 1,048,576 |
| K2.7 Code | kimi-k2.7-code | $0.19 | $0.95 | $4.00 | 262,144 |
| K2.7 Code HighSpeed | kimi-k2.7-code-highspeed | $0.38 | $1.90 | $8.00 | 262,144 |
| K2.6 | kimi-k2.6 | $0.16 | $0.95 | $4.00 | 262,144 |
K2.8 Preview does not appear on the official API price list as of today; it is a membership model under kimi-for-coding.
To make the gap concrete, take an illustrative agent session with 2M input tokens at a 90% cache-hit rate and 100K output tokens. On K3 that is 1.8M x $0.30 + 0.2M x $3 + 0.1M x $15 = about $2.64. On K2.7 Code it is 1.8M x $0.19 + 0.2M x $0.95 + 0.1M x $4 = about $0.93. Output dominates K3’s bill, and max effort writes a lot of reasoning tokens, so the real multiple is often wider. For how these rates compare across hosts, see our Kimi K3 API providers guide.
Using K3 inside Claude Code
Moonshot documents two ways to put K3 behind Claude Code’s interface, one per billing system. Install Claude Code from Anthropic’s docs first, then add an env block to ~/.claude/settings.json (Windows: C:\Users\<you>\.claude\settings.json).
Route A: Kimi Code membership key (Kimi Code docs). Full 1M context needs Pro or above; on Plus, use k3-256k and 262144 instead.
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.kimi.com/coding/",
"ANTHROPIC_API_KEY": "your_kimi_code_key",
"ANTHROPIC_MODEL": "k3[1m]",
"ANTHROPIC_DEFAULT_FABLE_MODEL": "k3[1m]",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "k3[1m]",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "k3[1m]",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "k3[1m]",
"CLAUDE_CODE_SUBAGENT_MODEL": "k3[1m]",
"CLAUDE_CODE_EFFORT_LEVEL": "high",
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1048576",
"CLAUDE_CODE_MAX_CONTEXT_TOKENS": "1048576"
}
}
The docs overview also lists https://api.kimi.ai/coding/ as the overseas endpoint; try it if the .com host is slow from your region.
Route B: pay-as-you-go platform key (platform guide). Note the different variable name: the key goes in ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY.
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.moonshot.ai/anthropic",
"ANTHROPIC_AUTH_TOKEN": "YOUR_MOONSHOT_API_KEY",
"ANTHROPIC_MODEL": "kimi-k3[1m]",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-k3[1m]",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-k3[1m]",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-k2.7-code",
"ANTHROPIC_DEFAULT_FABLE_MODEL": "kimi-k3[1m]",
"CLAUDE_CODE_SUBAGENT_MODEL": "kimi-k3[1m]",
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000",
"CLAUDE_CODE_EFFORT_LEVEL": "max"
}
}
Moonshot’s own config routes the “Haiku” slot (background tasks) to the cheaper K2.7 Code, a cost trick worth copying. The same keys also work as export lines or $env:NAME="value" in PowerShell, but the settings.json env block wins over anything you export.
Then launch claude, type /status, and confirm the base URL is Moonshot’s. Things that break this setup:
- A stray
ANTHROPIC_API_KEYin your shell profile or Windows user variables. With Route B it can override your token and send traffic to Anthropic instead. - Unmapped model slots. Leave the Haiku, Fable or subagent variables unset and background tasks fail or hit the wrong endpoint.
[1m]suffix outside Claude Code.k3[1m]andkimi-k3[1m]are Claude Code aliases. Everywhere else usek3orkimi-k3.- Turning thinking off. Per the Kimi Code docs, K3 and K2.8 Preview requests with thinking disabled route to K2.8 Preview in non-thinking mode. If you hit Option+T / Alt+T to toggle thinking off, you are no longer running K3.
kimi-k2.7-codeneeds thinking on. The platform returns “400 invalid thinking” otherwise.
For GitHub’s agent, see the separate Kimi K3 in GitHub Copilot guide.
Cline and Roo Code
Both tools reach K3 through the OpenAI-compatible endpoint. Choose the OpenAI Compatible provider, set the base URL to https://api.moonshot.ai/v1, paste a platform API key, and type kimi-k3 as the model ID. Independent guides (example) document the same recipe. Cline also lists Kimi K3 in its own catalog, billed through Cline’s usage-based provider or ClinePass, so you can skip a Moonshot account entirely.
Two cautions. K3’s sampling parameters are fixed (temperature=1.0, top_p=0.95), so leave them at defaults. And these extensions may not preserve reasoning_content across turns the way Kimi Code does; if long sessions drift, compare the same task in Kimi Code before blaming the model.
K2.7 Code, K2.8 Preview or K3: which should you run?
“K2.7 Code by default, K3 for heavy lifting” still holds on the API. Inside the membership, K2.8 Preview changes the middle of the decision. Moonshot claims its “overall performance is close to K3” with better reasoning efficiency than K2.7 Code; we have not seen independent benchmarks to confirm that yet, so treat it as a vendor claim.
| Your situation | Pick | Why |
|---|---|---|
| Single-file fixes, tests, lint cleanup | K2.7 Code (API) or kimi-for-coding | K3 is overkill; K2.7 Code output is $4 vs $15 |
| High-volume CI agents, batch refactors | K2.7 Code | Cost scales with loops; 256K context is usually enough |
| Latency-sensitive pairing | kimi-for-coding-highspeed (Pro+) | Moonshot claims 5 to 6x output speed, at 3x quota |
| Feature spanning several packages | K3 at high | Long-horizon planning is where the 2.8T model earns its price |
| Repo too big for 256K tokens | K3 at 1M (Pro+ or API) | Only K3 and K2.8 Preview offer 1M in Kimi Code |
| UI work from screenshots or video | K3 | Native vision; video input works in Kimi Code |
| Membership user, unsure | kimi-for-coding (K2.8 Preview) first | Cheaper on quota, 1M context, same effort levels |
| Hard bug after two failed attempts | Escalate to K3 at max | Pay for depth only when cheaper models stall |
A workable pattern: default to the cheaper model and escalate when the agent loops or the task spans several modules. But K3 relies on seeing its own prior reasoning, so for big tasks start a fresh K3 session with a clear plan rather than hopping models halfway. For the broader generational comparison, see Kimi K3 vs Kimi K2.
Honest caveats
- Docs change weekly. Model IDs, tier names and endpoints all changed in September, and old and new tier names still coexist across Moonshot pages. Re-check the models page before debugging a “model not available” error.
- Quota is opaque. Moonshot publishes the 5-hour window and monthly-total structure but not token numbers per tier.
/usageinside the CLI is your only reliable gauge. - K3 is slow by design. Around 34 tokens per second on the standard path, plus thinking time.
FAQ
How do I install Kimi Code CLI?
On macOS or Linux run curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash. On Windows, install Git for Windows first, then run irm https://code.kimi.com/kimi-code/install.ps1 | iex in PowerShell. Alternatives are brew install kimi-code or npm install -g @moonshot-ai/kimi-code (Node.js 22.19.0 or later). Then open a new terminal, cd into a project and type kimi.
How do I switch Kimi Code to the K3 model?
Inside the CLI type /model and pick K3. In the membership catalog the model IDs are k3 (up to 1M context on Pro/Allegretto and above) and k3-256k (256K context, Plus/Moderato and above). To make it permanent, set default_model = "kimi-code/k3" in ~/.kimi-code/config.toml. On a pay-as-you-go API key the model ID is kimi-k3.
Which Kimi plan do I need for K3 in Kimi Code? Under the tiers Moonshot introduced on September 18, 2026, Kimi Code starts at Plus (¥99 a month, or ¥948 a year), which includes K3 at 256K context. The full 1M-token K3 context and the K2.7 Code HighSpeed model need Pro (¥199 a month) or above. Go (¥49) does not include Kimi Code. Legacy subscribers keep their old plans: Moderato for K3, Allegretto for 1M context.
Can I use Kimi K3 inside Claude Code?
Yes, two ways. With a Kimi Code membership key, set ANTHROPIC_BASE_URL to https://api.kimi.com/coding/ (overseas docs also list https://api.kimi.ai/coding/) and ANTHROPIC_MODEL to k3[1m] or k3-256k. With a pay-as-you-go platform key, set ANTHROPIC_BASE_URL to https://api.moonshot.ai/anthropic, put the key in ANTHROPIC_AUTH_TOKEN and use kimi-k3[1m]. Also map the Opus, Sonnet, Haiku, Fable and subagent model variables, then confirm with /status.
Is kimi-for-coding still K2.7 Code?
No. Since September 11, 2026 the kimi-for-coding model ID in Kimi Code serves K2.8 Preview, with a 1M context window and low/high/max effort. K2.7 Code survives in the membership as kimi-for-coding-highspeed (Pro and above) and on the pay-as-you-go API as kimi-k2.7-code at $0.95 input and $4 output per million tokens.
Should I use K3 or K2.7 Code for everyday coding? On the API, K2.7 Code costs $0.95/$4 per million tokens against K3’s $3/$15, so it stays the sensible default for small fixes, test writing and high-volume agent loops. Move to K3 for multi-package features, long-horizon refactors, screenshot-driven UI work and anything that needs more than 256K tokens of context. Membership users should also try K2.8 Preview, which Moonshot says performs close to K3.
Does Kimi Code CLI support MCP servers?
Yes. Kimi Code reads MCP servers from ~/.kimi-code/mcp.json (user level) and .kimi-code/mcp.json (project level) using the standard mcpServers JSON shape. It supports stdio, HTTP and legacy SSE transports, static headers or bearer tokens, and OAuth via /mcp-config login <server-name>. Use /mcp to check connection status.
Is the Kimi Code membership key the same as a Moonshot API key?
No. Membership keys are created in the Kimi Code console at kimi.com/code/console (up to 5 active keys) and only work against the api.kimi.com/coding or api.kimi.ai/coding endpoints, drawing on your plan quota. Platform keys come from platform.kimi.ai, bill per token and work against api.moonshot.ai. Mixing them up is the most common cause of 401 errors.
The bottom line
Setting up K3 in Kimi Code takes five minutes; choosing when to use it is the real skill. Install with the one-line script, then /login, /init and /model. After that, be deliberate: on the API, K3 costs about 3x K2.7 Code on input and nearly 4x on output, and in the membership K2.8 Preview now covers much of the middle ground. Save K3 for long, multi-module work. If Claude Code is already your harness, the Anthropic-compatible endpoints let you keep it and swap the brain; map every model slot and verify with /status.
Keep reading: the complete Kimi K3 guide, full K3 specifications, every K3 API provider and price, the K2.8 Preview explainer, and how K3 stacks up for coding against Claude Opus 5.