How to Use Kimi Code: Install, Login, Commands, and the kimi-cli Trap

Kimi Code is Moonshot AI's command-line coding agent, the tool you get when you want Kimi K3 working directly in your terminal instead of a chat window. You install it, run kimi inside a project, and it reads your code, edits files, and runs commands the same way Claude Code or Codex CLI do. There is one thing you should know before you type a single install command: Moonshot has shipped two different products that both install a binary called kimi, and the package names are crossed in a way that sends a lot of people to the wrong one. This guide covers that trap first, because it is the most common way a Kimi Code setup goes sideways, and then walks through installation, login, the flags and conventions you will actually use, and how to run Kimi Code inside CodeAgentSwarm next to your other agents. Kimi Code moves fast, with new releases landing almost daily, so where something is likely to drift I will say so and point you at the official docs.

What is Kimi Code?

Kimi Code is the official terminal coding agent from Moonshot AI, the company behind the Kimi models. It is open source under the MIT license, written in TypeScript, and invoked with the kimi command. You run it inside a project folder, describe what you want, and it plans, edits files, and executes shell commands with your approval.

Under the hood it runs on Kimi K3, the model Moonshot released on July 16, 2026: a 2.8 trillion parameter Mixture of Experts model with a context window of up to 1,048,576 tokens and native vision. K3 always reasons before answering, which makes it strong on hard multi-step work. If you want the model details and what they cost, the plans and pricing guide goes deep on that.

If you already use Claude Code, Kimi Code will feel familiar on purpose. Its tools carry the same names (Bash, Read, Write, Edit), it follows the AGENTS.md convention for project instructions, and its MCP configuration is compatible with the .mcp.json file Claude Code already reads. The Kimi Code vs Claude Code comparison covers exactly where they differ.

Kimi Code is pre-1.0 and ships roughly one release a day. That pace means fixes arrive fast, and it also means details in any guide (this one included) can drift. When in doubt, the official Kimi Code docs are the source of truth.

Before you install: the two kimis trap

Moonshot has shipped two terminal agents, and both of them install a binary called kimi. Getting this wrong is the number one way people end up confused, and most posts about Kimi Code never mention it.

  • kimi-cli (legacy): the original Python agent, in the MoonshotAI/kimi-cli repository, with its data under ~/.kimi/. It is being wound down, but it has years of stars and blog posts pointing at it, so search results and AI assistants still send people there.
  • Kimi Code (current): the TypeScript agent this guide is about, in the MoonshotAI/kimi-code repository, with its data under ~/.kimi-code/. This is the one under active development.

The package names make it worse, because they are crossed. The PyPI package called kimi-code is an empty meta-package that installs the legacy Python agent. The real Kimi Code lives on npm as @moonshot-ai/kimi-code. So installing "kimi-code" from pip gets you the old product, and the new product comes from npm or from the official install script.

bash
# Check which kimi you actually have
kimi --version

# 0.x  -> Kimi Code, the current TypeScript CLI (this guide)
# 1.4x -> kimi-cli, the legacy Python agent

Never decide by command name, decide by version. If kimi --version prints a 0.x version you have Kimi Code; a 1.4x version means the legacy Python kimi-cli. The official installer handles collisions for you: it detects legacy Python shims on your PATH, renames the first one to kimi-legacy, and removes duplicates, so after a clean install kimi means Kimi Code.

How to install Kimi Code

The recommended path is the official install script, which does not require Node.js. It downloads the latest release, verifies the checksum, and puts the kimi executable on your PATH (the binary itself lands in ~/.kimi-code/bin/).

bash
# macOS and Linux
curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash
powershell
# Windows (PowerShell)
irm https://code.kimi.com/kimi-code/install.ps1 | iex

If you prefer a package manager, Kimi Code is on npm. This route needs Node.js 22.19.0 or later:

bash
# Check your Node version first
node --version

# npm
npm install -g @moonshot-ai/kimi-code

# or pnpm
pnpm add -g @moonshot-ai/kimi-code

Either way, open a fresh terminal afterward and confirm the install with kimi --version. You should see a 0.x version. To update later, run kimi upgrade and the CLI checks for the latest version itself, or reinstall with npm install -g @moonshot-ai/kimi-code@latest.

On Windows, install Git for Windows before the first launch: Kimi Code uses Git Bash as its shell environment. The Kimi Code on Windows guide covers that requirement, the current rendering issues, and the WSL route in detail.

First run and logging in

Start Kimi Code inside a project folder by typing kimi. On first run, use the /login command inside the TUI. It opens a platform selector with two options:

  • Sign in with your Kimi account: an OAuth device-code flow. Kimi Code shows you a link, you confirm in the browser, and the CLI picks the session up. This is the route for Kimi subscription plans.
  • API key: paste a key from the Moonshot platform if you pay per token instead of subscribing.

Credentials are stored locally under ~/.kimi-code/. Once you are logged in, every new kimi session in any folder reuses them. Inside the TUI, /usage shows where you stand against your quota, which on subscriptions works as a weekly allowance plus a rolling 5-hour window.

Everyday usage: the commands and flags that matter

Day to day you will live inside the interactive session, with a handful of flags for starting, resuming and automating:

bash
# Start a session in the current project
kimi

# Continue the last session in this folder
kimi --continue        # or: kimi -c

# Resume a specific session by id
kimi --session <id>

# One-shot headless run (no TUI), like claude -p
kimi -p "explain what this repo does"

# Modes
kimi --plan     # plan before acting
kimi --auto     # more autonomy, still gated
kimi --yolo     # auto-approve everything (careful)

A few input details worth knowing: Enter sends your message, and Ctrl-J or Alt-Enter inserts a newline. /title names the current session, which makes it much easier to find later. And if you resume a session while passing --yolo, --auto or --plan, the flag overrides whatever mode the session was saved with. The --yolo flag deserves its own risk discussion, which is exactly what the Kimi Code YOLO mode guide is for.

Project instructions: AGENTS.md

Kimi Code follows the AGENTS.md convention. It reads a global file at ~/.kimi-code/AGENTS.md, a shared one at ~/.agents/AGENTS.md, and your project's AGENTS.md. There is no KIMI.md, and it does not read CLAUDE.md natively, though it ships an import skill that converts an existing Claude Code or Codex setup once, with your confirmation.

Skills are shared, not ported

Kimi Code reads skills natively from ~/.agents/skills/, the same shared folder other CLI agents use, plus its own ~/.kimi-code/skills/ and per-project skill folders. If you already maintain skills for Claude Code or Codex, Kimi Code picks them up without any porting. That makes the workflow in sharing skills between agents apply to Kimi out of the box.

MCP servers

MCP configuration is file-based. Kimi Code reads a global ~/.kimi-code/mcp.json, then your repository's .mcp.json at the git root (the same file Claude Code uses, so one file can serve both agents), then a per-project .kimi-code/mcp.json, with the more specific file winning. Tool names follow the same mcp__server__tool pattern as Claude Code. There is no --mcp-config flag, configuration lives in files only. For deeper automation there is also a full hooks system, configured in TOML inside ~/.kimi-code/config.toml and validated with kimi doctor.

Running Kimi Code inside CodeAgentSwarm

One Kimi Code session is one process working on one task. The moment you want a second task moving at the same time, you are into multiple terminals, and that is where CodeAgentSwarm comes in. It is a desktop app for macOS and Windows that runs several AI CLI terminals in one visual workspace, and Kimi Code is a first-class agent in it, alongside Claude Code, Codex CLI, Antigravity CLI and opencode.

You pick the agent per terminal, so you can run three Kimi Code sessions side by side, or mix Kimi with Claude Code on the same project and compare how each handles its task. On top of the terminals you get desktop notifications when an agent finishes or asks for input, searchable conversation history across every agent, per-terminal live diffs of what each session changed, a kanban board the agents update over MCP, and a quota indicator that reads Kimi's weekly and 5-hour windows so you see a wall coming before you hit it.

From here, the natural next steps are running multiple Kimi Code sessions for the mechanics, and the Kimi Code agent swarm guide for the full parallel workflow. If you would rather keep your existing harness and just use the model, you can also run Kimi K3 inside Claude Code.

FAQ

Kimi Code is Moonshot AI's open-source terminal coding agent, run with the kimi command. It works like Claude Code or Codex CLI: you start it inside a project, describe what you want, and it reads code, edits files and runs commands with your approval. It is powered by Kimi K3, Moonshot's flagship model with a context window of up to 1M tokens.

On macOS and Linux run the official script: curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash. On Windows PowerShell: irm https://code.kimi.com/kimi-code/install.ps1 | iex. Or install from npm with npm install -g @moonshot-ai/kimi-code, which needs Node.js 22.19 or later. Verify with kimi --version and update later with kimi upgrade.

kimi-cli is Moonshot's legacy Python agent, being wound down. Kimi Code is the current TypeScript agent under active development. Both install a binary called kimi, and confusingly the PyPI package named kimi-code installs the legacy Python product. The real Kimi Code comes from the official install script or the npm package @moonshot-ai/kimi-code. Check with kimi --version: 0.x is Kimi Code, 1.4x is the legacy kimi-cli.

The CLI itself is open source (MIT) and free to install. Using it requires either a Kimi subscription or a Moonshot platform API key billed per token. Kimi has a free tier and paid plans starting at $19 a month, with usage working as a weekly quota plus a rolling 5-hour window. Which plans include Kimi Code has shifted, so check Moonshot's pricing page for the current lineup.

Large parts of it carry over. Kimi Code reads the same .mcp.json file at your repository root for MCP servers, uses the same mcp__server__tool naming, and reads shared skills from ~/.agents/skills/ natively. Project instructions use AGENTS.md rather than CLAUDE.md, and there is a one-shot import skill for converting an existing Claude Code or Codex configuration.

Each kimi session is an independent process, so you can run one per terminal. CodeAgentSwarm makes that manageable: it is a desktop app for macOS and Windows where Kimi Code is a supported agent, and it adds desktop notifications, searchable history, live diffs and a quota indicator across all your parallel sessions.

Run Kimi Code as a first-class agent in CodeAgentSwarm, next to Claude Code, Codex and the rest. Parallel terminals, desktop notifications, searchable history and live diffs, with Kimi's weekly and 5-hour quota visible at a glance.

Try CodeAgentSwarm

CodeAgentSwarm Free for macOS & Windows

Download free