Kimi
o4 includes the official Moonshot Open Platform API as the built-in
kimi-coding provider. It speaks the OpenAI-compatible Chat Completions
protocol at https://api.moonshot.ai/v1.
Prerequisites
Section titled “Prerequisites”- A Moonshot Open Platform account
- An API key from the Moonshot Console
Quick start
Section titled “Quick start”Create a key in the console and export it for o4:
export KIMI_API_KEY="your-moonshot-api-key"Verify the embedded catalog:
o4 --list-modelsThe output includes:
Provider: kimi-coding kimi-k2-turbo-previewStart a session:
o4 -m kimi-coding:kimi-k2-turbo-previewModels
Section titled “Models”| Model id | Context | Max output | Reasoning |
|---|---|---|---|
kimi-k2-turbo-preview |
262,144 | 8,192 | low, high, max |
The model supports reasoning effort levels low, high, and max. Use
/reasoning in an interactive session or --reasoning max on the CLI to
select the thinking effort.
Endpoint and protocol
Section titled “Endpoint and protocol”Kimi uses the standard OpenAI Chat Completions endpoint:
POST https://api.moonshot.ai/v1/chat/completionsAuthorization: Bearer <your-api-key>o4 sends reasoning_effort (low/high/max) and a thinking extra body to
control reasoning. Reasoning content is streamed back via the reasoning_content
field in delta chunks.
Environment variable
Section titled “Environment variable”The API key is read from KIMI_API_KEY:
export KIMI_API_KEY="your-moonshot-api-key"Or open /config, select kimi-coding, and save the key in o4’s settings.
Troubleshooting
Section titled “Troubleshooting”API key not found
Section titled “API key not found”export KIMI_API_KEY="your-moonshot-api-key"HTTP 401
Section titled “HTTP 401”Check that you are using a Moonshot Open Platform key, not a Kimi Code membership key. The two services use different endpoints and keys.
Quota or rate limit errors
Section titled “Quota or rate limit errors”Moonshot Open Platform usage is pay-as-you-go. A 429 indicates a rate limit or insufficient quota. Check the response detail for specifics.