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

Kimi API (October 2026): Kimi K3 Pricing, How to Get an API Key, Rate Limits and Code Examples

Updated · Tested on: macOS · curl (request formats and error messages)
On this page

Short answer: the Kimi API from Moonshot AI runs at https://api.moonshot.ai/v1 and is OpenAI-compatible, with an Anthropic-compatible endpoint at https://api.moonshot.ai/anthropic. Kimi K3, its flagship, costs $3 input / $0.30 cached / $15 output per million tokens with a 1M-token context window. K2.7 Code and K2.6 cost $0.95 / $4. 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 on October 17, 2026. We checked the request formats and error messages with test keys.

Kimi API pricing

Models and prices

Per million tokens, in USD:

Model Input Cached input Output Context
kimi-k3 $3.00 $0.30 $15.00 1,048,576
kimi-k2.7-code $0.95 $0.19 $4.00 262,144
kimi-k2.7-code-highspeed $1.90 $0.38 $8.00 262,144
kimi-k2.6 $0.95 $0.16 $4.00 262,144
  • Kimi K3 is Kimi's most capable model, with 2.8 trillion parameters, native image understanding and a 1M-token context window, aimed at software engineering, knowledge work and deep reasoning.
  • K2.7 Code is the dedicated coding model. The highspeed version costs twice as much and outputs about 180 tokens per second, up to 260 on short contexts.
  • K2.6 takes text and images and supports both thinking and non-thinking modes.

Caching: automatic, with a write charge on K3

The Kimi API caches repeated request prefixes automatically. On K3, writing to the cache costs $3.00 per million tokens with the default 5-minute lifetime or $6.00 with a 1-hour lifetime, and reading costs $0.30. Each hit refreshes the entry's lifetime at no extra write charge. On the K2 models, the table shows a cache-hit price instead.

K3 always thinks, at maximum effort by default

Kimi K3 always runs in thinking mode, and its reasoning_effort defaults to max. That gives the best answers but also the most output tokens, billed at $15 per million. For simpler requests, set reasoning_effort to high or low:

resp = client.chat.completions.create(
    model="kimi-k3",
    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.
  • 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.

Kimi vs Claude, GPT and DeepSeek

Model Input Output
Kimi K3 $3.00 $15.00
Kimi K2.7 Code / K2.6 $0.95 $4.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 costs more than Claude Sonnet 5.5 and GPT-6.1 Sol and less than Claude Opus 5.5. K2.7 Code is the budget option, priced close to DeepSeek V4 Pro at peak. Claude and OpenAI prices are from our Claude and OpenAI pricing pages (October 15, 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. When your total recharge reaches $5, you get a $5 voucher.
  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.kimi.com
API base https://api.moonshot.ai https://api.moonshot.cn

They're separate platforms with their own consoles. Use the base URL of the platform where you created your key.

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
Tier 0 $1 1 3 500,000 1,500,000
Tier 1 $10 15 100 2,000,000 Unlimited
Tier 2 $20 40 100 3,000,000 Unlimited
Tier 3 $100 50 200 3,000,000 Unlimited
Tier 4 $1,000 60 200 4,000,000 Unlimited
Tier 5 $3,000 100 300 5,000,000 Unlimited

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.

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", "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",
    messages=[{"role": "user", "content": "Explain what an API rate limit is in one sentence."}],
)
print(resp.choices[0].message.content)

Claude Code

Kimi's guide uses ~/.claude/settings.json:

{
  "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-k2.7-code",
    "ANTHROPIC_DEFAULT_FABLE_MODEL": "kimi-k3[1m]"
  }
}

The [1m] suffix tells Claude Code to use the 1M-token context window, and Claude Code strips it before sending the request. Background tasks go to the cheaper kimi-k2.7-code. For how Claude Code handles third-party endpoints in general, see How to install Claude Code.

Codex

In ~/.codex/config.toml, with your key in the KIMI_API_KEY environment variable:

model = "kimi-k3"
model_provider = "kimi"

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

Keep model and model_provider above the [model_providers.kimi] table, or Codex silently ignores them. See How to install Codex CLI and set up config.toml.

Errors

From Kimi's error reference. We confirmed the first two against Kimi's API with a wrong key and with no key, on the China endpoint (api.moonshot.cn), which uses the same error format. Our test machine couldn't reach the international endpoint.

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 K3's 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 and moonshot-v1-* no longer work
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 model names

If old code stops working, check the model name. Kimi retired kimi-latest on January 28, 2026, the kimi-k2 series (including kimi-k2-turbo-preview and kimi-k2-thinking) on May 25, 2026, and kimi-k2.5 and the whole moonshot-v1 series on August 31, 2026. Kimi recommends moving to kimi-k3.

Using Kimi through a multi-model gateway

If you call Kimi alongside Claude, GPT or Gemini, a gateway gives you one key and one bill. api.foo, the service that publishes these docs, serves 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 October 17, 2026: Model list, Model inference pricing, Batch pricing, Web search pricing, Recharge and rate limiting, API overview, Errors, Kimi K3 quickstart, Claude Code and Codex guides; China platform API overview.

FAQ

How much does the Kimi API cost?

As of October 17, 2026, Kimi K3 costs $3 per million input tokens, $0.30 per million cached input tokens and $15 per million output tokens, with a 1M-token context window. Kimi K2.7 Code and K2.6 cost $0.95 input and $4 output. The Batch API costs 60% of the standard price.

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. Kimi gives a $5 voucher once your cumulative recharge reaches $5, but there is no ongoing free tier.

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 K3 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 publishes setup guides for both.

Is Kimi K3 cheaper than Claude or GPT?

Not at list price. Kimi K3 costs $3 input and $15 output per million tokens, more than Claude Sonnet 5.5 and GPT-6.1 Sol at $2 and $10. Kimi's cheaper options are K2.7 Code and K2.6 at $0.95 and $4.

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.kimi.com is the China platform, 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 [email protected].