AI agents

Kimi Code CLI

Terminal Commands (kimi)

Terminal commands vs slash commands. kimi ... commands run in your shell, outside (or to launch) the agent. Slash commands like /login or /model are typed inside the interactive TUI. A few concepts exist in both worlds — e.g. kimi login (shell) vs /login (TUI) — but they are distinct interfaces. For slash commands see Slash Commands; for launch flags see CLI Flags.

Basic usage

kimi [options]
kimi <subcommand> [options]
kimi                 # start the interactive TUI
kimi -p "explain this repo"   # non-interactive one-shot prompt
kimi -c              # resume most recent session in this directory
kimi --version       # print version and exit (-V)
kimi --help          # show help and exit (-h)

Subcommands

kimi login

Non-interactive OAuth device-code login. No flags.

kimi login

Exit code 0 on success, 1 on cancel/failure. Interactive alternative: /login in the TUI.

kimi acp

Starts ACP (Agent Client Protocol) mode for IDE integration — JSON-RPC over stdio. Normally launched by the IDE (Zed, JetBrains, Paseo), not by hand.

kimi acp

kimi web

Runs a foreground local server exposing REST + WebSocket + a web UI from one origin.

kimi web                       # default 127.0.0.1:58627 (busy port → retries +1)
kimi web --port 9000 --no-open
kimi web --host                # bare --host binds 0.0.0.0
kimi web rotate-token          # rotate the persistent bearer token

Options: --port <port>, --host [host], --allowed-host <host...>, --log-level <level>, --debug-endpoints, --web-title <title>, --no-open, and --dangerous-bypass-auth (DANGER: disables bearer auth entirely). The startup banner prints the bearer token; it is persisted at ~/.kimi-code/server.token. API schemas at GET /openapi.json and GET /asyncapi.json. kimi server … is deprecated (exit 1) except kimi server kill for pre-0.28.0 background servers.

kimi doctor

Validates config.toml / tui.toml without starting the TUI.

kimi doctor                    # validate both files
kimi doctor config [path]      # validate config.toml only
kimi doctor tui [path]         # validate tui.toml only

Exit 0 when valid or skipped, 1 when missing or invalid.

kimi export

Packages a session into a debug ZIP (same as /export-debug-zip in the TUI).

kimi export                          # most recent session in cwd (asks for confirmation)
kimi export <sessionId> -o debug.zip -y

Options: -o/--output <path>, -y/--yes (skip confirmation), --no-include-global-log.

kimi migrate

Interactive migration from the legacy Python kimi-cli (~/.kimi/ data): config, MCP servers, input history, sessions.

kimi migrate

Notes: OAuth credentials and MCP authorizations are not migrated (re-run /login); old data is never modified or deleted; re-runnable; imported sessions are tagged [imported].

kimi upgrade

Checks for and installs updates. kimi update is an alias.

kimi upgrade

npm installs can also upgrade via npm install -g @moonshot-ai/kimi-code@latest.

kimi vis

Opens a session visualizer in the browser.

kimi vis [sessionId] [--port <number>] [--host <host>] [--no-open]

kimi provider

Non-interactive provider management.

kimi provider add <url> --api-key <key>        # bulk-import from a registry api.json
kimi provider remove <providerId>              # removes provider + model aliases
kimi provider list [--json]
kimi provider catalog list [providerId] [--filter <substring>] [--json]
kimi provider catalog add <providerId> --api-key <key> [--default-model <modelId>]

Notes: the registry API key can also come from KIMI_REGISTRY_API_KEY; the catalog falls back to a built-in snapshot when offline; undeclared protocols (xai, openrouter) are imported as OpenAI-compatible; proprietary protocols (Bedrock) can’t be imported; remove clears default_model if it referenced the provider. Interactive alternative: /provider in the TUI.

kimi session list

Lists sessions from the command line.

kimi session list

Added in 0.40.0 per the changelog; not yet on the kimi command reference page at verification time.


Last verified: 2026-09-07

Official sources:

AI coding tools evolve quickly. If you find outdated information, please open an issue or pull request.