Kimi Code CLI Cheatsheet - Moonshot Terminal AI Coding Agent

Kimi Code CLI is an agent that ships the model wiring with the binary: installed, it works, with no base_url to fill in, no SDK to configure, no PATH juggling, and little risk of colliding with global modules. That turnkey state suits two kinds of people - developers already inside the Kimi ecosystem, and anyone who simply wants a working terminal agent with zero setup. It is not closed, though: switching to another vendor's model means editing a user-level config file with the corresponding API key, with no need to migrate your workflow. This sheet covers installation and launch, interactive and one-shot execution, sessions and models, and subcommands and operations. A sensible order is to confirm one interactive session works, then learn single-shot execution for scripts, and only then handle session resumption and model switching. One practice is worth doing early: generating a project conventions file before a large change, so the agent starts work already knowing the repository's naming and layout habits - cheaper than correcting its style afterwards.

AI CLI·34 commands·Last updated 2026-08-26
kimikimi-codemoonshotaicliagentCoding Agent

Install & Launch 4

npm install -g @moonshot-ai/kimi-code
Install globally via npm
curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash
Official script install (no Node.js prereq)
kimi --version
Print the installed version
kimi
Start the interactive UI in the project dir

Interactive & Single Instructions 5

kimi -p "Show this project directory structure"
Run a single instruction without the interactive UI
kimi -C
Resume the previous session
/login
Sign in via Kimi Code OAuth or Moonshot API key
/logout
Clear the current credentials
/init
Scan the project and generate AGENTS.md

Sessions & Models 5

/model
Switch the current model
/compact
Manually compact context to free tokens
/fork
Fork the current session, keep history, continue independently
/sessions
Browse session history and pick one to resume
kimi acp
Drive Zed/JetBrains editors via Agent Client Protocol

Subcommands & Ops 20

kimi --session <id> / -S
Resume a session by ID; picker without ID
kimi --model <model> / -m
Specify the model alias for this launch
kimi --yolo / -y
Auto-approve regular tool calls (trusted dirs only)
kimi --auto
Start in auto permission mode; agent asks nothing
kimi --plan
Start a new session in Plan mode
kimi --skills-dir <dir>
Load Skills from a directory (repeatable)
kimi --add-dir <dir>
Add an extra workspace dir (repeatable)
kimi --work-dir <dir> / -w
Set the root for file operations
kimi --thinking / --no-thinking
Explicitly enable/disable thinking mode
kimi --agent <name>
Select a built-in agent spec (experimental)
kimi login
Non-interactive device-code OAuth login
kimi server run
Start or reuse the local Kimi service daemon
kimi server status
Print install/run status and port (--json for scripts)
kimi web
Start service in background and open the web UI
kimi doctor
Validate config.toml and tui.toml
kimi doctor config
Validate only config.toml
kimi doctor tui
Validate only tui.toml
kimi export [sessionId]
Package a session as a ZIP for sharing
kimi upgrade
Check and upgrade to the latest version
kimi provider
Manage provider config

Tips

  • Kimi Code CLI ships as a zero-dependency binary: one script install and it just works — no PATH fiddling, no conflicts with global modules.
  • kimi -p runs a single instruction and kimi -C resumes a session — these are the workhorses for scripts and automation. Run /init before big tasks to generate AGENTS.md so the agent understands the project.
  • To use other vendors (Anthropic/OpenAI/Google), just edit ~/.kimi-code/config.toml with the corresponding API key.

FAQ

What is the relationship between the kimi command and the kimi-cli package?

This sheet covers Moonshot official Kimi Code CLI (npm package @moonshot-ai/kimi-code); the installed command is kimi. There is also a separate community Python package named kimi-cli, which is a different project.

Can Kimi Code CLI run on Windows?

Yes. On Windows run the install script irm https://code.kimi.com/kimi-code/install.ps1 | iex in PowerShell. Install Git for Windows first; the CLI uses its Git Bash as the shell environment.

Official References

Each command links to its official documentation below, so you can verify the latest usage and read deeper.

Maintained by LaoHand

Publicly updated on Aug 26, 2026, continuously proofread against official docs.

Contact Us

Wrong command or description? Send us corrections, business inquiries or product feedback by email.

Contact Us