TL;DR
Current as of July 16, 2026, the day kimi-k3 launched. Model names and rates move fast in launch weeks; check the platform console before committing volume.
“the OpenAI-compatible base URL. Auth is a bearer key from platform.moonshot.ai; the account needs a $1 minimum top-up before a key works.”
The Kimi API is Moonshot AI's OpenAI-compatible endpoint. The July 16, 2026 flagship is kimi-k3 (2.8T parameters, 1M context, native vision, thinking always on) at $3/$15 per M tokens with $0.30 cache hits. Below it, three K2-family models stay live and cheaper: kimi-k2.6 and kimi-k2.7-code at $0.95/$4.00 and kimi-k2.5 at $0.60/$3.00, all with 256K context. For the full K3 deep dive, see Kimi K3.
How to call it
OpenAI SDK, base_url=https://api.moonshot.ai/v1, model=kimi-k3 (or a K2 model by name). Anthropic-compatible route at /anthropic for Claude Code. Streaming with separate reasoning/content deltas, structured JSON output, tool calling, vision inputs.
What bites people
Rate limits scale with cumulative top-up (Tier 0-5) and count request tokens + max_completion_tokens at the account level, not tokens generated. A high max_completion_tokens on a low tier, plus the OpenAI SDK's auto-retry, is how one request 429s your whole minute.
The Full Kimi API Model List (July 16, 2026)
Five model names matter. One flagship, three K2-family workhorses still live, and two names that are now retired aliases you should stop targeting.
| Model | Input | Cached input | Output | Context |
|---|---|---|---|---|
| kimi-k3 | $3.00 | $0.30 | $15.00 | 1M, flat |
| kimi-k2.6 | $0.95 | — | $4.00 | 256K |
| kimi-k2.7-code | $0.95 | $0.19 | $4.00 | 256K |
| kimi-k2.5 | $0.60 | — | $3.00 | 256K |
Sources: Moonshot platform pricing and third-party pricing hubs (BenchLM, OpenRouter), July 2026. Billing is flat pay-as-you-go with no long-context surcharge and no batch discount published for K3. Cache-hit rates apply to the models that list them (K3 at $0.30/M, K2.7 Code at $0.19/M).
kimi-latest was discontinued January 28, 2026, and the entire kimi-k2 series (the original K2, not K2.5/K2.6/K2.7) was discontinued May 25, 2026. Both now point users at kimi-k3. Target a specific supported model by name; do not rely on a "latest" alias.
Base URL, API Key, and Auth
Four steps to a working key: sign up at platform.moonshot.ai, recharge at least $1 to activate the account, create an API key in the console, and call the OpenAI-compatible endpoint at https://api.moonshot.ai/v1 with the key as a bearer token. The minimum top-up is a hard gate: a brand-new account with a $0 balance cannot make a billable call.
from openai import OpenAI
client = OpenAI(
base_url="https://api.moonshot.ai/v1",
api_key="YOUR_MOONSHOT_API_KEY",
max_retries=0, # see the 429 section: SDK auto-retry can eat a low-tier quota
)
resp = client.chat.completions.create(
model="kimi-k3",
messages=[
{"role": "user", "content": "Trace this race condition and propose a fix."},
],
max_completion_tokens=8192, # this counts against your rate limit up front
)
print(resp.choices[0].message.content)One region caveat that matters before you build on it: requests to the international platform are processed in China. For data-residency or GDPR constraints (the DACH region is the usual trigger), the hosted API is disqualified, and self-hosting the open-weight K2-family models is the compliant path. kimi-k3 weights are not published as of launch day, so the flagship cannot be self-hosted yet.
kimi-k3: The Flagship
kimi-k3 launched July 16, 2026: 2.8 trillion total parameters, a 1M-token context window, native vision (images and video), and thinking always on. It is built on Kimi Delta Attention, a hybrid linear-attention mechanism that interleaves linear and full-attention layers in a 3:1 ratio, cutting KV-cache memory by up to 75% at long context, which is why the 1M window is priced flat rather than tiered. Moonshot reports 81.2 on FrontierSWE and 88.3 on Terminal-Bench 2.0; those numbers are vendor-reported and independent verification is still landing. The full breakdown, including the confirmed-vs-leak split and the weights question, is on the Kimi K3 deep dive.
API-relevant specifics: max_completion_tokens defaults to 131,072 and goes up to 1,048,576; streaming exposes reasoning and content as separate deltas; structured JSON output with strict schema, tool calling with dynamic loading, and a prefix-continuation partial mode are supported. Because thinking is always on and reasoning_effort only supports max at launch, every request pays for a full reasoning trace at $15/M output. Budget for that, not the sticker rate (see the token-economics section below).
The Rate-Limit Tiers
Kimi enforces four limits at once: concurrency (simultaneous requests), RPM (requests per minute), TPM (tokens per minute), and TPD (tokens per day). Your tier is set by cumulative top-up, not a subscription: the more you have recharged over the account's lifetime, the higher every limit. Limits apply at the user level, not per key, so adding keys does not add headroom.
| Tier | Cumulative top-up | Concurrency | RPM | TPD |
|---|---|---|---|---|
| Tier 0 | $1 (minimum) | low | low | 1.5M tokens/day |
| Tier 1 | $10 | 50 | 200 | unlimited |
| Tier 5 | $3,000 | 1,000 | 10,000 | unlimited |
Tiers run 0 through 5; the table shows the anchor points. Tier 0 (before you top up past the $1 minimum) carries a 1.5M-token-per-day cap; topping up to $10 (Tier 1) removes the daily cap and unlocks 200 RPM / 50 concurrent. Source: Moonshot platform rate-limit docs, July 2026.
Kimi calculates rate-limit consumption as request tokens plus max_completion_tokens, regardless of how many tokens the model actually generates. A request that sends 2K tokens and sets max_completion_tokens=131072 books 133K tokens against your TPM the moment it's sent, even if the answer is 200 tokens. On a low tier, set max_completion_tokens to what you actually expect.
OpenAI vs Anthropic-Compatible Endpoints
Moonshot runs two compatible surfaces over the same models:
- OpenAI-compatible at
https://api.moonshot.ai/v1. Chat Completions, streaming, tool calling, structured output. Point the OpenAI SDK'sbase_urlhere and pass a Moonshot key; existing OpenAI-shaped code runs unchanged. - Anthropic-compatible at
https://api.moonshot.ai/anthropic. This is what Claude Code and Anthropic-SDK-shaped clients talk to. Same models, Messages-API shape.
Having both means you rarely have to rewrite a client to try Kimi: whatever SDK your agent already uses (OpenAI or Anthropic), there is an endpoint that matches its wire format. The one behavior to keep in mind across both is the SDK auto-retry interaction with low-tier rate limits, covered next.
Claude Code and Cline Setup
Claude Code points at the Anthropic-compatible endpoint through environment variables:
export ANTHROPIC_BASE_URL=https://api.moonshot.ai/anthropic
export ANTHROPIC_API_KEY=YOUR_MOONSHOT_API_KEY
export CLAUDE_CODE_AUTO_COMPACT_WINDOW=1048576 # kimi-k3's 1M context
claudeClaude Code's /model menu is a fixed list of Claude aliases and will not show Kimi models, so confirm the swap took effect with /status rather than the model picker. kimi-k3 thinks by default, so no extra thinking flag is needed; that differs from kimi-k2.7-code, which needs thinking mode enabled explicitly. You can persist these in ~/.claude/settings.json under an env object instead of exporting each session.
For Cline, RooCode, and similar OpenAI-SDK-based agents, select Moonshot as the provider (or a custom OpenAI-compatible provider), set the base URL to https://api.moonshot.ai/v1, paste your Moonshot key, and choose the model by name (kimi-k3 or kimi-k2.7-code). Keep the always-on reasoning in mind: an agent loop that fires many small calls pays max-effort reasoning on each one.
Common Errors: The 429 Trap
The error that dominates Moonshot's forum is HTTP 429. It is overloaded: a single 429 can mean engine overload, insufficient prepaid balance, or hitting any one of your concurrency, RPM, TPM, or TPD limits. The message text ("We're receiving too many requests at the moment") does not tell you which, and one known failure mode is that a 429 can actually be masking an insufficient-funds condition.
The self-inflicted version is worth calling out because it surprises people: the OpenAI SDK retries 429 and 5xx errors by default, and Moonshot's own docs warn that on a Tier 0 account a single erroneous request can exhaust the entire RPM quota through that retry loop. Combined with the "count max_completion_tokens up front" rule, a low-tier key with a high token cap and default retries can lock itself out fast.
- Lower
max_completion_tokensto what you actually expect; it books against your TPM up front. - Cap SDK retries (
max_retries=0, or a small number with backoff). The default auto-retry is what causes the lockout. - Top up to raise your tier: $10 removes the 1.5M-TPD cap and lifts RPM / concurrency.
- Check the balance first; a 429 can be masking insufficient funds.
- Reduce concurrency to your tier's ceiling; adding API keys does not help, since limits are per user, not per key.
The Token Economics of Always-On Thinking
kimi-k3's $3/$15 reads mid-tier until you account for how it generates. Thinking cannot be disabled and reasoning_effort only supports max at launch, so every request pays for a full reasoning trace at $15/M output. This is the same effect that makes cheap-per-token reasoning models expensive per task: GLM-5.2 burns tens of thousands of output tokens per hard task at max effort, and K3 launches with max as the only option. The per-token sticker understates the per-task bill.
The flat 1M-context pricing is the genuine differentiator. Anthropic charges a premium above 200K input tokens and Google tiers Gemini pricing by context length (see Gemini API pricing); Moonshot charges $3/M whether you send 4K or 900K tokens. For long-context workloads (repo-scale analysis, long agent traces, document piles) that flatness moves the calculus more than the headline rate.
If the workload is high-volume codegen where per-task cost dominates rather than context length, the K2-family models are the pragmatic choice on the Kimi API: kimi-k2.7-code at $0.95/$4.00 with a $0.19/M cache-hit rate is a fraction of K3's output cost, and it is the model Moonshot tuned for coding agents.
OpenRouter and Other Access Routes
Beyond Moonshot's own platform, the Kimi models are listed on OpenRouter (moonshotai/kimi-k3, moonshotai/kimi-k2.6, and others) and mirrored on cloud marketplaces (Amazon Bedrock carries K2.5 and K2-Thinking; NVIDIA and Cloudflare Workers AI carry K2.6). OpenRouter lists kimi-k3 at the same $3/$15 and notes one upstream provider serves it at launch, with effective blended cost often landing below list because of prompt caching.
Which route to pick: Moonshot's own API for the newest models and the recharge-tier headroom, OpenRouter for one key across many providers and automatic failover, and a cloud marketplace when you need the model inside an existing Bedrock/NVIDIA billing and compliance boundary. The open-weight K2-family models can also be self-hosted, which is the only path that keeps data out of China-based processing.
Kimi API vs Serving Open Alternatives
The Kimi API's pull is the flagship: kimi-k3 posts the strongest vendor-reported agentic numbers of the open lineage. Its costs are the per-token rate ($15/M output, always-on max reasoning) and the China-based data processing. If your workload is coding-agent throughput rather than top-tier reasoning on a few hard tasks, the open-weight models Morph serves cover most of the ground at a fraction of the output cost, with serving tuned on coding traffic.
| kimi-k3 (Moonshot) | GLM-5.2 | DeepSeek V4 Flash (Morph) | |
|---|---|---|---|
| Input | $3.00 | $1.40 | $0.139 |
| Output | $15.00 | $4.40 | $0.278 |
| Context | 1M, flat | 1M | 1M |
| Weights available | No (as of launch) | Yes, MIT | Yes |
| Self-host / private deploy | No | Yes | Yes |
| Thinking control | Always on, max only | Effort levels | Effort levels |
DeepSeek V4 Flash on Morph runs at roughly 2% of K3's output rate, and GLM-5.2 at about a third of K3's per-token price with weights you can hold. For the previous Moonshot generation and how agent swarms used it, see Kimi K2.5 and agent swarms. For the models Morph serves on custom codegen kernels, see Open Source Models.
Kimi API: Pros and Cons
- OpenAI-compatible (api.moonshot.ai/v1) and Anthropic-compatible (/anthropic) surfaces, so most clients need no rewrite
- kimi-k3 flagship: 2.8T params, 1M context at flat pricing, native vision, exposed reasoning traces
- Cheap K2-family tier still live: kimi-k2.7-code at $0.95/$4.00 with a $0.19/M cache rate
- Flat long-context pricing beats Anthropic's 200K premium and Gemini's tiered rates
- Streaming reasoning/content deltas, structured JSON output, tool calling, prompt caching
- Launch top-up promotion: 10-30% bonus credits through August 11, 2026
- kimi-k3 thinking is always on and reasoning_effort is max-only at launch, so output-token bills run high
- Rate limits are recharge-tiered and count max_completion_tokens up front, at the user level not per key
- The 429 error is overloaded and the OpenAI SDK's default auto-retry can lock out a low tier
- Requests are processed in China; no fit for strict data-residency / GDPR without self-hosting
- kimi-k3 weights are not published as of launch day, so the flagship cannot be self-hosted
- Minimum $1 top-up required; no perpetual free API tier
FAQ
What is the Kimi API base URL?
https://api.moonshot.ai/v1 for the OpenAI-compatible interface, and https://api.moonshot.ai/anthropic for the Anthropic-compatible endpoint (Claude Code). Auth is a bearer API key from platform.moonshot.ai, which requires a $1 minimum top-up to activate.
How much does the Kimi API cost?
kimi-k3: $3/M input, $0.30/M cached, $15/M output, flat context. kimi-k2.6 and kimi-k2.7-code: $0.95/$4.00 (256K). kimi-k2.5: $0.60/$3.00. Flat pay-as-you-go, no long-context surcharge. A 10-30% top-up bonus runs through August 11, 2026.
Is the Kimi API free?
No. It is prepaid pay-as-you-go with a $1 minimum top-up to activate. The consumer Kimi app and web chat are free; the programmatic API is metered.
Is the Kimi API OpenAI-compatible?
Yes. Point the OpenAI SDK's base_url at https://api.moonshot.ai/v1 and pass a Moonshot key. Cap retries: the SDK auto-retries 429/5xx, and on a Tier 0 account that can exhaust the RPM quota.
What is the newest Kimi API model?
kimi-k3, launched July 16, 2026: 2.8T parameters, 1M context, native vision, thinking always on. Full details on the Kimi K3 page.
Can I self-host Kimi to avoid China-based processing?
The open-weight K2-family models (K2.5, K2.6, K2.7) can be self-hosted, which keeps data on your own infrastructure. kimi-k3 weights are not published as of launch day, so the flagship cannot be self-hosted yet.
The fastest endpoints are private deployments
Morph's top speeds come from dedicated deployments, not shared public endpoints: speculators trained on your traffic, caching tuned to your workload, and volume discounts over public per-token rates. Over 100 billion tokens per day run this way.
Running open models at scale?
Morph serves GLM-5.2, MiniMax M3, Qwen 3.5, and DeepSeek V4 Flash on custom codegen kernels with speculators trained on coding traffic. One OpenAI-compatible API, priced per token, with private single-tenant deployments for data-residency needs.
Sources
- Moonshot AI platform: Recharge and rate limiting (Tier 0-5 by cumulative top-up, concurrency/RPM/TPM/TPD, request-tokens + max_completion_tokens counting, user-level limits)
- Moonshot AI platform: Model list (kimi-k3 flagship; kimi-k2.6 / kimi-k2.7-code / kimi-k2.5 at 256K; kimi-latest and kimi-k2 series discontinuation dates)
- Moonshot AI platform: Use Kimi in Claude Code (Anthropic-compatible endpoint /anthropic, ANTHROPIC_BASE_URL/API_KEY, CLAUDE_CODE_AUTO_COMPACT_WINDOW, /status verification)
- OpenRouter: moonshotai/kimi-k3 ($3/$15 list, 1M context, one upstream provider at launch, caching-blended effective cost)
- BenchLM: Kimi API pricing (K2.6 / K2.7 Code $0.95/$4.00, K2.7 Code $0.19/M cache, K2.5 $0.60/$3.00, flat per-token billing)
- Moonshot forum + platform FAQ: 429 troubleshooting (429 causes: overload / insufficient funds / concurrency / RPM / TPM / TPD; OpenAI-SDK auto-retry exhausting Tier 0 RPM)
- Simon Willison: Kimi K3 (independent launch-day coverage of kimi-k3 pricing and behavior)