Kimi Code CLI

Moonshot AI's open-source terminal coding agent: it reads and edits code, runs shell commands, searches files and fetches web pages. Run it in EnvHaven from any browser, signed in once with your own account, and keep it working 24/7; or install it on your own machine.

Updated November 23, 2026 · Checked against Kimi Code CLI 2.1.1 in EnvHaven v1.9.0

At a glance
Made byMoonshot AI
Commandkimi
Version checked2.1.1, in EnvHaven v1.9.0
LicenseMIT, source
Documentationmoonshotai.github.io/kimi-code/en/

Use Kimi Code CLI in EnvHaven

  1. Open your workspace in any browser, on a laptop, a tablet or a phone.
  2. Tap Launch, choose Kimi Code CLI and tap Sign in: it runs kimi login --region global for you in the terminal.
  3. Start it with one tap: signed in, Kimi Code CLI gets a green dot in the Launch menu and an icon in the workspace’s top bar. Support is built in (2.1.1), so there is nothing to install or update.
  4. Give it a task. The image launches kimi with --auto.
  5. Close the tab whenever you like. The workspace is an always-on Linux machine, so Kimi Code CLI keeps working, and every device you open it from shows the same session.

Every agent signs in with your own account: EnvHaven never resells tokens or adds a markup.

Install Kimi Code CLI on another machine

macOS, Linux:

curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash

npm (Node.js 22.19 or later):

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

Sign in from the terminal

In a workspace the Launch menu does this for you. On any other machine, or when you would rather type it:

  • Inside the app, /login offers Kimi Code sign-in (a device code) or a Kimi Platform API key; from the shell, kimi login runs the device-code flow.
  • Add --region global for a kimi.ai account or --region mainland-cn for kimi.com. Other providers go in ~/.kimi-code/config.toml, or through /provider.
  • Kimi membership includes Kimi Code, with model access by tier; Remote Control needs a paid membership. Platform API keys are pay-as-you-go.

Run Kimi Code CLI without permission prompts

For one session:

kimi --auto

As the default, in ~/.kimi-code/config.toml:

default_permission_mode = "auto"

--auto starts in “Never Ask” mode: everything runs without interrupting you. --yolo is the milder “Ask When Needed” mode, where risky actions, questions and plans still ask. The two cannot be combined, and -p already runs with auto permission.

In EnvHaven: The image launches kimi with --auto. The details, and when full access is safe, are on the Kimi Code CLI full-access page.

Instructions file

Kimi Code CLI reads AGENTS.md, .kimi-code/AGENTS.md, ~/.kimi-code/AGENTS.md, ~/.agents/AGENTS.md.

Add MCP servers

In ~/.kimi-code/mcp.json (or .kimi-code/mcp.json in a trusted project):

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/config/workspace"]
    }
  }
}

The MCP config converter writes the same server for every agent at once.

Run it from scripts

kimi -p "<prompt>"

Headless runs cannot stop to ask, so they need the full-access setting above.

Kimi Code CLI away from your desk

Kimi Code CLI keeps working only while the machine it runs on is awake. In EnvHaven that machine is the workspace, which never sleeps: start a task, close the laptop and check on it from a phone.

Moonshot AI’s own options:

  • Remote Control (kimi rc, or /remote-control in a session) prints a link and QR code to drive the machine from a phone or another computer; it needs a paid membership.

Compare Kimi Code CLI

When Kimi Code CLI misbehaves