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.
Kimi K2.6 is the only current Kimi model where thinking can be turned off.
kimi-k2.6https://api.moonshot.ai/v1max_tokens)From Moonshot's Kimi K2.6 quickstart and price page. Prices exclude tax.
MOONSHOT_API_KEY. Do not paste it into your code.pip install --upgrade "openai>=1.0". For Node, run npm install openai.Need more detail on keys and accounts? See Kimi API setup.
All three examples ask Kimi K2.6 a simple question and print the answer.
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."}
]
}'import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["MOONSHOT_API_KEY"],
base_url="https://api.moonshot.ai/v1",
)
response = client.chat.completions.create(
model="kimi-k2.6",
max_tokens=2048,
messages=[
{"role": "user", "content": "Explain what an API is in two sentences."}
],
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.MOONSHOT_API_KEY,
baseURL: "https://api.moonshot.ai/v1",
});
const response = await client.chat.completions.create({
model: "kimi-k2.6",
max_tokens: 2048,
messages: [
{ role: "user", content: "Explain what an API is in two sentences." },
],
});
console.log(response.choices[0].message.content);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.
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.
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."}
]
}'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.
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.
| Setting | Thinking on | Thinking off |
|---|---|---|
temperature | 1.0 | 0.6 |
top_p | 0.95 | 0.95 |
n | 1 | 1 |
presence_penalty | 0 | 0 |
frequency_penalty | 0 | 0 |
tool_choice | auto or none only | No 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.
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.
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.
Add one tool message for each call, with the matching tool_call_id.
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.
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.
content becomes a list of parts: the picture, then your text.video_url part. Large videos must be uploaded as files.{
"role": "user",
"content": [
{"type": "image_url",
"image_url": {"url": "data:image/png;base64,PASTE_BASE64_HERE"}},
{"type": "text", "text": "What does this chart show?"}
]
}| Per million tokens | Input | Cached input | Output |
|---|---|---|---|
| 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.
List prices before tax, from Moonshot's price pages. More: Kimi API pricing · rate limits and enterprise pricing
| Code | What it means | What to do |
|---|---|---|
| 400 | A setting is not allowed | Remove temperature, top_p, n and the penalty settings. With thinking on, use tool_choice of auto or none only |
| 400 | The request is too long | Shorten the input or lower max_tokens. Input and output together must fit in 262,144 tokens |
| 400 | Image link rejected | Image links are not supported. Send the image as base64 |
| 401 | The key is wrong or missing | Check the Authorization: Bearer header. A Kimi Code membership key will not work on this address |
| 404 | Model not found | Check the spelling: kimi-k2.6. Older names such as kimi-k2.5 are retired |
| 429 | Rate limit reached | Slow down or wait. New accounts are limited to 3 requests a minute until total top-ups reach $10 |
| 429 | Servers are busy | Wait and retry with growing pauses. Topping up does not help with this one |
| 504 | Timed out | Turn 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?