How Moonshot works
Moonshot AI publishes the Kimi family of models (Kimi K2, K2 Thinking, K2.5). Kimi is particularly strong on long-context code understanding and agentic tasks, and the API is fully OpenAI-compatible, so Kodus talks to it with the existing OpenAI-compatible adapter.Moonshot’s consumer subscriptions (Andante, Moderato, etc.) apply to the Kimi.ai chat product, not to the API. API usage is billed pay-per-token regardless of any chat subscription you hold. This is different from providers like Z.AI, where the subscription grants API quota directly.
- International —
platform.moonshot.ai— base URLhttps://api.moonshot.ai/v1. Billed in USD. This is the default for users outside China. - China —
platform.moonshot.cn— base URLhttps://api.moonshot.cn/v1. Billed in CNY. Use only if you already operate inside mainland China.
Recommended Models
For the most up-to-date catalog and prices, see platform.moonshot.ai.
| Model | Pricing (1M input / output tokens) | Context Window | Notes |
|---|---|---|---|
Kimi K2.5 recommended | 2.50 | ~256k tokens | Latest generation, strongest coding results. |
| Kimi K2 Thinking | ~2.50 | ~256k tokens | Reasoning variant; use when review needs deeper analysis. |
| Kimi K2 (0905) | lower pricing tier | ~128k tokens | Stable general-purpose model. |
model names:
kimi-k2.5kimi-k2-thinkingkimi-k2-0905kimi-k2
Creating an API Key
- Go to platform.moonshot.ai and create an account (or sign in). Users inside mainland China should use platform.moonshot.cn instead.
- Add a payment method — Moonshot does not offer a mandatory free trial on the international platform; a small credit balance may be granted when you first add billing.
- Open the API Keys section in the console.
- Click Create API Key, give it a descriptive name (e.g.
kodus-prod), and copy the key immediately.
Configure Moonshot in Kodus
The primary flow is BYOK on Kodus Cloud — you paste the Moonshot key into the web UI and you’re done. Self-hosted users who prefer fixing the provider at the process level can use environment variables instead.Option 1 — BYOK on Kodus Cloud (recommended)
- In the Kodus web UI, open Settings → BYOK and click Edit on the Main model (or Fallback, if you want Kimi as a backup).
- Toggle the form into Custom mode so you can enter a base URL and a free-text model name.
-
Fill the fields:
Field Value Provider OpenAI CompatibleAPI Key your Moonshot API key Base URL https://api.moonshot.ai/v1(international)https://api.moonshot.cn/v1(mainland China only)Model kimi-k2.5(recommended) — orkimi-k2-thinking,kimi-k2-0905,kimi-k2Max Concurrent Requests 5–10is a good starting point; Moonshot has generous per-account limitsMax Input Tokens you can raise this for K2.5’s 256k window; leave default otherwise - Save. Kodus validates the key against the endpoint and surfaces any 401 / 404 immediately.
- Open any PR to trigger a review and confirm Moonshot is now serving responses — the BYOK status badge in Settings turns green on the first successful call.
You can configure Moonshot as Main and keep an OpenAI or Anthropic key as Fallback — if Moonshot returns 429 or 402, Kodus fails over automatically.
Option 2 — Self-hosted (environment variables)
If you run Kodus in Fixed Mode (single global provider, no per-org BYOK), configure Moonshot in the.env of your API + worker containers:
This path is only needed for self-hosted Kodus installs that deliberately disable BYOK. If BYOK is enabled on your self-hosted instance, prefer Option 1 — the UI-based flow is the same as on Cloud.
.env, then verify the integration:
Choosing between Moonshot and an aggregator
You can also reach Kimi K2.5 through OpenRouter, which is already supported as a first-class Kodus provider. The trade-off:- Direct Moonshot API — lowest per-token cost, largest context window, native rate limits. Requires a Moonshot account and billing.
- OpenRouter proxy — single billing relationship for many providers, but a small routing markup and slightly slower cold starts.
Troubleshooting
401 / authentication errors
401 / authentication errors
- Confirm the key is active in the Moonshot console.
- Verify the base URL matches the platform the key was created on — keys from
platform.moonshot.aido not work againstapi.moonshot.cnand vice versa. - Make sure there are no trailing spaces or quotes in the
.envvalue.
Insufficient balance
Insufficient balance
- Moonshot bills pay-per-token with no mandatory subscription. If balance runs out, requests return HTTP 402.
- Add funds in the billing section of the console or set a monthly cap to avoid surprises.
Model not found
Model not found
- Confirm the model name matches the catalog (
kimi-k2.5,kimi-k2-thinking,kimi-k2-0905,kimi-k2). - New model versions are released regularly — check the Kimi docs for the current list.
Slow first response
Slow first response
- First call after a period of inactivity may cold-start on Moonshot’s side.
- If latency matters, prefer
kimi-k2-0905over the thinking variant for routine code reviews.
Region / connectivity
Region / connectivity
- Users outside China should always use
api.moonshot.ai;api.moonshot.cnmay be unreachable or rate-limited from outside mainland China. - Confirm outbound HTTPS to
api.moonshot.aiis allowed from your Kodus deployment.
Related
- Moonshot platform (international)
- Kimi API documentation
- Kimi K2.5 on OpenRouter — if you prefer aggregated billing
- BYOK overview