api.foo
api.foo / Docs / Kimi API pricing and API key

Kimi API (November 2026): Kimi K3.1 Pro and K3 Pricing, How to Get an API Key, Rate Limits and Code Examples

Updated · Tested on: macOS · curl (request formats and error messages) · By the api.foo docs team (how we test)
On this page

Short answer: as of November 23, 2026, the newest Kimi model is Kimi K3.1 Pro (kimi-k3.1-pro), which costs $2 input / $0.20 cached / $10 output per million tokens with a 1M-token context window. That's a third cheaper than Kimi K3 at $3 / $0.30 / $15. A faster K3.1 Pro Highspeed costs $4 / $20. The older K2.7 Code and K2.6 ($0.95 / $4) are closed to new accounts and due to be retired at the end of December 2026. The API runs at https://api.moonshot.ai/v1 (OpenAI-compatible) and https://api.moonshot.ai/anthropic (Anthropic-compatible). You get a key at platform.kimi.ai after recharging at least $1, and your rate limits grow with how much you've recharged in total.

Prices and limits below are from Kimi's international API documentation at platform.kimi.ai, checked November 23, 2026. We checked the request formats and error messages with test keys.

Kimi API pricing

Models and prices

K3 series, per million tokens, in USD. All three have a 1,048,576-token context window:

Model Input Cached input Output Cache write (5 min) Cache write (1 hour)
kimi-k3.1-pro $2.00 $0.20 $10.00 $2.00 $4.00
kimi-k3.1-pro-highspeed $4.00 $0.20 $20.00 $4.00 $8.00
kimi-k3 $3.00 $0.30 $15.00 $3.00 $6.00
  • Kimi K3.1 Pro is Kimi's current flagship and the model Kimi suggests starting with. Kimi describes it as a post-trained version of K3, with native image and video understanding and better results than K3 on coding, 3D creation and financial research.
  • K3.1 Pro Highspeed has the same capabilities at about 2–3x the speed, for twice the price. Its cached input costs the same $0.20 as the standard version.
  • Kimi K3 is now the previous-generation flagship: 2.8 trillion parameters, native image understanding and a 1M-token context window. It still works, but costs more than K3.1 Pro.

K2 series, closing (262,144-token context window):

Model Input Cached input Output
kimi-k2.7-code $0.95 $0.19 $4.00
kimi-k2.7-code-highspeed $1.90 $0.38 $8.00
kimi-k2.6 $0.95 $0.16 $4.00

Since October 31, 2026, the K2 models are no longer available to newly registered accounts. Existing accounts keep access for now, but Kimi plans to retire the whole K2 series at the end of December 2026, so plan your move to K3.1 Pro now. See Retired and closing models.

Caching: automatic, with a write charge on the K3 series

The Kimi API caches repeated request prefixes automatically, with a default lifetime of 5 minutes. On the K3 series you pay to write to the cache (the two write columns above, depending on whether you choose a 5-minute or 1-hour lifetime) and pay the cached-input price when a later request hits it. Each hit refreshes the entry's lifetime with no extra write charge. On K3.1 Pro, a cache hit costs a tenth of normal input. The K2 models show only a cache-hit price.

K3.1 Pro and K3 always think, at maximum effort by default

Both K3.1 Pro and K3 always run in thinking mode, and reasoning_effort defaults to max. That gives the best answers but also the most output tokens, billed as output. For simpler requests, set reasoning_effort to high or low:

resp = client.chat.completions.create(
    model="kimi-k3.1-pro",
    messages=[{"role": "user", "content": "Summarize this paragraph: ..."}],
    reasoning_effort="low",
)

For multi-turn conversations and tool calls, Kimi asks you to send back the complete assistant message from the previous response, not just its content.

Other charges

  • Batch API: 60% of the standard price, for jobs that don't need an immediate answer. For example, kimi-k3.1-pro drops to $1.20 input and $6.00 output.
  • Web search tools, billed only when results come back: Basic $0.002 per call, Pro $0.003 per call, URL fetch $0.002 per call. The web_search tool in the Responses API costs $0.005 per search it actually runs.

Kimi vs Claude, GPT and DeepSeek

Model Input Output
Kimi K3.1 Pro $2.00 $10.00
Kimi K3 $3.00 $15.00
Claude Sonnet 5.5 $2.00 $10.00
Claude Opus 5.5 $4.00 $20.00
OpenAI GPT-6.1 Sol $2.00 $10.00
DeepSeek V4 Pro (peak / off-peak) $1.32 / $0.66 $3.96 / $1.98

At list prices Kimi K3.1 Pro costs the same as Claude Sonnet 5.5 and GPT-6.1 Sol, and K3 costs more than both but less than Claude Opus 5.5. With the K2 models closing, DeepSeek V4 Pro is the cheaper option on this list. Claude and OpenAI prices are from our Claude and OpenAI pricing pages (October 15–17, 2026), and DeepSeek's from our DeepSeek API pricing page.

How to get a Kimi API key

  1. Sign up on the international Kimi API Platform.
  2. Recharge at least $1. Kimi requires it before you can use the API, to prevent abuse, and K3.1 Pro and K3 are unlocked only after a successful top-up. When your total recharge reaches $5, you get a $5 voucher. Vouchers don't count toward your recharge total.
  3. Create an API key in the console.
  4. Store it in an environment variable, for example export MOONSHOT_API_KEY="sk-...".

There's no ongoing free tier. Free Kimi API offers on third-party sites are those sites' own promotions, not Kimi's.

International or China platform?

International China
Console platform.kimi.ai (platform.moonshot.ai redirects here) platform.kimi.com
API base https://api.moonshot.ai https://api.moonshot.cn
Billing USD CNY

They're separate platforms with their own consoles. Use the base URL of the platform where you created your key. The China platform has the same models at its own CNY prices. For example, kimi-k3.1-pro costs ¥13 input and ¥68 output per million tokens there, and kimi-k3 costs ¥20 and ¥100.

Rate limits depend on how much you've recharged

Kimi sets limits by cumulative recharge amount, per account:

Tier Total recharged Concurrent requests RPM TPM TPD Web search QPS
Tier 0 $1 1 3 500,000 1,500,000 1
Tier 1 $10 15 100 2,000,000 Unlimited 3
Tier 2 $20 40 100 3,000,000 Unlimited 5
Tier 3 $100 50 200 3,000,000 Unlimited 10
Tier 4 $1,000 60 200 4,000,000 Unlimited 20
Tier 5 $3,000 100 300 5,000,000 Unlimited 50

Tier 0 is very tight: one request at a time and three a minute. If you recharge only $1 to try it and then point a coding agent at it, you'll hit 429 errors almost immediately. Recharging to $10 in total moves you to Tier 1. Web search QPS is a separate quota for the search endpoints and doesn't use up your RPM or TPM.

Base URLs and formats

Format Base URL Endpoint Works with
OpenAI Chat Completions https://api.moonshot.ai/v1 /chat/completions OpenAI SDKs, LangChain, Dify and most tools
OpenAI Responses https://api.moonshot.ai/v1 /responses OpenAI SDKs, Codex
Anthropic Messages https://api.moonshot.ai/anthropic /v1/messages Anthropic SDKs, Claude Code

Kimi says that if your code already uses the OpenAI or Anthropic API, changing the base URL and API key is all you need.

Code examples

curl

curl https://api.moonshot.ai/v1/chat/completions \
  -H "Authorization: Bearer $MOONSHOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "kimi-k3.1-pro", "messages": [{"role": "user", "content": "Explain what an API rate limit is in one sentence."}]}'

Python with the OpenAI SDK

import os
from openai import OpenAI

client = OpenAI(api_key=os.environ["MOONSHOT_API_KEY"], base_url="https://api.moonshot.ai/v1")

resp = client.chat.completions.create(
    model="kimi-k3.1-pro",
    messages=[{"role": "user", "content": "Explain what an API rate limit is in one sentence."}],
)
print(resp.choices[0].message.content)

Swap in kimi-k3.1-pro-highspeed when you need faster output, or kimi-k3 if you're staying on the previous model.

Claude Code

Kimi's guide uses ~/.claude/settings.json and now sets every tier to K3:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.moonshot.ai/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_MOONSHOT_API_KEY",
    "ANTHROPIC_MODEL": "kimi-k3[1m]",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-k3[1m]",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-k3[1m]",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-k3[1m]",
    "ANTHROPIC_DEFAULT_FABLE_MODEL": "kimi-k3[1m]",
    "CLAUDE_CODE_SUBAGENT_MODEL": "kimi-k3[1m]",
    "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000",
    "CLAUDE_CODE_EFFORT_LEVEL": "max"
  }
}

The [1m] suffix tells Claude Code to use the 1M-token context window, and Claude Code strips it before sending the request. Kimi warns that leaving any of the model variables unset makes the matching tasks (background work, sub-agents) fail silently, so set all of them. The guide's own test request on this endpoint uses kimi-k3.1-pro. For how Claude Code handles third-party endpoints in general, see How to install Claude Code.

Codex

Kimi's Codex guide now uses K3.1 Pro. In ~/.codex/config.toml, with your key in the KIMI_API_KEY environment variable:

model = "kimi-k3.1-pro"
model_provider = "kimi"
model_context_window = 1048576

[model_providers.kimi]
name = "Kimi"
base_url = "https://api.moonshot.ai/v1"
env_key = "KIMI_API_KEY"
wire_api = "responses"

Keep model, model_provider and model_context_window above the [model_providers.kimi] table, or Codex silently ignores them. model_context_window tells Codex about the 1M context window, since kimi-k3.1-pro isn't in its built-in model list (Codex warns about missing model metadata, which Kimi says you can ignore). See How to install Codex CLI and set up config.toml.

Errors

From Kimi's error reference. On November 23, 2026 we confirmed the first two against both the international (api.moonshot.ai) and China (api.moonshot.cn) endpoints, with a fake key and with no key. Both return the same error format.

Status Type Message What to do
401 invalid_authentication_error Invalid Authentication The key is wrong or malformed. Check the base URL matches the platform you created it on
401 incorrect_api_key_error Incorrect API key provided No key was sent, or it's incorrect
400 invalid_request_error Input token length too long Shorten the input or use the K3 series' 1M context
403 permission_denied_error Your IP is not allowed to access this organization Your organization has an IP allowlist; ask an admin
404 resource_not_found_error Model not found, or this account does not have permission to access the model Check the model name. Retired names such as kimi-k2.5 no longer work, and new accounts can't use the K2 models
429 rate_limit_reached_error Organization-level RPM limit reached (or concurrency, TPM, TPD) Wait and retry, or recharge to a higher tier
429 engine_overloaded_error The engine is currently overloaded, please try again later Back off and retry after Retry-After
429 exceeded_current_quota_error Account balance is insufficient or the account has been disabled Recharge

Retired and closing models

If old code stops working, check the model name:

  • Closing: kimi-k2.7-code, kimi-k2.7-code-highspeed and kimi-k2.6 are no longer available to accounts registered since October 31, 2026, and Kimi plans to retire them at the end of December 2026.
  • Retired: kimi-k2.5 and the whole moonshot-v1 series on August 31, 2026; the kimi-k2 series (including kimi-k2-turbo-preview and kimi-k2-thinking) on May 25, 2026; kimi-latest on January 28, 2026.

Kimi's model list now names kimi-k3.1-pro as its flagship, so that's the natural replacement for any of them.

Using Kimi through a multi-model gateway

If you call Kimi alongside Claude, GPT or Gemini, a gateway gives you one account and one bill. api.foo, the service that publishes these docs, serves kimi-k3.1-pro and kimi-k3 at its OpenAI-compatible endpoint, https://api.foo/v1. We confirmed the path with a test key. Prices are on the api.foo pricing page. If you only use Kimi, the official API gives you the Batch discount and Kimi's own web search tools.

Sources

Kimi API Platform documentation (platform.kimi.ai), checked November 23, 2026: Model list, Model inference pricing, Batch pricing, Web search pricing, Recharge and rate limiting, API overview, Errors, Kimi K3.1 Pro quickstart, Kimi K3 quickstart, Claude Code and Codex guides; China platform model pricing and API overview.

FAQ

How much does the Kimi API cost?

As of November 23, 2026, Kimi K3.1 Pro, the newest flagship, costs $2 per million input tokens, $0.20 per million cached input tokens and $10 per million output tokens. Kimi K3 costs $3, $0.30 and $15. Both have a 1M-token context window, and the Batch API costs 60% of the standard price. The older K2.7 Code and K2.6 cost $0.95 input and $4 output, but new accounts can no longer use them.

Is Kimi K3.1 Pro cheaper than Kimi K3?

Yes. K3.1 Pro costs $2 input and $10 output per million tokens, a third less than K3 at $3 and $15. Kimi describes it as a post-trained version of K3 and recommends it as the starting model. The faster kimi-k3.1-pro-highspeed costs $4 and $20.

How do I get a Kimi API key?

Sign up on the international Kimi API Platform at platform.kimi.ai, recharge at least $1, then create a key in the console. Use it with the base URL https://api.moonshot.ai/v1 for the OpenAI format or https://api.moonshot.ai/anthropic for the Anthropic format.

Is the Kimi API free?

No. You must recharge at least $1 before you can call it, and K3.1 Pro and K3 are unlocked only after a successful top-up. Kimi gives a $5 voucher once your cumulative recharge reaches $5, but there is no ongoing free tier, and vouchers don't count toward your recharge total.

Can I still use Kimi K2.5, K2.6 or K2.7 Code?

Kimi K2.5 was retired on August 31, 2026. K2.6, K2.7 Code and K2.7 Code Highspeed are no longer available to accounts registered since October 31, 2026, and Kimi plans to retire the whole K2 series at the end of December 2026. Kimi points users to K3.1 Pro.

Why am I getting 429 errors right after signing up for the Kimi API?

Kimi's limits depend on how much you've recharged in total. With only $1, your account is on Tier 0, which allows 1 concurrent request and 3 requests per minute. Recharging to $10 in total moves you to Tier 1, with 15 concurrent requests and 100 requests per minute.

Can I use Kimi with Claude Code or Codex?

Yes. The Kimi API speaks the Anthropic Messages format at https://api.moonshot.ai/anthropic, which Claude Code can use, and the OpenAI Responses format at https://api.moonshot.ai/v1, which Codex needs. Kimi's Codex guide now uses kimi-k3.1-pro, and its Claude Code guide uses kimi-k3.

Is Kimi K3.1 Pro cheaper than Claude or GPT?

At list price it costs the same as Claude Sonnet 5.5 and GPT-6.1 Sol, $2 input and $10 output per million tokens. Kimi K3 costs more than both, at $3 and $15, and less than Claude Opus 5.5.

What's the difference between platform.kimi.ai and platform.kimi.com?

platform.kimi.ai is the international platform, billed in USD, with the API at api.moonshot.ai (platform.moonshot.ai redirects there). platform.kimi.com is the China platform, billed in CNY, with the API at api.moonshot.cn. They're separate platforms with their own consoles, so use the base URL of the platform where you created your key.

Found a mistake? Email support@api.foo.