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.
- In the console, open your API key under Agents, choose Connect, and open the Kimi Code CLI tab.
- On the Platform card, choose Use this, and store your Kimi platform API key (from platform.kimi.ai).
- 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.
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 = 1000000The same provider and model for one shell, without changing config.toml: the CLI builds them in memory
from these variables.
export KIMI_MODEL_PROVIDER_TYPE=openaiexport KIMI_MODEL_BASE_URL=https://api.milgram.dev/v1/proxy/moonshot/v1export KIMI_MODEL_API_KEY=mlg_YOUR_KEYexport KIMI_MODEL_NAME=kimi-k3.1-proexport KIMI_MODEL_MAX_CONTEXT_SIZE=1000000kimi-k3.1-pro is the model Kimi recommends today, with a 1M-token context; any model of the Kimi platform
works the same way.
Check it
Section titled “Check it”Start kimi and send a prompt. The session appears in the console under Sessions, with the moonshot
provider.