Kimi (Moonshot AI) Commands & Prompt Reference
22 commands & parameters · 2 categories · Source: Kimi API Platform Docs
Moonshot's Kimi API is OpenAI-compatible on the surface, but its parameter set has its own character: max_completion_tokens stretches into the million-token range on Kimi K3, reasoning effort is always on and tunable between low, high, and max, and prompt_cache_key exists specifically so coding agents can keep cache hits high across a resumed session. This page lists the chat completion parameters and the model and mode tokens from the official platform documentation.
Partial Mode is the feature most worth memorizing: append an assistant message with partial set to true and your prefix in content, and the model is forced to open its reply with exactly that text - the documented way to pin a format or a first line.
All Commands
Chat API Parameters (16)
| Command / Syntax | What it does | Notes |
|---|---|---|
| model | Model ID to call; kimi-k3 is the default | Set to a model ID from the Models & Modes table below. |
| messages | The conversation message list; supports dynamic tool messages | A {"role": "system", "tools": [...]} message can be inserted at any position. |
| max_completion_tokens | Maximum tokens to generate | Kimi K3 defaults to 131072 and can be set up to 1048576. Replaces the deprecated max_tokens. |
| max_tokens | Deprecated token limit field | Use max_completion_tokens instead. |
| response_format | Controls the output format; {"type": "json_object"} enables JSON mode | Default is {"type": "text"}. In JSON mode you must also guide the model to output JSON in the prompt. |
| stop | Stop words that halt generation on a full match | Up to 5 strings, each at most 32 bytes; matched words are not output. |
| stream | Return the response as a stream | Boolean, default false. |
| stream_options | Options for streaming responses | Object with child attributes for stream behavior. |
| tools | A list of tools the model may call | Standard function-tool definitions. |
| tool_choice | Controls whether and how the model calls tools | auto (default), none, required, or an object forcing a specific function. |
| logprobs | Return log probabilities of the output tokens | Boolean, default false; values arrive in the logprobs field of the response. |
| top_logprobs | Number of most likely tokens to return per position | Integer 0-20; requires logprobs: true. |
| prediction | Predicted Output configuration to speed up largely-known responses | Useful when regenerating a file with only minor changes. |
| prompt_cache_key | Cache key to raise cache hit rates across similar requests | For coding agents, typically a session or task ID; reuse it when a session resumes. |
| safety_identifier | Stable per-user identifier for abuse detection | Hash the username or email rather than sending it raw. |
| reasoning_effort | Reasoning effort level for Kimi K3 thinking | Values: low, high, max (default max). K3 always thinks with Preserved Thinking. |
Models & Mode Tokens (6)
| Command / Syntax | What it does | Notes |
|---|---|---|
| kimi-k3 | Flagship model ID with always-on thinking | Default model; set as the model field value. |
| kimi-k2.7-code | Coding-focused model ID | Set as the model field value. |
| kimi-k2.7-code-highspeed | Faster variant of the coding model | Set as the model field value. |
| kimi-k2.6 | Previous-generation general model ID | Set as the model field value. |
| kimi-k2.5 | Older general model ID | Set as the model field value. |
| partial: true | Partial Mode: force the reply to continue from a given prefix | Append a message with role: assistant, partial: true, and the prefix text in content at the end of messages. |
Recipes
Our own notes on combining the parameters and commands above. Every token used here appears in the reference tables on this page.
Force the reply to start your way
partial: true
Append a message with role assistant, partial true, and your prefix in content at the end of messages; the model continues from the prefix instead of opening however it likes.
Regenerate a file faster when little changed
prediction
Predicted Output hands the model your expected result so it can skip re-deriving the unchanged parts - the documentation's use case is regenerating a file with only minor changes.
Get cache hits across a session
prompt_cache_key
Reuse one key - typically a session or task ID - across requests, and reuse it again when a session resumes, so repeated context prices as cached input.
Pick the right K model for the job
kimi-k3 / kimi-k2.7-code + reasoning_effort
kimi-k3 is the always-thinking flagship (effort low, high, or max; default max), while kimi-k2.7-code and its highspeed variant trade generality for coding throughput.
Frequently Asked Questions
Which model ID should I default to?
kimi-k3 is the platform default and flagship, with always-on Preserved Thinking. The k2.7-code variants target coding workloads, with a highspeed option.
How do I force the reply to start with specific text?
Use Partial Mode: end the messages list with {role: assistant, partial: true, content: your-prefix}. The model continues from that prefix.
Does Kimi support JSON mode?
Yes - set response_format to {"type": "json_object"} and also instruct the model in the prompt to output JSON.
Every entry on this page is a literal, typeable token taken from the official documentation linked above. Command sets in AI tools change quickly - the in-product command menu is always authoritative for your installed version.