Skip to content
Connect a clientKimi CLI

Kimi CLI

new

Moonshot AI terminal agent with a universal Guard key.

Set up with your own AI
Model protocol

Kimi CLI is the terminal agent from Moonshot AI: package @moonshot-ai/kimi-code, command kimi. It takes a third-party address from its own config file, where the provider is declared explicitly.

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

On Windows: irm https://code.kimi.com/kimi-code/install.ps1 | iex, and Git for Windows is required before the first launch. Through npm: npm install -g @moonshot-ai/kimi-code, Node.js 22.19.0 or later.

Settings live in ~/.kimi-code/config.toml. A provider is one [providers.<name>] entry: the required type field, then api_key, base_url and optionally custom_headers. The type value is what picks the protocol; for the Guard address use openai.

toml
# ~/.kimi-code/config.toml
[providers.guard]
type = "openai"
base_url = "https://api.guardrelay.ai/v1"
api_key = "gd-your-key-from-bot"

[models."guard/claude"]
provider = "guard"
model = "claude-sonnet-5"
max_context_size = 1000000
toml
# ~/.kimi-code/config.toml
[providers.guard]
type = "openai"
base_url = "https://api.guardrelay.ai/v1"
api_key = "gd-your-key-from-bot"

[models."guard/k3"]
provider = "guard"
model = "k3"
max_context_size = 1048576
toml
# ~/.kimi-code/config.toml
[providers.guard]
type = "openai"
base_url = "https://api.guardrelay.ai/v1"
api_key = "gd-your-key-from-bot"

[models."guard/grok"]
provider = "guard"
model = "cursor-grok-4.6-medium"
max_context_size = 500000
toml
# ~/.kimi-code/config.toml
[providers.guard]
type = "openai"
base_url = "https://api.guardrelay.ai/v1"
api_key = "gd-your-key-from-bot"

[models."guard/composer"]
provider = "guard"
model = "composer-2.5"
max_context_size = 200000

A model entry needs three fields: provider, model and max_context_size. The first points at the provider name, the second is the exact id sent to the server, the third is the context window the client budgets against. The per-family numbers are on the Models page.

Run it with kimi -m "guard/..." using the alias from the file. To avoid passing it every time, set default_model in the same config.toml.

Documentation sections

On this page