Try Kimi at kimi.com →

Kimi K2.6 API

This guide shows developers how to call Kimi K2.6, Moonshot AI's low-cost general model, from their own software. It covers the model name, a first request you can copy, how to switch thinking off for fast replies, the settings that cause errors, prices and fixes for common problems. Everything here follows Moonshot's own documentation.

For developersCopy-and-paste code
YOUR REQUEST "model": "kimi-k2.6", "thinking": {"type": "enabled"} "thinking": {"type": "disabled"} "messages": [ ... ] Thinking on (default) reasoning_contentthe thinking contentthe answer Thinking off contentthe answer, straight away Faster and cheaperfor simple requests One setting. You decide per request.

Kimi K2.6 is the only current Kimi model where thinking can be turned off.

We are an independent guide. We are not Moonshot AI. API keys are created only on Moonshot's platform, and we never ask for yours. The code on this page follows Moonshot's documentation, but we could not run it against the live API, so test it with a small request first.
CHEAT SHEET

The key facts

MODEL NAME
kimi-k2.6
BASE URL
https://api.moonshot.ai/v1
WORKS WITH
The OpenAI SDK. An Anthropic-style address is also offered
CONTEXT
262,144 tokens, input and output together
DEFAULT OUTPUT LIMIT
32,768 tokens (max_tokens)
THINKING
On by default. Can be switched off
INPUT
Text and images. Video too, through Moonshot's API
PRICE PER MILLION TOKENS
$0.95 in · $0.16 cached · $4.00 out

From Moonshot's Kimi K2.6 quickstart and price page. Prices exclude tax.

Step 1

Before you start

  1. Sign in to Moonshot's API platform at platform.kimi.ai and add a small balance. The minimum is $1.
  2. Create an API key in the console. Copy it straight away.
  3. Save it as an environment variable named MOONSHOT_API_KEY. Do not paste it into your code.
  4. For Python, install the OpenAI SDK: pip install --upgrade "openai>=1.0". For Node, run npm install openai.
Keep your key private. Anyone with the key can spend your balance. Never put it in a website's front-end code, a public repository or a chat message.

Need more detail on keys and accounts? See Kimi API setup.

Step 2

Your first request

All three examples ask Kimi K2.6 a simple question and print the answer.

curl
curl https://api.moonshot.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MOONSHOT_API_KEY" \
  -d '{
    "model": "kimi-k2.6",
    "max_tokens": 2048,
    "messages": [
      {"role": "user", "content": "Explain what an API is in two sentences."}
    ]
  }'

Written for this guide in the standard OpenAI format, using the address, model name and settings from Moonshot's quickstart. Notice what is missing: no temperature setting.

Step 3

Thinking on or off

Thinking is switched on unless you say otherwise. With it on, the reply has two parts: reasoning_content, the thinking, and content, the answer. With it off, you get the answer straight away and pay for fewer output tokens.

Leave it on for

  • Maths, planning and tricky code
  • Multi-step tasks with tools
  • Anything where a wrong answer is costly

Switch it off for

  • Chat replies and simple questions
  • Short rewrites, labels and summaries
  • High-volume work where speed and cost matter
curl · thinking off
curl https://api.moonshot.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MOONSHOT_API_KEY" \
  -d '{
    "model": "kimi-k2.6",
    "thinking": {"type": "disabled"},
    "messages": [
      {"role": "user", "content": "Give me three names for a bakery."}
    ]
  }'
python · thinking off
response = client.chat.completions.create(
    model="kimi-k2.6",
    messages=[
        {"role": "user", "content": "Give me three names for a bakery."}
    ],
    extra_body={"thinking": {"type": "disabled"}},
)

print(response.choices[0].message.content)

The setting and the Python extra_body method are from Moonshot's quickstart. The advice on when to use each mode is ours. The Python snippet continues from the example in Step 2.

IMPORTANT

Settings you cannot change

Moonshot fixes several settings for this model. Sending any other value returns an error, so the simplest approach is to leave them out. Note that the fixed temperature depends on the thinking mode.

SettingThinking onThinking off
temperature1.00.6
top_p0.950.95
n11
presence_penalty00
frequency_penalty00
tool_choiceauto or none onlyNo limit stated

On a small screen, swipe the table sideways to see every column.

Many libraries send a temperature by default. If yours does, look for a way to remove it.

BUILD

Tool calls

Tools let the model do real work: search, read files, run code. You describe each tool, the model asks to use one, your code runs it and sends the result back.

Keep the thinking

For multi-step tool calls, Moonshot recommends keeping the assistant message's reasoning_content in your history. Leaving it out does not cause an error but can make later steps worse.

Answer every call

Add one tool message for each call, with the matching tool_call_id.

Preserve thinking, if needed

Moonshot's model card describes an option that keeps full reasoning across turns: "thinking": {"type": "enabled", "keep": "all"}. It is off by default and meant for coding agents.

Mind the old search tool

The built-in $web_search does not work with thinking on, and Moonshot expects to retire it on 20 October 2026. Use the newer search tools instead.

For a full tool loop in Python, see the example on the Kimi K2.7 Code API page. The pattern is the same. Search pricing: Web Search API pricing.

BUILD

Images and video

  • The message content becomes a list of parts: the picture, then your text.
  • Images: PNG, JPEG, WebP or GIF, sent as base64. Image links are not supported.
  • Video: sent as base64 in a video_url part. Large videos must be uploaded as files.
  • Going above 4K for images or 1080p for video adds time without better results.
  • The whole request must stay under 100 MB.
json · a message with an image
{
  "role": "user",
  "content": [
    {"type": "image_url",
     "image_url": {"url": "data:image/png;base64,PASTE_BASE64_HERE"}},
    {"type": "text", "text": "What does this chart show?"}
  ]
}
COST

Prices and calculator

Per million tokensInputCached inputOutput
Standard$0.95$0.16$4.00
Batch$0.57$0.10$2.40

On a small screen, swipe the table sideways to see every column.

Enter a month's usage to compare the two.

Standard, a month$0
Batch, a month$0

List prices before tax, from Moonshot's price pages. More: Kimi API pricing · rate limits and enterprise pricing

FIX

Common errors

CodeWhat it meansWhat to do
400A setting is not allowedRemove temperature, top_p, n and the penalty settings. With thinking on, use tool_choice of auto or none only
400The request is too longShorten the input or lower max_tokens. Input and output together must fit in 262,144 tokens
400Image link rejectedImage links are not supported. Send the image as base64
401The key is wrong or missingCheck the Authorization: Bearer header. A Kimi Code membership key will not work on this address
404Model not foundCheck the spelling: kimi-k2.6. Older names such as kimi-k2.5 are retired
429Rate limit reachedSlow down or wait. New accounts are limited to 3 requests a minute until total top-ups reach $10
429Servers are busyWait and retry with growing pauses. Topping up does not help with this one
504Timed outTurn on streaming with "stream": true for long answers

On a small screen, swipe the table sideways to see every column.

From Moonshot's error code page and Kimi K2.6 quickstart. More help: Kimi not working?

CHECKLIST

Before you go live

0 of 6 done
Start on a low rate limit. A new account at Tier 0 allows 1 request at a time and 3 a minute. Total top-ups of $10 raise that to 15 at a time and 100 a minute.
Know when to move up. If answers fall short on hard problems or your input is longer than about 400 pages, try kimi-k3 for those requests only.
FAQ

Kimi K2.6 API questions

Use kimi-k2.6. The base URL is https://api.moonshot.ai/v1 and the API works with the OpenAI SDK.

$0.95 per million input tokens, $0.16 for cached input and $4.00 per million output tokens, before tax. Batch jobs cost $0.57, $0.10 and $2.40.

Add "thinking": {"type": "disabled"} to the request body. In the Python OpenAI SDK, pass it through extra_body. Thinking is on by default.

Moonshot fixes temperature at 1.0 with thinking on and 0.6 with thinking off. Any other value returns an error, so leave temperature out of the request.

Yes. Send images as base64 inside the message. Image links are not supported. Video input is also listed, and large videos must be uploaded as files.

Start with Kimi K2.6. It costs about a third as much and can answer without thinking. Move to Kimi K3 for very long inputs or the hardest reasoning.
NEXT

Related guides

Create your key on Moonshot's platform

API keys and billing are on Moonshot AI's own site, never on this page. We are an independent guide.