Back to blog

Kimi K3 API Guide: Pricing, Reasoning, and Setup

How to use the Kimi K3 API in practice: endpoints, pricing ($3/$0.30/$15 per million tokens), the reasoning_effort parameter, tool calls, JSON output, the 1M-token context — and how to route it through one OpenAI-compatible endpoint with automatic failover.

Kimi K3 API concept — a glowing API socket connecting to a large model chip on a circuit board

Kimi K3 is the open-weight frontier model of the moment — 2.8T parameters, a 1M-token context, and benchmark scores next to Claude Opus at a fraction of the price. This guide covers the Kimi K3 API in practice: what it costs, the parameters that actually matter (one of them is unusual), and working examples you can paste.

The examples use LLM Gateway, which serves Kimi K3 from multiple providers behind one OpenAI-compatible endpoint — so a provider outage or rate limit fails over automatically instead of failing your request. Everything shown also applies if you call a single provider directly; you just lose the failover.

Kimi K3 API pricing

Tokens Price per million
Input $3.00
Cached input $0.30
Output $15.00

Three practical notes:

  • The cached-input rate is the headline. Moonshot reports cache-hit rates above 90% in coding workloads, where each turn resends a growing shared prefix. At $0.30 per million, a cache-heavy agent session runs close to an order of magnitude cheaper on input than the sticker price suggests.
  • The context window is 1,048,576 tokens, and output can be configured up to the same ceiling — long-document and long-agent-trace work that usually forces model juggling fits in one call.
  • Filling the window costs real money. A full 1M-token uncached prompt is ~$3. The cache rate is what makes long contexts economical across turns, which makes provider stickiness matter (below).

Basic setup

Point any OpenAI SDK at the gateway:

1import OpenAI from "openai";2
3const client = new OpenAI({4  baseURL: "https://api.llmgateway.io/v1",5  apiKey: process.env.LLM_GATEWAY_API_KEY,6});7
8const response = await client.chat.completions.create({9  model: "kimi-k3",10  stream: true,11  messages: [12    { role: "user", content: "Refactor this function to be iterative." },13  ],14});

model: "kimi-k3" routes to the best available provider on live uptime, latency, and price. Pin a specific deployment with the provider/model form — moonshot/kimi-k3 for Moonshot's native API — when you need one provider's exact behavior. The Kimi K3 model page lists every current provider with per-provider capabilities and uptime.

Reasoning: K3 always thinks

The unusual parameter first: Kimi K3 has no thinking toggle. The K2-era thinking switch is gone — K3 always reasons, and you control how much via the top-level reasoning_effort field. Moonshot's native deployment accepts low, high, and max, and defaults to max.

1curl https://api.llmgateway.io/v1/chat/completions \2  -H "Authorization: Bearer $LLM_GATEWAY_API_KEY" \3  -H "Content-Type: application/json" \4  -d '{5    "model": "moonshot/kimi-k3",6    "reasoning_effort": "low",7    "messages": [{"role": "user", "content": "Is 9931 prime?"}]8  }'

Two consequences worth planning for:

  • Reasoning tokens bill as output at $15/M. For high-volume, low-difficulty calls, set reasoning_effort: "low" — the default max spends real money thinking about trivial prompts.
  • Effort support varies by provider. Deployments differ in which effort values they honor, so pin a provider if a specific reasoning depth is load-bearing, and check the per-provider details on the model page.

Tool calls, JSON output, and vision

Kimi K3 supports the standard OpenAI-compatible surface: tools and tool_choice for function calling, response_format for JSON output, and image input.

1const response = await client.chat.completions.create({2  model: "kimi-k3",3  messages: [{ role: "user", content: "Extract the invoice fields." }],4  response_format: { type: "json_object" },5  tools: [6    {7      type: "function",8      function: {9        name: "save_invoice",10        parameters: {11          type: "object",12          properties: {13            vendor: { type: "string" },14            total: { type: "number" },15          },16          required: ["vendor", "total"],17        },18      },19    },20  ],21});

As with reasoning effort, capability details differ per deployment — some providers restrict named tool_choice or JSON mode even where the model supports it. The gateway's routing accounts for the declared capabilities of each mapping, and the model page shows them per provider.

Keep the prompt cache warm with sticky sessions

That $0.30 cached-input rate only pays off when consecutive requests hit the same provider — a multi-turn conversation that bounces between deployments rebuilds the cache each time. Attach a session id and the gateway pins the conversation to one provider:

1curl https://api.llmgateway.io/v1/chat/completions \2  -H "Authorization: Bearer $LLM_GATEWAY_API_KEY" \3  -H "Content-Type: application/json" \4  -H "x-session-id: agent-run-4f7a" \5  -d '{"model": "kimi-k3", "messages": [...]}'

For agent loops and coding sessions — exactly the workloads where Moonshot measures >90% cache hits — this is the difference between paying $3/M and $0.30/M on the prefix every turn. Details in the routing docs.

Flat-rate access on DevPass

If your Kimi K3 usage comes from coding tools rather than an application, DevPass covers it at a flat monthly rate instead of per-token billing. K3 is a premium-tier model on DevPass — every plan includes a weekly premium allowance for it, alongside the standard-tier open-weight models with no weekly cap. The Claude Code setup guide shows the five-minute configuration.

Frequently Asked Questions

How much does the Kimi K3 API cost?

$3 per million input tokens, $0.30 per million cached input tokens, and $15 per million output tokens. Reasoning tokens count as output. With the >90% cache-hit rates Moonshot reports for coding workloads, effective input cost in agent sessions lands far below the sticker price.

Can I turn off reasoning on Kimi K3?

No — K3 always reasons. You control depth with reasoning_effort (low, high, or max on Moonshot's native deployment, defaulting to max). Use low to keep reasoning-token spend down on simple calls.

Is the Kimi K3 API OpenAI-compatible?

Yes. Moonshot exposes OpenAI- and Anthropic-compatible endpoints, and through LLM Gateway you use the standard /v1/chat/completions surface with any OpenAI SDK — plus routing across every provider that serves K3, not just Moonshot.

Does Kimi K3 really have a 1M-token context?

Yes — 1,048,576 tokens, with output configurable up to the same limit. Budget for it: a fully-loaded uncached prompt costs about $3, so pair long contexts with prompt caching and sticky sessions.

Getting started