Skip to content

Kimi Code CLI

Kimi Code CLI can use the Kimi platform’s pay-per-token API through the proxy’s moonshot path. The CLI has one credential slot, and here it holds your Milgram API key: you store your Kimi platform key in the console once, and the proxy puts it in place of your Milgram key on the way out. Milgram keeps it for your traffic only and never shows it again.

  1. In the console, open your API key under Agents, choose Connect, and open the Kimi Code CLI tab.
  2. On the Platform card, choose Use this, and store your Kimi platform API key (from platform.kimi.ai).
  3. Configure the CLI as below.

Merge this provider and model into ~/.kimi-code/config.toml and replace its top-level default_model. Keep every other setting in the file.

~/.kimi-code/config.toml
default_model = "milgram-moonshot"
[providers.milgram-moonshot]
type = "openai"
base_url = "https://api.milgram.dev/v1/proxy/moonshot/v1"
api_key = "mlg_YOUR_KEY"
[models.milgram-moonshot]
provider = "milgram-moonshot"
model = "kimi-k3.1-pro"
max_context_size = 1000000

kimi-k3.1-pro is the model Kimi recommends today, with a 1M-token context; any model of the Kimi platform works the same way.

Start kimi and send a prompt. The session appears in the console under Sessions, with the moonshot provider.