Kimi K2 API guide: current models, pricing, and production tests
Older Kimi K2 model IDs are retired. Learn the current K2-family options, OpenAI-compatible setup, cost model, and tests to run before production.
The original Kimi K2 API tutorials are now easy to misread because their model
IDs have been retired. For new K2-family integrations, Moonshot AI currently
lists kimi-k2.6 for general work and kimi-k2.7-code for software-engineering
tasks. Kimi K3 is the newer flagship model.
The first production check is therefore model discovery, not prompt tuning.
Current Kimi K2-family options
| Model | Best starting point for | Context window |
|---|---|---|
kimi-k2.6 | General reasoning, multimodal input, tools | 262,144 |
kimi-k2.7-code | Long-running coding work | 262,144 |
kimi-k2.7-code-highspeed | Coding when latency matters more | 262,144 |
kimi-k3 | New flagship workloads | 1,000,000 |
Do not start a new integration with retired preview IDs such as
kimi-k2-0905-preview, kimi-k2-thinking, or kimi-k2-turbo-preview. Call
GET /v1/models for the account before assuming an example is current.
Kimi K2 API pricing
Moonshot separates cached input, uncached input, and generated output. At the time of writing, its listed per-million-token rates are:
| Model | Cached input | Uncached input | Output |
|---|---|---|---|
kimi-k2.6 | $0.16 | $0.95 | $4.00 |
kimi-k2.7-code | $0.19 | $0.95 | $4.00 |
kimi-k2.7-code-highspeed | $0.38 | $1.90 | $8.00 |
Caching matters most when requests reuse a long system prompt, repository context, document collection, or conversation prefix. Measure the observed cache-hit rate; a theoretical cached price is irrelevant if request structure prevents reuse.
OpenAI-compatible setup
Kimi supports the OpenAI Chat Completions shape at
https://api.moonshot.ai/v1. That reduces integration work, but compatibility
does not mean identical behavior.
Keep API keys in a secret manager, separate development and production keys, and revoke an exposed key instead of trying to hide it after the fact.
What compatibility does not guarantee
Provider swaps can change tool-call formatting, JSON adherence, stop behavior, tokenization, retry semantics, and safety responses. A request that passes type checking can still fail at the product level.
Test at least these cases:
- Parallel and sequential tool calls
- Missing required tool arguments
- Tool timeouts and duplicate side effects
- Long conversations near the context limit
- Structured output with optional and nested fields
- Thinking and non-thinking behavior where supported
- Multilingual and mixed-media inputs used by real customers
Evaluate Kimi on the complete agent loop
Do not grade only the final answer. Score whether the model selected the right tool, used the returned evidence, stopped at the right time, and recovered from failures. Compare latency and cost per successful task rather than cost per raw token.
For coding agents, include repository navigation, edit accuracy, test execution, and regression avoidance. For support agents, include policy grounding, escalation, and safe handling of irreversible actions.
Observe every production request
Record the resolved model ID, token counts, cache behavior, tool trajectory, latency, errors, and outcome. Model aliases and availability can change, so the model requested by the application should be compared with the model reported by the provider.
Currai turns those traces into comparable evaluations and production alerts. Instrument the agent with the Currai integration skill, then replay the same workload across K2.6, K2.7 Code, K3, or another provider.
