Kimi (Moonshot AI) Commands & Prompt Reference

40 commands & parameters · 5 categories · Sources: Kimi API Platform docs — Chat Completions API (POST /v1/chat/completions) and its OpenAPI schema and 6 more · Checked

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 / SyntaxWhat it doesNotes
kimi-k3Flagship model IDOn 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-codeCoding model IDHas 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-highspeedHigh-speed coding model IDSame model and parameter limits as kimi-k2.7-code; only the output rate differs, roughly 180 tokens per second.
kimi-k2.6Previous general model IDText, image and video input with a 256K context; the only current model whose thinking can be turned off.
https://api.moonshot.ai/v1OpenAI-compatible base URLPoint an OpenAI SDK here with a Kimi key; the same base serves /chat/completions and /responses.
https://api.moonshot.ai/anthropicAnthropic-compatible base URLFor Anthropic SDKs and Claude Code; the parameters of that /messages format are not covered on this page.
Authorization: Bearer $MOONSHOT_API_KEYAPI key headerKeys are created in the Kimi Open Platform console; keep them in an environment variable, never in client-side code.

Chat completion parameters (18)

Command / SyntaxWhat it doesNotes
modelModel to callAlso decides which fields are accepted: reasoning_effort on kimi-k3, the thinking object on the K2.x models.
messagesConversation so farThe API keeps no history, so each request resends earlier turns, with assistant replies passed back unchanged.
max_completion_tokensOutput token capKimi K3 defaults to 131072 and allows up to 1048576; input plus this cap must fit in the context window.
max_tokensDeprecated output capReplaced by max_completion_tokens; thinking spends the budget first, so a small cap can end a reply mid-reasoning.
response_formatOutput format switchPlain text unless set; json_object turns on JSON Mode and json_schema turns on Structured Output.
{"type": "json_object"}JSON ModeValid 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 OutputNeeds json_schema.name and json_schema.schema in MFJS form; strict defaults to true and is best set explicitly.
stopStop sequencesUp to five strings of 32 bytes or less; the matching text itself is dropped from the reply.
streamStreaming switchOff by default; when true, text arrives piece by piece as server-sent events instead of in one final body.
stream_optionsStreaming optionsSet include_usage to get a last chunk with token totals, the only place a stream reports cache reads and writes.
toolsFunction toolsEach function needs a name and JSON Schema parameters in the MFJS dialect; strict argument checking is on by default.
tool_choiceTool call controlDefault auto; none blocks calls, an object picks one function, and required works only on kimi-k3, as both K2 models reject it.
logprobsToken log probabilitiesOff by default; when true, the reply message carries per-token probabilities in its logprobs field.
top_logprobsAlternatives per tokenAn integer from 0 to 20 giving the likeliest candidates at each position; logprobs must be true as well.
predictionPredicted OutputSend the expected text as content so a reply that mostly matches it, such as a lightly edited file, returns faster.
prompt_cache_keySession cache keyUse one session or task ID and keep it when that session resumes; Kimi Code Plan requests must carry it.
prompt_cache_optionsCache write settingsIts ttl picks the 5m tier (default) or 1h; mode only accepts implicit, and caches cannot be cleared by hand.
safety_identifierEnd-user abuse identifierOne stable ID per end user; send a hash of the username or email address rather than the plain value.

Thinking and reasoning (4)

Command / SyntaxWhat it doesNotes
reasoning_effortKimi K3 reasoning depthlow, high or max (default max); switching levels mid-session breaks prefix-cache hits, so choose one up front.
thinking.typeK2.x thinking switchOnly kimi-k2.6 accepts disabled; with the OpenAI SDK the thinking object goes in extra_body.
thinking.keepPreserved ThinkingSet it to all on kimi-k2.6 to reuse earlier reasoning_content; kimi-k2.7-code always keeps it.
reasoning_contentReasoning output fieldArrives beside content in the reply; leave it in each assistant message you send back in later turns.

Message fields (6)

Command / SyntaxWhat it doesNotes
partial: truePartial ModeGoes on a final assistant message whose content is the prefix; the reply continues it, so prepend the prefix when displaying.
nameSpeaker nameWith Partial Mode it counts as part of the output prefix, which keeps a role-play character in voice.
{"role": "system", "tools": [...]}Dynamic tool messagekimi-k3 only; the message has no content, and its tools become callable from that point in the conversation onward.
image_urlImage content partTakes base64 data or an uploaded-file reference; content must then be an array of parts, not a string.
video_urlVideo content partTakes base64 video data or an ms:// reference to an uploaded file; content must then be an array of parts.
ms://<file_id>Uploaded file referencePoints 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 / SyntaxWhat it doesNotes
temperatureSampling temperatureLocked at 1.0, except 0.6 for kimi-k2.6 with thinking off; any other value is rejected.
top_pNucleus samplingFixed at 0.95 on all current models; sending any other value makes the request fail.
nNumber of choicesFixed to a single completion per request; a larger value comes back as an error.
presence_penaltyPresence penaltyHeld at 0 on every current Kimi model; omit it from requests instead of setting it.
frequency_penaltyFrequency penaltyAlso 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

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