Skip to content

kimi Command

kimi is the main command for Kimi Code CLI, used to start interactive sessions or execute single queries.

sh
kimi [OPTIONS] COMMAND [ARGS]

Basic information

OptionShortDescription
--version-VShow version number and exit
--help-hShow help message and exit
--verboseOutput detailed runtime information
--debugLog debug information (output to ~/.kimi/logs/kimi.log)

Agent configuration

OptionDescription
--agent NAMEUse built-in agent, options: default, okabe
--agent-file PATHUse custom agent file

--agent and --agent-file are mutually exclusive. See Agents and Subagents for details.

Configuration files

OptionDescription
--config STRINGLoad TOML/JSON configuration string
--config-file PATHLoad configuration file (default ~/.kimi/config.toml)

--config and --config-file are mutually exclusive. Both configuration strings and files support TOML and JSON formats. See Config Files for details.

Model selection

OptionShortDescription
--model NAME-mSpecify LLM model, overrides default model in config file

Working directory

OptionShortDescription
--work-dir PATH-wSpecify working directory (default current directory)

The working directory determines the root directory for file operations. Relative paths work within the working directory; absolute paths are required to access files outside it.

Session management

OptionShortDescription
--continue-CContinue the previous session in the current working directory
--session ID-SResume session with specified ID, creates new session if not exists

--continue and --session are mutually exclusive.

Input and commands

OptionShortDescription
--prompt TEXT-pPass user prompt, doesn't enter interactive mode
--command TEXT-cAlias for --prompt

When using --prompt (or --command), Kimi Code CLI exits after processing the query (unless --print is specified, results are still displayed in interactive mode).

Loop control

OptionDescription
--max-steps-per-turn NMaximum steps per turn, overrides loop_control.max_steps_per_turn in config file
--max-retries-per-step NMaximum retries per step, overrides loop_control.max_retries_per_step in config file
--max-ralph-iterations NNumber of iterations for Ralph Loop mode; 0 disables; -1 is unlimited

Ralph Loop

Ralph is a technique that puts an agent in a loop: the same prompt is fed again and again so the agent can keep iterating one big task.

When --max-ralph-iterations is not 0, Kimi Code CLI enters Ralph Loop mode and automatically loops through task execution until the agent outputs <choice>STOP</choice> or the iteration limit is reached.

UI modes

OptionDescription
--printRun in print mode (non-interactive), implicitly enables --yolo
--quietShortcut for --print --output-format text --final-message-only
--acpRun in ACP server mode (deprecated, use kimi acp instead)
--wireRun in Wire server mode (experimental)

The four options are mutually exclusive, only one can be selected. Default is shell mode. See Print Mode and Wire Mode for details.

The following options are only effective in --print mode:

OptionDescription
--input-format FORMATInput format: text (default) or stream-json
--output-format FORMATOutput format: text (default) or stream-json
--final-message-onlyOnly output the final assistant message

stream-json format uses JSONL (one JSON object per line) for programmatic integration.

MCP configuration

OptionDescription
--mcp-config-file PATHLoad MCP config file, can be specified multiple times
--mcp-config JSONLoad MCP config JSON string, can be specified multiple times

Default loads ~/.kimi/mcp.json (if exists). See Model Context Protocol for details.

Approval control

OptionShortDescription
--yolo-yAuto-approve all operations
--yesAlias for --yolo
--auto-approveAlias for --yolo

Note

In YOLO mode, all file modifications and shell commands are automatically executed. Use with caution.

Thinking mode

OptionDescription
--thinkingEnable thinking mode
--no-thinkingDisable thinking mode

Thinking mode requires model support. If not specified, uses the last session's setting.

Skills configuration

OptionDescription
--skills-dir PATHSpecify skills directory, skipping auto-discovery

When not specified, Kimi Code CLI automatically discovers user-level and project-level skills directories in priority order. See Agent Skills for details.

Subcommands

SubcommandDescription
kimi loginLog in to your Kimi account
kimi logoutLog out from your Kimi account
kimi infoDisplay version and protocol information
kimi acpStart multi-session ACP server
kimi mcpManage MCP server configuration
kimi termLaunch the Toad terminal UI
kimi webStart the Web UI server

kimi login

Log in to your Kimi account. This automatically opens a browser; complete account authorization and available models will be automatically configured.

sh
kimi login

kimi logout

Log out from your Kimi account. This clears stored OAuth credentials and removes related configuration from the config file.

sh
kimi logout

kimi web

Start the Web UI server to access Kimi Code CLI through a browser.

sh
kimi web [OPTIONS]

If the default port is in use, the server will pick the next available port (by default 54945503) and print a notice in the terminal.

OptionShortDescription
--host TEXT-hHost address to bind to (default: 127.0.0.1)
--port INTEGER-pPort number to bind to (default: 5494)
--reloadEnable auto-reload (development mode)
--open / --no-openAutomatically open browser (default: enabled)

Examples:

sh
# Default startup, automatically opens browser
kimi web

# Specify port
kimi web --port 8080

# Don't automatically open browser
kimi web --no-open

# Bind to all network interfaces (allow LAN access)
kimi web --host 0.0.0.0

See Web UI for details.