If you have used tools like Claude Code or similar terminal-based AI agents, Kimi Code CLI will feel familiar. It is Moonshot AI's open-source coding agent that lives in your terminal, reads and edits your code, runs shell commands, and works through tasks step by step based on the results it gets back.
This post explains what Kimi Code CLI is, why it might be useful to you, and walks through installing and using it for the first time.
What is Kimi Code CLI
Kimi Code CLI is an AI coding agent that runs directly in your terminal. Instead of copying code back and forth between a chat window and your editor, you describe a task in plain language, and the agent:
- Reads and edits files in your project
- Runs shell commands
- Searches through your codebase
- Fetches web pages when it needs external information
- Decides its next step based on the output it gets, rather than following a fixed script
It works out of the box with Moonshot AI's Kimi models, and it can also be pointed at other compatible providers like Anthropic, OpenAI, or Google by editing a config file.
The project is written in TypeScript, MIT licensed, and distributed as a single binary, so you do not need a Node.js setup just to run it.
Why it stands out
A few design choices make it worth trying if you already use a terminal-based AI agent, or are looking for your first one:
- Single-binary install. No Node.js, no PATH conflicts, no global package clutter. One script and you are done.
- Fast startup. The terminal UI (TUI) loads in milliseconds.
- Video input. You can drop a screen recording into the chat, and the agent can turn it into working code or a short summary. This is unusual among coding agents.
-
Conversational MCP setup. Model Context Protocol (MCP) servers can be added and authenticated by talking to the CLI with
/mcp-config, instead of hand-editing JSON files. - Plugin ecosystem. You can install skills, MCP servers, and data sources from a marketplace or directly from a GitHub repo, with the trust level of each shown upfront.
-
Subagents. Built-in
coder,explore, andplansubagents can run in isolated contexts in parallel, keeping your main conversation clean. - Lifecycle hooks. You can run local commands at key points, for example to block a risky tool call, log decisions, or trigger a desktop notification.
- Editor integration via ACP. Using the Agent Client Protocol, you can drive a Kimi Code CLI session from Zed, JetBrains IDEs, or any other ACP-compatible client.
Installing Kimi Code CLI
You have two main installation paths: the official install script, or npm.
Option 1: Install script (recommended)
macOS or Linux
curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash
Windows (PowerShell)
irm https://code.kimi.com/kimi-code/install.ps1 | iex
On Windows, install Git for Windows first, since Kimi Code CLI uses the bundled Git Bash as its shell environment. If Git Bash is in a non-standard location, set the KIMI_SHELL_PATH environment variable to the full path of bash.exe.
Homebrew (macOS/Linux)
brew install kimi-code
The script downloads the latest release, verifies its checksum, and adds the kimi executable to your PATH.
Option 2: Install via npm
If you already have Node.js 22.19.0 or later:
node --version
npm install -g @moonshot-ai/kimi-code
Or with pnpm:
pnpm add -g @moonshot-ai/kimi-code
Verify the install
Open a new shell session and run:
kimi --version
If that prints a version number, you are ready to go.
First launch and login
Move into a project directory and start the interactive UI:
cd your-project
kimi
On first launch, log in from inside the CLI:
/login
This opens a platform selector with two options:
- Kimi Code (OAuth) — a device-code flow. You open a link on any device, sign in, and enter a code to authorize.
-
Kimi Platform API key — paste in a key from
platform.kimi.comorplatform.kimi.ai.
To log out later, run /logout.
If you would rather use Anthropic, OpenAI, Google, or another compatible provider, edit ~/.kimi-code/config.toml directly and add your API key there.
Trying your first task
Once logged in, just describe what you want in plain English. A good first prompt is to have it explore your project:
Take a look at this project's directory structure and briefly describe what each directory is for.
Kimi Code CLI will call its file-reading and search tools automatically to gather context before answering. Read-only operations run without asking for confirmation. Anything that modifies files or runs shell commands will prompt you to approve it first.
You can also hand it a concrete coding task:
Add a function in src/utils that converts any string to kebab-case, and add a unit test for it.
The agent plans the steps, edits the code, runs the tests, and reports back what it did.
Running a single instruction without the interactive UI
kimi -p "Take a look at this project's directory structure"
Resuming your previous session
kimi -c
Useful commands to know
| Command | What it does |
|---|---|
/help |
Opens the command and shortcut panel |
/new |
Starts a new session, clearing current context |
/sessions |
Browse and resume past sessions |
/model |
Switch the active model |
/compact |
Manually compress context to free up tokens |
/fork |
Fork the current session, keeping history but continuing separately |
/mcp-config |
Add and authenticate MCP servers conversationally |
/exit |
Exit the CLI |
Handy keyboard shortcuts:
| Shortcut | What it does |
|---|---|
Esc |
Interrupt streaming output or close a popup |
Ctrl-C |
Interrupt output; press twice while idle to exit |
Shift-Tab |
Toggle Plan mode |
Ctrl-S |
Inject a message mid-stream |
Ctrl-O |
Collapse or expand tool output |
Using it inside your editor (ACP)
Kimi Code CLI supports the Agent Client Protocol, which lets editors like Zed and JetBrains drive a session directly.
For Zed, add this to ~/.config/zed/settings.json:
{
"agent_servers": {
"Kimi Code CLI": {
"type": "custom",
"command": "kimi",
"args": ["acp"],
"env": {}
}
}
}
Then open a new conversation in Zed's Agent panel. No extra login is needed since it reuses your existing CLI credentials.
Where your data lives
Kimi Code CLI stores config files, session records, logs, and its update cache under ~/.kimi-code/ by default. If you want to move that elsewhere, set the KIMI_CODE_HOME environment variable to a different path.
Upgrading and uninstalling
Upgrade
kimi upgrade
Or, if you installed via npm:
npm install -g @moonshot-ai/kimi-code@latest
Uninstall
If you installed via the script, just delete the kimi executable. If you installed via npm:
npm uninstall -g @moonshot-ai/kimi-code
Building it from source
If you want to contribute or run the latest code from main:
git clone https://github.com/MoonshotAI/kimi-code.git
cd kimi-code
pnpm install
pnpm dev:cli # run the CLI in dev mode
pnpm test # run tests
pnpm typecheck # TypeScript check
pnpm lint # oxlint
pnpm build # build all packages
This requires Node.js 24.15.0 or later and pnpm 10.33.0. Check CONTRIBUTING.md in the repo for the full contribution guide.
Wrapping up
Kimi Code CLI brings together a lot of what people already like about terminal-based AI coding agents: a fast single-binary install, a clean TUI, subagents, MCP support, and editor integration through ACP. The video input feature and the conversational MCP setup are the two pieces that stand out as genuinely different from similar tools.
If you want to try it, the fastest path is the install script followed by /login. From there, just start describing what you want done.
Links
- Repository: https://github.com/MoonshotAI/kimi-code
Top comments (0)