How to Use the Kimi K3 API: Access, Code, Limits
Call Kimi K3 through Moonshot OpenAI-compatible endpoint or OpenRouter. Get a key, set the base URL, use model kimi-k3, and mind the max reasoning setting.
By Capital & Compute
The fastest way to use Kimi K3 is to point any OpenAI-compatible client at Moonshot’s endpoint, https://api.moonshot.ai/v1, authenticate with a Moonshot API key, and set the model to kimi-k3. If you already route models through OpenRouter, you can call moonshotai/kimi-k3 there instead without changing providers. Both serve the same model at Moonshot’s published rate. The one thing that trips people up is that K3 changes a few request parameters from the older Kimi K2 line, so this guide covers access, a working code sample, the parameter rules, and how to keep the bill down.
How to call the Kimi K3 API in three steps
- Get an API key. Create an account on the Kimi (Moonshot) developer platform and generate a key. Store it as an environment variable rather than hardcoding it.
- Point an OpenAI-compatible client at Moonshot. The Kimi API is OpenAI-compatible, so you can use the official OpenAI SDK and only change the base URL to
https://api.moonshot.ai/v1. - Call the model
kimi-k3. Send a normal chat-completions request. That is the whole path from zero to a response.
Here is a minimal Python example using 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",
)
completion = client.chat.completions.create(
model="kimi-k3",
reasoning_effort="max",
messages=[
{"role": "user", "content": "Summarize what Kimi K3 is in one sentence."},
],
)
print(completion.choices[0].message.content)
If you prefer raw HTTP, the same call is a POST to https://api.moonshot.ai/v1/chat/completions with an Authorization: Bearer $MOONSHOT_API_KEY header and a JSON body carrying model and messages.
The Kimi K3 API parameters that differ
K3 is not a drop-in for a Kimi K2 integration. Per Moonshot’s API documentation, a few request parameters behave differently, and getting them wrong is the most common cause of a failed call:
reasoning_effortaccepts only"max". Moonshot’s model page states K3 “always reasons and supports configuring its reasoning level with the top-levelreasoning_effortfield (currentlymaxonly).” Set it to"max"or leave it to default.- The K2-era
thinkingtoggle does not apply. Because K3 always reasons and is controlled byreasoning_effort, the separate thinking flag used on the K2 line is not the K3 mechanism. Do not port it across. - Check the sampling controls before porting a K2 request. K3 exposes a reduced, reasoning-model set of controls, so confirm which of
temperature,top_p, andnare adjustable in the Create Chat Completion reference rather than assuming K2 defaults carry over. - Mind
max_completion_tokensagainst the 1M window. The context window is 1,048,576 tokens, and long generations are available but bill per token, so raise the output cap deliberately rather than defaulting it high.
Beyond those, K3 supports the features Moonshot documents for the model: a 1-million-token context window, native vision (text and image input), tool or function calling, JSON mode, and structured outputs. The full specification and benchmarks are in the Kimi K3 breakdown.
Kimi K3 API pricing and cache savings
Kimi K3 lists at $3.00 per million input tokens and $15.00 per million output tokens, with cached input at $0.30, a 90% discount on repeated context. Because the API is OpenAI-compatible and prompt caching is automatic, the single biggest lever on your bill is how much of your context repeats. In agent and coding workloads, where a large system prompt and codebase context are resent on every turn, cache-hit rates run high, which pulls the effective input price far below the $3.00 sticker.
| Item | Value |
|---|---|
| No cache (0%) | $3.00 |
| 50% cache hits | $1.65 |
| 80% cache hits | $0.84 |
| 90% cache hits | $0.57 |
Those figures are the blended input rate only, computed from Moonshot’s own $3.00 and $0.30 numbers; output tokens still bill at $15.00 regardless of caching. That output rate is why K3 is a frontier-tier cost rather than a cheap open-weight one, and why verbose generations dominate a real bill. For the full pricing picture and comparison against other models, see the Kimi K3 pricing breakdown and the general causes of a surprising invoice in why is my AI API bill so high. You can also line K3 up against every current model in the AI models tracker.
Calling Kimi K3 through OpenRouter
If you already route requests through a gateway, you can reach the same model on OpenRouter as moonshotai/kimi-k3 (the moonshotai/kimi-latest alias resolves to K3 as well). OpenRouter exposes the full 1M-token context, image input, tool calls, structured outputs, and maximum reasoning effort at Moonshot’s $3 and $15 rates. The advantage is operational, not economic: a gateway lets you fall back to another provider or model with a config change instead of a rewrite, which matters because the cheapest near-frontier model changes often. The tradeoffs of that routing layer are covered in OpenRouter explained.
Which Kimi model should you call?
Use kimi-k3 when you want the flagship: the strongest general capability, native vision, and the best frontend-coding preference scores, and the higher token bill is acceptable. Use kimi-k2.7-code when cost per finished task is the binding constraint, since at $0.95 input and $4.00 output it runs a high-volume coding agent for roughly a quarter of K3’s token price. If you are choosing between K3 and the other cheap open-weight option from a rival lab, the Kimi K3 vs DeepSeek V4 comparison works through that trade, and the best open-weight AI models in 2026 covers the wider field. The company behind the model is profiled in who owns Moonshot AI.
Bottom line
Using the Kimi K3 API is a three-line change to an OpenAI-compatible client: swap the base URL to https://api.moonshot.ai/v1, add your Moonshot key, and set the model to kimi-k3. The only real gotchas are the parameter changes from the K2 line (max-only reasoning effort, no thinking flag, fixed sampling parameters) and the cost, where the $15 output rate and verbosity, not the input price, drive the bill. Lean on prompt caching to cut the input side, keep the integration provider-agnostic, and you can move between the hosted API and, after July 27, a self-hosted deployment without a rewrite.
Sources
- Moonshot AI (2026). Kimi API overview (OpenAI-compatible endpoint, base URL
https://api.moonshot.ai/v1, K3 parameter rules: reasoning_effort max-only, no thinking flag, fixed temperature/top_p/n, max_completion_tokens up to 1048576). Primary documentation. platform.kimi.ai - Moonshot AI (2026). Kimi K3 API pricing ($3.00 input / $15.00 output / $0.30 cached input per Mtok; model id
kimi-k3; 1M context). Primary. platform.kimi.ai - Kimi (Moonshot) developer platform (account and API key). platform.moonshot.ai
- OpenRouter (2026). Kimi K3 model page (route
moonshotai/kimi-k3; full 1M context, image input, tool calls, structured outputs at Moonshot rates). openrouter.ai
Frequently asked questions
- How do I get a Kimi K3 API key?
- Create an account on the Kimi (Moonshot) developer platform at platform.moonshot.ai and generate an API key from the console. Store it as an environment variable, for example MOONSHOT_API_KEY, rather than hardcoding it in your source.
- What is the Kimi K3 API base URL?
- The base URL is https://api.moonshot.ai/v1. Because the API is OpenAI-compatible, you can use the official OpenAI SDK and only change the base_url and API key, then call the model kimi-k3.
- Is the Kimi K3 API OpenAI-compatible?
- Yes. Kimi K3 exposes an OpenAI-compatible chat-completions API, so existing OpenAI SDK code works after you change the base URL, key, and model id. Note that K3 always reasons and accepts only reasoning_effort max, so the K2-era thinking toggle does not apply; check the chat-completion reference for the current sampling controls before porting a K2 request.
- How much does the Kimi K3 API cost?
- Kimi K3 costs $3.00 per million input tokens and $15.00 per million output tokens, with cached input at $0.30 (a 90% discount). Prompt caching can cut the effective input rate well below $3.00 on repeated context, but output tokens always bill at $15.00.
- Can I use Kimi K3 through OpenRouter?
- Yes. On OpenRouter the model is moonshotai/kimi-k3, and the kimi-latest alias also points to it. OpenRouter serves the full 1M-token context, image input, tool calls, and structured outputs at Moonshot list rates, which is useful if you want fallback routing across providers.
- Does Kimi K3 support vision and tool calls?
- Yes. Kimi K3 accepts text and image input (native vision), supports tool or function calling, and can return structured or JSON outputs, all within a 1-million-token context window.