Kimi (Moonshot AI) Commands & Prompt Reference
Moonshot AI's Kimi Chat Completions endpoint for kimi-k3, kimi-k2.7-code and kimi-k2.6: request fields, message fields and model IDs as the Kimi API Platform docs give them, with September 2026 as the newest changelog entry. Not covered: the Responses API, the Anthropic-format Messages API, files, batch jobs and web-search tools. These models fix temperature and the other sampling values, so omit them; K3 reasons on every call, with reasoning_effort setting how much.
All Commands
Models and connection (7)
| Command / Syntax | What it does | Notes |
|---|---|---|
| kimi-k3 | Flagship model ID | On the API since July 2026 with a 1M-token context; the changelog sends users of retired models such as kimi-k2.5 to it. |
| kimi-k2.7-code | Coding model ID | Has a 256K context; thinking cannot be switched off and earlier reasoning_content is always kept, so send it back each turn. |
| kimi-k2.7-code-highspeed | High-speed coding model ID | Same model and parameter limits as kimi-k2.7-code; only the output rate differs, roughly 180 tokens per second. |
| kimi-k2.6 | Previous general model ID | Text, image and video input with a 256K context; the only current model whose thinking can be turned off. |
| https://api.moonshot.ai/v1 | OpenAI-compatible base URL | Point an OpenAI SDK here with a Kimi key; the same base serves /chat/completions and /responses. |
| https://api.moonshot.ai/anthropic | Anthropic-compatible base URL | For Anthropic SDKs and Claude Code; the parameters of that /messages format are not covered on this page. |
| Authorization: Bearer $MOONSHOT_API_KEY | API key header | Keys are created in the Kimi Open Platform console; keep them in an environment variable, never in client-side code. |
Chat completion parameters (18)
| Command / Syntax | What it does | Notes |
|---|---|---|
| model | Model to call | Also decides which fields are accepted: reasoning_effort on kimi-k3, the thinking object on the K2.x models. |
| messages | Conversation so far | The API keeps no history, so each request resends earlier turns, with assistant replies passed back unchanged. |
| max_completion_tokens | Output token cap | Kimi K3 defaults to 131072 and allows up to 1048576; input plus this cap must fit in the context window. |
| max_tokens | Deprecated output cap | Replaced by max_completion_tokens; thinking spends the budget first, so a small cap can end a reply mid-reasoning. |
| response_format | Output format switch | Plain text unless set; json_object turns on JSON Mode and json_schema turns on Structured Output. |
| {"type": "json_object"} | JSON Mode | Valid JSON is guaranteed but its fields are not, so name them in the prompt; do not mix it with Partial Mode. |
| {"type": "json_schema", "json_schema": {...}} | Structured Output | Needs json_schema.name and json_schema.schema in MFJS form; strict defaults to true and is best set explicitly. |
| stop | Stop sequences | Up to five strings of 32 bytes or less; the matching text itself is dropped from the reply. |
| stream | Streaming switch | Off by default; when true, text arrives piece by piece as server-sent events instead of in one final body. |
| stream_options | Streaming options | Set include_usage to get a last chunk with token totals, the only place a stream reports cache reads and writes. |
| tools | Function tools | Each function needs a name and JSON Schema parameters in the MFJS dialect; strict argument checking is on by default. |
| tool_choice | Tool call control | Default auto; none blocks calls, an object picks one function, and required works only on kimi-k3, as both K2 models reject it. |
| logprobs | Token log probabilities | Off by default; when true, the reply message carries per-token probabilities in its logprobs field. |
| top_logprobs | Alternatives per token | An integer from 0 to 20 giving the likeliest candidates at each position; logprobs must be true as well. |
| prediction | Predicted Output | Send the expected text as content so a reply that mostly matches it, such as a lightly edited file, returns faster. |
| prompt_cache_key | Session cache key | Use one session or task ID and keep it when that session resumes; Kimi Code Plan requests must carry it. |
| prompt_cache_options | Cache write settings | Its ttl picks the 5m tier (default) or 1h; mode only accepts implicit, and caches cannot be cleared by hand. |
| safety_identifier | End-user abuse identifier | One stable ID per end user; send a hash of the username or email address rather than the plain value. |
Thinking and reasoning (4)
| Command / Syntax | What it does | Notes |
|---|---|---|
| reasoning_effort | Kimi K3 reasoning depth | low, high or max (default max); switching levels mid-session breaks prefix-cache hits, so choose one up front. |
| thinking.type | K2.x thinking switch | Only kimi-k2.6 accepts disabled; with the OpenAI SDK the thinking object goes in extra_body. |
| thinking.keep | Preserved Thinking | Set it to all on kimi-k2.6 to reuse earlier reasoning_content; kimi-k2.7-code always keeps it. |
| reasoning_content | Reasoning output field | Arrives beside content in the reply; leave it in each assistant message you send back in later turns. |
Message fields (6)
| Command / Syntax | What it does | Notes |
|---|---|---|
| partial: true | Partial Mode | Goes on a final assistant message whose content is the prefix; the reply continues it, so prepend the prefix when displaying. |
| name | Speaker name | With Partial Mode it counts as part of the output prefix, which keeps a role-play character in voice. |
| {"role": "system", "tools": [...]} | Dynamic tool message | kimi-k3 only; the message has no content, and its tools become callable from that point in the conversation onward. |
| image_url | Image content part | Takes base64 data or an uploaded-file reference; content must then be an array of parts, not a string. |
| video_url | Video content part | Takes base64 video data or an ms:// reference to an uploaded file; content must then be an array of parts. |
| ms://<file_id> | Uploaded file reference | Points an image or video part at a file from the Files API; Kimi K3 vision does not accept public image URLs. |
Fixed sampling parameters (5)
| Command / Syntax | What it does | Notes |
|---|---|---|
| temperature | Sampling temperature | Locked at 1.0, except 0.6 for kimi-k2.6 with thinking off; any other value is rejected. |
| top_p | Nucleus sampling | Fixed at 0.95 on all current models; sending any other value makes the request fail. |
| n | Number of choices | Fixed to a single completion per request; a larger value comes back as an error. |
| presence_penalty | Presence penalty | Held at 0 on every current Kimi model; omit it from requests instead of setting it. |
| frequency_penalty | Frequency penalty | Also locked at 0; requests copied from OpenAI code must drop any other value or they fail. |
Recipes
Kimi request patterns put together from the fields above: prefilling a reply, holding cache hits, moving from K2.6 to K3, and schema-checked JSON.
Make the reply open with your own text
partial: true
Put the opening you want in a final assistant message flagged with partial, and Kimi writes the rest. The same trick resumes a reply cut off with finish_reason length: return the text so far as that partial message, plus its reasoning_content while thinking is on.
Keep cache hits across a long session
prompt_cache_key → prompt_cache_options
Reuse one key per session or task and keep reasoning_effort unchanged, since switching levels breaks prefix-cache hits. Choose the 1h TTL when calls come more than five minutes apart but within the hour.
Move a K2.6 integration to K3
kimi-k3 → reasoning_effort
Change the model, drop the thinking object and any temperature or top_p values, and set reasoning_effort only when the default max is slower than the task needs. Keep returning each assistant message unchanged, reasoning_content included.
Get JSON that matches a schema
response_format → {"type": "json_schema"}
Structured Output enforces field names and types; json_object only promises valid JSON and needs the fields spelled out in the prompt. Do not combine json_object with Partial Mode: to steer a JSON reply that way, prefill an opening brace with partial instead.
Frequently Asked Questions
Why does my request fail when I set temperature or top_p?
On kimi-k3, kimi-k2.7-code and kimi-k2.6 the sampling values are fixed: temperature, top_p, n, presence_penalty and frequency_penalty accept only their preset value, and anything else returns an error. Leave them out of the request.
How do I turn thinking off?
Only kimi-k2.6 allows it: send thinking.type as disabled (through extra_body in the OpenAI SDK). kimi-k3 always thinks and is tuned with reasoning_effort low, high or max instead, and kimi-k2.7-code returns an error for disabled.
How do I force the reply to start with specific text?
Use Partial Mode. The last entry in messages is an assistant message whose content is the prefix, with partial: true set; generation picks up from that prefix, and a name on the same message keeps a role-play speaker fixed.
Does Kimi support JSON output?
Yes. {"type": "json_object"} in response_format returns valid JSON but needs the fields described in the prompt; {"type": "json_schema", "json_schema": {...}} (Structured Output) enforces a schema and is the vendor's recommended option.
What happened to kimi-k2.5 and the moonshot-v1 models?
Both were retired on August 31, 2026; calls to them now return a 404 model-not-found error. The model list points to kimi-k3 as the replacement.
Sources and checks
- Kimi API Platform docs — Chat Completions API (POST /v1/chat/completions) and its OpenAPI schema Request parameters, message fields, Partial Mode, thinking fields, JSON output
- Kimi API Platform docs — Model List (kimi-k3, kimi-k2.7-code, kimi-k2.6; deprecated models) Current model IDs; retirement of kimi-k2.5 and moonshot-v1
- Kimi API Platform docs — Model Parameter Reference Per-model differences: fixed sampling values, tool_choice, thinking vs reasoning_effort
- Kimi API Platform docs — Use Kimi API's Partial Mode The name field in Partial Mode
- Kimi API Platform docs — Reasoning Effort (Kimi K3) reasoning_effort values
- Kimi API Platform docs — Platform Changelog (latest entry: September 2026) Date of the docs checked; model launches and retirements
- Kimi API Platform docs — API Overview Base URLs and authentication header
Every row on this page was matched to a line in the documentation above on . A command or parameter that could not be found there is not listed.
1 row from the earlier version of this page was removed in that check: duplicates, and entries the documentation does not list or lists differently.
AI tools change their commands, parameters and model names between releases: the vendor's current documentation and the version you run have the last word. Found a wrong or missing entry? Tell us and it gets checked against the source. How we verify describes the process and its limits.
Related prompt references
DeepSeek (46) · GLM (Z.ai) (58) · MiniMax (Hailuo) (72) · All AI prompt references