Invite a friend, get 1 month of Pro freeHow it works

How to use Kimi Code CLI: a step-by-step guide (2026)

How to use Kimi Code CLI: install the new TypeScript kimi, sign in with /login, pick a K3 model, set permission and plan modes, run kimi -p and resume sessions.

Solviera Teknoloji 8 min read

To use Kimi Code CLI, install it with curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash (or npm install -g @moonshot-ai/kimi-code), run kimi in a project, sign in with /login and describe the task. The Python kimi-cli that most older guides describe is archived and will stop working; the current Kimi Code CLI is a TypeScript rewrite that keeps the same kimi command.

This guide covers Kimi Code CLI as of November 2026 (version 2.7.2): install, sign-in, models, the interface, permission and plan modes, headless runs, sessions, configuration, AGENTS.md, skills, MCP and cost.

What Kimi Code CLI is

Kimi Code CLI is Moonshot AI’s coding agent for the terminal. It is written in TypeScript, runs on Node.js and is MIT-licensed. Version 2.7.2 shipped on 20 November 2026.

It replaces the original Python kimi-cli, which Moonshot has archived. Both use the kimi command, so check which one you have: the old one keeps its files in ~/.kimi, the new one in ~/.kimi-code.

Step 1: install

curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash   # macOS and Linux
irm https://code.kimi.com/kimi-code/install.ps1 | iex          # Windows PowerShell
npm install -g @moonshot-ai/kimi-code                          # any OS, Node.js 22.19+
brew install kimi-code                                         # Homebrew

The install script needs no Node.js; it downloads a release, checks its checksum and puts kimi on your PATH. On Windows, install Git for Windows first, because Kimi Code uses Git Bash as its shell (set KIMI_SHELL_PATH if bash.exe is somewhere unusual). Check with kimi --version and update with kimi upgrade.

Coming from kimi-cli? Run kimi migrate, or accept the prompt on first launch. It copies your config, MCP servers and sessions from ~/.kimi/, but not logins, so run /login again afterwards.

Step 2: sign in

cd my-project
kimi

Inside the app, /login offers two routes:

  • Kimi Code (OAuth): a device-code sign-in for people with a Kimi membership. kimi login does the same without opening the app.
  • Kimi Platform API key: a pay-as-you-go key from the Kimi platform.

One thing trips up almost everyone: export KIMI_API_KEY=... does nothing. Kimi Code reads keys only from ~/.kimi-code/config.toml, either as api_key or through api_key_env, which names a shell variable to read. /provider adds other providers: Anthropic, OpenAI, Bedrock, Google GenAI and Vertex.

Step 3: pick a model

With a membership, /login sets up the Kimi Code models as aliases such as kimi-code/k3. The lineup in November 2026:

ModelContextNotes
K3.1 Pro (k3.1-pro)Up to ~1M tokensThinking model, effort low, high or max
K3.1 Pro HighspeedUp to ~1M tokensPro plan and above, 2–3x faster, uses 2x quota
K3 (k3)Up to ~1M tokens1M context on Pro and above
kimi-for-codingVaries by planThe coding-tuned model
kimi-for-coding-highspeed262KPro plan and above, much faster, uses 3x quota

Switch with /model or -m <alias>. The model IDs on the Kimi Platform API are different (kimi-k3, kimi-k3.1-pro), so copy them from the right page. Moonshot is retiring the K2 models on its API by the end of December 2026, so move any K2 setup to K3.

Step 4: work in a session

Describe the task in your own words. The basics:

  • @ completes file paths; Ctrl-V (Alt-V on Windows) pastes images or video.
  • ! in an empty input box switches to shell mode; Ctrl-B sends a running command to the background. Older guides mention Ctrl-X; that was the Python CLI.
  • Ctrl-S sends a message while the agent is still answering, and Ctrl-O shows or hides tool output.
  • /compact shortens a long conversation, /undo steps back, /fork branches the session.
  • /goal keeps the agent working toward a target, and /swarm splits a task across sub-agents.

Step 5: permission modes and plan mode

Kimi Code has three permission modes:

ModeHow to turn it onWhat it does
Always Ask (default)—Asks before edits and commands
Ask When Needed--yolo, -y or /yoloRuns most things, still asks before sensitive files, dangerous commands and leaving plan mode
Never Ask--auto or /autoRuns everything

The names changed in 2026: Always Ask used to be Manual, Ask When Needed used to be YOLO and Never Ask used to be Auto. So --yolo is not the “anything goes” mode it is in other CLIs.

Plan mode (--plan, Shift-Tab or /plan) has the agent read and plan without changing files. Leaving plan mode always needs your confirmation, in every permission mode.

Step 6: headless runs and sessions

kimi -p "add a unit test for the price formatter"
kimi -p "summarise the open TODOs" --output-format stream-json
kimi -c -p "now update the changelog"

kimi -p writes the answer to stdout and progress to stderr. It approves file writes and shell commands on its own (Never Ask), with only your deny rules still applying, and it cannot be combined with --yolo, --auto or --plan. Exit codes: 0 for success, 1 for an error or missing sign-in, 4 when another process holds the session.

kimi -c continues the latest session in the folder, kimi -S opens a session picker and kimi -S <id> opens a specific one. kimi import-sessions brings in Claude Code and Codex sessions, and kimi web opens a local web interface.

Step 7: configuration, AGENTS.md and skills

Config. Everything lives in ~/.kimi-code/ (C:\Users\<name>\.kimi-code on Windows): config.toml, mcp.json, AGENTS.md, skills/, credentials, sessions and logs. KIMI_CODE_HOME moves the folder, and kimi doctor checks your config files.

Rules. /init analyses the codebase and writes an AGENTS.md. Kimi Code reads it from the project (AGENTS.md or .kimi-code/AGENTS.md), from ~/.kimi-code/AGENTS.md and from ~/.agents/AGENTS.md. A file you already keep for Codex or another agent works as it is; our AGENTS.md guide covers what to put in it.

Skills. A skill is a SKILL.md in its own folder or a single .md file, in .kimi-code/skills/, .agents/skills/, ~/.kimi-code/skills/ or ~/.agents/skills/. Run one with /skill:<name>. Plugins, hooks and built-in coder, explore and plan sub-agents are also available.

Step 8: MCP and editors

Kimi Code reads MCP servers from mcp.json in the usual {"mcpServers": {...}} format: ~/.kimi-code/mcp.json for you, .kimi-code/mcp.json for the project (the project wins on a name clash). It supports stdio, HTTP and SSE. /mcp-config adds and edits servers inside the app, /mcp-config login <name> handles OAuth and /mcp shows their status. Project servers only load in folders you trust; in CI, set KIMI_CODE_TRUST_WORKSPACE=1.

Older guides use kimi mcp add or --mcp-config-file; those belong to the archived CLI.

kimi acp runs Kimi Code as an agent server for editors. In Zed, add it under agent_servers with "command": "kimi", "args": ["acp"]; JetBrains IDEs are covered in the docs too.

What Kimi Code costs (as of November 2026)

OptionPriceNotes
Kimi Code CLIFreeMIT license
Kimi Plus$19/month ($180/year)Includes Kimi Code
Kimi Pro$39/month ($372/year)Highspeed models, 1M context
Kimi Max$99/month ($948/year)More quota
Kimi Ultra$199/month ($1,908/year)The most quota
Kimi Platform APIPay per tokenPrepaid, separate from memberships

Membership prices are the international ones from October 2026. Plans have a rolling 5-hour limit and a monthly total shared across all your devices, with pay-as-you-go top-ups once the quota runs out. Check Kimi’s pricing page before you decide.

Common mistakes

  • Following a kimi-cli guide. uv tool install kimi-cli, ~/.kimi, Ctrl-X, kimi mcp add and --mcp-config-file all describe the archived CLI.
  • Exporting the API key. The key belongs in config.toml or api_key_env; a shell variable alone is ignored.
  • Assuming --yolo asks nothing. It still stops for sensitive files and dangerous commands; --auto is the mode that never asks.
  • Running kimi -p on an untrusted repository. Headless runs approve writes and commands on their own.
  • Highspeed models draining the plan. They use two to three times the quota.

Running Kimi Code next to other CLIs in AgentVera

If Kimi Code is your only agent, its own interface may be all you need. It gets harder when Kimi runs next to Claude Code, Codex or Gemini CLI on the same project. AgentVera is a desktop app that runs these CLIs side by side in real terminals, with your own installs and logins. Kimi Code support works like this:

  • One session per agent. AgentVera finds the session Kimi creates for the project and reopens it with --session <id> next time, so the conversation survives an app restart.
  • Model, effort and permissions. The model you pick reaches Kimi with --model, the effort level goes with it, and the full-permission setting starts Kimi with --yolo.
  • Roles. A role you give the agent goes in as a Kimi agent file that keeps Kimi’s default prompt and adds yours.
  • MCP. Servers from AgentVera’s MCP manager reach Kimi through an mcp.json of the agent’s own that links your sign-in, config and sessions, so your own files do not change.
  • Panes, review and spend. Run Kimi in the workspace grid beside other agents, check its changes with code review and watch what it spends with token budgets.

The free plan runs 2 agents at once and includes MCP, Git, Docker, SSH, code review and token savings. Pro is $9.99 a month and has no agent limit; you can try Pro free for 7 days, and if you cancel before it ends you are not charged. To try it, download AgentVera.

Wrapping up

Getting started with Kimi Code takes two steps: install it and run /login. After that, make sure you are on the new CLI rather than the archived one, put API keys in config.toml, pick the permission mode on purpose (--yolo still asks sometimes, kimi -p never does) and keep the project rules in AGENTS.md.

Sources: Kimi Code on GitHub, Kimi Code CLI docs, Kimi Code models, membership and quota, archived kimi-cli, npm package, Kimi membership pricing.

Questions

Is Kimi Code CLI free?

The CLI is free and MIT-licensed. The model is not: you need a Kimi membership that includes Kimi Code (Plus at $19, Pro at $39, Max at $99 or Ultra at $199 a month in October 2026) or a pay-as-you-go Kimi Platform API key. Memberships have a rolling 5-hour limit and a monthly total.

What is the difference between kimi-cli and Kimi Code CLI?

kimi-cli was the original Python CLI; Moonshot archived it and says existing installs will stop working. Kimi Code CLI is a TypeScript rewrite that runs on Node.js and keeps the kimi command, but stores data in ~/.kimi-code instead of ~/.kimi. Run kimi migrate to move your config, MCP servers and sessions, then sign in again with /login.

Why does Kimi Code ignore my KIMI_API_KEY?

Kimi Code does not read API keys from the shell on its own. Put the key in ~/.kimi-code/config.toml with api_key, or name the variable with api_key_env, or sign in with /login.

Which models does Kimi Code use?

With a membership, /login sets up the Kimi Code models, including K3.1 Pro, K3 and kimi-for-coding, plus faster highspeed variants on higher plans that use more quota. K3-series models offer up to about 1 million tokens of context. Switch with /model or -m. /provider adds Anthropic, OpenAI, Bedrock or Google models.

How do I resume a Kimi Code session?

kimi -c continues the latest session in the current folder and kimi -S opens a picker, or a given session with kimi -S <id>. In scripts, kimi -c -p "..." continues the previous headless run.

Bring your agents to one desk.

Download AgentVera for free; your installed CLIs are ready to go.

More posts