# Kimi Code CLI: A Beginner-Friendly Guide to Moonshot AI's Terminal Coding Agent

> Source: <https://dev.to/arshtechpro/kimi-code-cli-a-beginner-friendly-guide-to-moonshot-ais-terminal-coding-agent-39db>
> Published: 2026-07-19 04:49:26+00:00

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.

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:

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.

A few design choices make it worth trying if you already use a terminal-based AI agent, or are looking for your first one:

`/mcp-config`

, instead of hand-editing JSON files.`coder`

, `explore`

, and `plan`

subagents can run in isolated contexts in parallel, keeping your main conversation clean.You have two main installation paths: the official install script, or npm.

**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](https://gitforwindows.org/) 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.

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
```

Open a new shell session and run:

```
kimi --version
```

If that prints a version number, you are ready to go.

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:

`platform.kimi.com`

or `platform.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.

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.

```
kimi -p "Take a look at this project's directory structure"
kimi -c
```

| 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 |

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.

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.

**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
```

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.

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**
