Kimi API Pricing in 2026: Real Costs, the Cache Discount & How to Call It
Moonshot's Kimi API gives you the open-weights K2 family — K2.6 (general), K2.5, and K2.7 Code (the coding-focused model) — at low prices with a deep cache-hit discount that, for the right workload, is the single biggest cost lever you have. This guide has the verified price table, a modeled cost breakdown for real workloads, a clear explanation of how the cache-hit discount works and what it actually saves, the licensing fine print, how to get a Moonshot key, and a worked call with error handling.
What the Kimi API is
The Kimi API is Moonshot AI's access to its open-weights K2 family:
- K2.7 Code — the coding-focused, agentic model (the strongest coder of the family).
- K2.6 — the general-purpose model Moonshot recommends for non-coding work.
- K2.5 — the cheaper prior tier, still very capable.
It is OpenAI-compatible, cheap, and open-weights (so you can self-host). Its standout commercial feature is a deep cache-hit discount that makes repeated-context workloads — agents and RAG that resend a big fixed context every turn — dramatically cheaper than the headline price suggests. That, plus a large ~256K context window, is why Kimi has become a go-to for long-context agentic stacks.
Kimi API pricing table
| Model | Input | Cache-hit input | Output | Context |
|---|---|---|---|---|
| Kimi K2.7 Code | $0.95 | $0.19 | $4.00 | 256K |
| Kimi K2.6 | $0.68 | — | $3.41 | 262K |
| Kimi K2.5 | $0.38 | — | $2.02 | 262K |
Per 1M tokens, USD, June 2026. K2.7 Code prices are Moonshot's direct API; on third-party hosts like OpenRouter it runs around $0.75/$3.50. K2.6/K2.5 prices are from the DataLLM Lab catalog.
What Kimi actually costs to run
Headline rates don't tell you the bill — your traffic shape does. Here's what the Kimi tiers cost across five canonical monthly workloads (cache-miss pricing, so this is the conservative ceiling), with two frontier models for contrast:
| Monthly workload | Kimi K2.7 Code | Kimi K2.6 | Kimi K2.5 | GPT-5.4 | Claude Opus 4.7 |
|---|---|---|---|---|---|
| Support chatbot | $86.0 | $68.1 | $39.4 | $280 | $500 |
| RAG / knowledge base | $270 | $204 | $116 | $800 | $1,500 |
| Coding agent | $176 | $140 | $80.9 | $575 | $1,025 |
| Batch extraction | $175 | $129 | $73.2 | $495 | $950 |
| Content generation | $179 | $150 | $88.4 | $650 | $1,100 |
Even at cache-miss prices, Kimi K2.5 on a coding-agent workload runs about $81/month versus ~$1,025 for Claude Opus. And because these figures ignore the cache-hit discount, the input-heavy rows (RAG, batch extraction) are the conservative ceiling — the next section shows how much lower they go.
How the cache-hit discount works
This is Kimi's signature lever and the reason its real-world cost often beats cheaper-looking rivals. Here's the mechanism:
When consecutive requests share a common prefix — a large system prompt, a fixed set of tool definitions, or a retrieved document you keep in context — Moonshot can serve those repeated tokens from cache instead of recomputing them. Cached tokens are billed at the cache-hit rate (~$0.19/M for K2.7 Code) rather than the fresh cache-miss rate (~$0.95/M) — roughly 5x cheaper on the repeated portion.
Worked example. An agent sends a 30K-token fixed context (system prompt + tools + retrieved docs) plus a 1K-token user turn, 100,000 times a month:
- Without caching: all 31K tokens billed at $0.95/M → 3.1B input tokens → ~$2,945/month input.
- With caching: the 30K fixed prefix hits cache at $0.19/M (~$570) and only the 1K fresh turn pays $0.95/M (~$95) → ~$665/month input.
That's roughly a 77% cut on input cost for a workload that reuses a big context — which is exactly what agents and RAG do. The discount only helps when prefixes actually repeat, so structure your prompts to keep the stable part (instructions, tools) at the front and the variable part (the user turn) at the end.
How it compares on price
On headline output price, Kimi sits in the cheap-open tier — below the Western frontier, alongside DeepSeek and Qwen:
The license fine print
Kimi K2 models are open-weights under a Modified MIT license. It's standard MIT — permissive, commercial-friendly — with one added clause: deployments above 100M monthly active users or $20M monthly revenue must display "Kimi" attribution. For virtually every team that threshold never applies, so it behaves like plain MIT. The practical implication: you can download the weights from Hugging Face, self-host, fine-tune, and ship commercially without legal friction — a meaningful edge over models with more restrictive open licenses.
How to get a Moonshot key
- Sign up at the Moonshot platform (platform.moonshot.ai) and verify.
- Add billing (new accounts often get trial credit).
- Create an API key and store it as
export MOONSHOT_API_KEY=... - Use the OpenAI-compatible base URL
https://api.moonshot.ai/v1.
How to call it (worked example)
The OpenAI SDK works with a base-URL and model-id change. Structure the prompt so the stable prefix comes first to maximize cache hits:
from openai import OpenAI, APIError
client = OpenAI(base_url="https://api.moonshot.ai/v1", api_key="$MOONSHOT_API_KEY")
# keep the stable system/context first so it hits cache on repeat calls
messages = [
{"role": "system", "content": BIG_FIXED_CONTEXT}, # cached on repeat → ~5x cheaper
{"role": "user", "content": user_turn}, # the only fresh tokens
]
try:
resp = client.chat.completions.create(model="kimi-k2.7-code", messages=messages)
print(resp.choices[0].message.content)
except APIError as e:
print("Kimi API error:", e.status_code, e.message) # 401 key, 429 rate, 400 model id
Which Kimi model to use
Coding / agents K2.7 Code
- Strongest coder, cache-hit discount, agentic tuning. The pick for code.
General K2.6
- Moonshot's recommended non-coding model — writing, analysis, chat.
Budget K2.5
- Cheapest tier, still capable. Good for high-volume general work.
Best move Cache + route
- Front-load stable context for cache hits; route K2.5 first where quality allows.
Calling it through a gateway
To use Kimi alongside other models with failover, call it through a gateway. DataLLM Lab carries Kimi K2.6 and K2.5 with one OpenAI-compatible key:
client = OpenAI(base_url="https://www.datallmlab.com/v1", api_key="$DATALLMLAB_API_KEY")
resp = client.chat.completions.create(model="moonshotai/kimi-k2.6", messages=[{"role":"user","content":"Hello"}])
Use Kimi and 300+ models with one key
Kimi K2.6, K2.5, DeepSeek V3.2, Qwen3 Coder, Claude Opus 4.7 and more — one OpenAI-compatible endpoint, live price comparison, automatic failover.
FAQ
How much does the Kimi API cost?
K2.7 Code ~$0.19 cache-hit / $0.95 input / $4.00 output; K2.6 $0.68/$3.41; K2.5 $0.38/$2.02 per 1M. On a modeled coding-agent workload, K2.5 is ~$81/month vs ~$1,025 for Claude Opus.
How does the Kimi cache-hit discount work?
Repeated prefixes (system prompt, tools, context) are served from cache at ~$0.19/M for K2.7 Code vs $0.95 fresh — ~5x cheaper. For a 30K reused context across 100K calls, it cuts input cost ~77%.
How do I get a Kimi (Moonshot) API key?
Sign up at platform.moonshot.ai, add billing, create a key. OpenAI-compatible at https://api.moonshot.ai/v1. Or reach Kimi via a gateway like DataLLM Lab.
Is the Kimi API OpenAI-compatible?
Yes — set base_url to https://api.moonshot.ai/v1 and the model id (e.g. kimi-k2.6, kimi-k2.7-code). The OpenAI SDK works unchanged.
Is Kimi open source?
Open-weights under Modified MIT — standard MIT plus an attribution clause only above 100M MAU or $20M monthly revenue. For most teams, effectively MIT. Weights on Hugging Face.
Which Kimi model should I use?
K2.7 Code for coding/agents, K2.6 for general work (Moonshot's recommendation), K2.5 for the cheapest tier. All share a ~256K context that pairs well with caching.
Can I use the Kimi API through a gateway?
Yes — DataLLM Lab carries K2.6 and K2.5 via one OpenAI-compatible key with failover. K2.7 Code is on Moonshot's API and third-party hosts.
Is Kimi cheaper than DeepSeek or Qwen?
Same tier. On headline output, DeepSeek ($0.34) and Qwen Coder ($0.80) undercut Kimi K2.6 ($3.41); but Kimi's cache-hit discount can win for big-reused-context workloads. Compare on your traffic shape.
What context window does Kimi support?
The K2 family supports ~256K-262K tokens — well suited, with caching, to long-context agents and document workflows.
DataLLM Lab