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 / SyntaxWhat it doesNotes
modelModel ID to call; kimi-k3 is the defaultSet to a model ID from the Models & Modes table below.
messagesThe conversation message list; supports dynamic tool messagesA {"role": "system", "tools": [...]} message can be inserted at any position.
max_completion_tokensMaximum tokens to generateKimi K3 defaults to 131072 and can be set up to 1048576. Replaces the deprecated max_tokens.
max_tokensDeprecated token limit fieldUse max_completion_tokens instead.
response_formatControls the output format; {"type": "json_object"} enables JSON modeDefault is {"type": "text"}. In JSON mode you must also guide the model to output JSON in the prompt.
stopStop words that halt generation on a full matchUp to 5 strings, each at most 32 bytes; matched words are not output.
streamReturn the response as a streamBoolean, default false.
stream_optionsOptions for streaming responsesObject with child attributes for stream behavior.
toolsA list of tools the model may callStandard function-tool definitions.
tool_choiceControls whether and how the model calls toolsauto (default), none, required, or an object forcing a specific function.
logprobsReturn log probabilities of the output tokensBoolean, default false; values arrive in the logprobs field of the response.
top_logprobsNumber of most likely tokens to return per positionInteger 0-20; requires logprobs: true.
predictionPredicted Output configuration to speed up largely-known responsesUseful when regenerating a file with only minor changes.
prompt_cache_keyCache key to raise cache hit rates across similar requestsFor coding agents, typically a session or task ID; reuse it when a session resumes.
safety_identifierStable per-user identifier for abuse detectionHash the username or email rather than sending it raw.
reasoning_effortReasoning effort level for Kimi K3 thinkingValues: low, high, max (default max). K3 always thinks with Preserved Thinking.

Models & Mode Tokens (6)

Command / SyntaxWhat it doesNotes
kimi-k3Flagship model ID with always-on thinkingDefault model; set as the model field value.
kimi-k2.7-codeCoding-focused model IDSet as the model field value.
kimi-k2.7-code-highspeedFaster variant of the coding modelSet as the model field value.
kimi-k2.6Previous-generation general model IDSet as the model field value.
kimi-k2.5Older general model IDSet as the model field value.
partial: truePartial Mode: force the reply to continue from a given prefixAppend 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.

Related prompt references

DeepSeek (22) · GLM (Z.ai) (23) · MiniMax (Hailuo) (24) · All AI prompt references