Kimi K3.1 Pro · prompting-guide
Kimi K3.1 Pro's Partial Mode requires appending a message with role="assistant" and partial=True to the end of the message list, with the text to preserve placed in content; the API response does not include this prefix, so the client must concatenate it manually.
Kimi K3.1 Pro's Partial Mode requires appending a message with role="assistant" and partial=True to the end of the message list, with the text to preserve placed in content; the API response does not include this prefix, so the client must concatenate it manually.
Suitable tasks: Fixed reply openings, continuing generation from an already output prefix, continuing content truncated by finish_reason="length", and maintaining a consistent role voice.
Unsuitable tasks: Treating Partial Mode as a general-purpose JSON validator, or forcibly concatenating structured output without confirming that the prefix is valid.
Applicable model version: The examples on this page use kimi-k3.1-pro by default; other models (such as kimi-k3.1-pro-highspeed) require replacing model and rechecking the parameters.
Applicable client, agent, or API: Kimi API Chat Completions and OpenAI-compatible clients that can retain the original assistant fields.
Recommended reasoning level and parameters: K3.1 Pro uses the top-level reasoning_effort, which accepts low, high, and max and defaults to max; when continuing, also retain the previous round's reasoning_content.
The Python example below is retained from the original. partial=True must be in the last assistant message in the message list:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["MOONSHOT_API_KEY"], # Set the MOONSHOT_API_KEY environment variable before running this example
base_url = "https://api.moonshot.ai/v1",
)
completion = client.chat.completions.create(
model = "kimi-k3.1-pro",
messages = [
{"role": "system", "content": "You are Kimi, an AI assistant provided by Moonshot AI. You are proficient in Chinese and English conversations. You provide users with safe, helpful, and accurate answers. You also reject any questions involving terrorism, racism, or explicit content. Moonshot AI is a proper noun and should not be translated."},
{"role": "user", "content": "Hello?"},
{
"partial": True, # <-- The partial parameter is used to enable Partial Mode
"role": "assistant", # <-- We add a message with role=assistant after the user's question
"content": "Dear customer, hello,", # <-- The content is "fed" to the Kimi large language model, prompting it to continue from this sentence
},
]
)
# Since the Kimi large language model continues from the "fed" sentence, we need to manually concatenate the "fed" sentence with the generated response
print("Dear customer, hello," + completion.choices[0].message.content)The output handling rule can be written as a formula:
Full response = assistant_partial.content + completion.choices[0].message.contentThe API returns only the new content after the prefix; if the client displays message.content directly, the fixed opening text will be lost.
When the first request returns finish_reason == "length", take the generated content as prefix and carry back the reasoning_content returned in the same round:
if completion.choices[0].finish_reason == "length":
prefix = completion.choices[0].message.content
reasoning_content = completion.choices[0].message.reasoning_content
continuation = client.chat.completions.create(
model="kimi-k3.1-pro",
messages=[
{"role": "user", "content": "Please recite the complete Chu Shi Biao."},
{
"role": "assistant",
"content": prefix,
"partial": True,
"reasoning_content": reasoning_content,
},
],
max_tokens=86400,
)
full_text = prefix + continuation.choices[0].message.contentThis continues the same output; it does not start a new request without context. The continuation request should retain the original user message and correspond to the output prefix already generated; if the prefix came from another request, do not concatenate it into the current conversation.
Confirm that the request uses model kimi-k3.1-pro and Kimi API Chat Completions.
Append an assistant message to the end of messages and set partial=True; put the text that must appear in content.
After receiving the response, concatenate it as “prefix + new content,” then pass it to the user or a downstream parser.
If finish_reason is length, check whether message.content already contains a valid prefix, then continue with Partial Mode.
When continuing in thinking mode, also send back the original response's reasoning_content; do not send back only the final content.
Set a sufficiently large max_tokens for truncated continuation so that the budget is not exhausted during the thinking stage.
When a consistent role voice is needed, add name to the partial assistant message; this field is also part of the output prefix.
If the role begins to drift in a long conversation, re-add the system role definition as described in the original method, then append a partial assistant message with name.
The official page explains that Partial Mode makes the model continue from the given text instead of replying from the beginning.
The official minimal example uses model="kimi-k3.1-pro" and appends partial=True, role="assistant", and content="Dear customer, hello," after the user message.
The official documentation explicitly requires the client to manually concatenate the prefix “fed” to the model with the content generated by the API to form the complete reply.
The official truncation example uses finish_reason == "length" as the trigger, takes message.content as prefix, and keeps partial=True in the continuation message.
The page specifically notes that thinking consumes max_tokens first; if truncation occurs during the thinking stage, content may be empty, causing continuation to start from the beginning because there is no prefix.
The page states that continuation in thinking mode must send back the previously returned reasoning_content together with the prefix, and use a larger max_tokens to ensure that generation reaches the content stage.
The official role example puts name="Kelsier" in the partial assistant message and explains that name is part of the output prefix; a system definition can be reinserted in a long conversation to reinforce the role.
The page states that the examples use the latest kimi-k3.1-pro by default; if another model is used, the model field must be replaced and the parameters adjusted.
The page's JSON-LD has dateModified set to 2026-10-23T20:06:32.132Z; because the page has no publication date field, the publication date is recorded as “Not specified.”
The page lists JSON Mode as a separate guide entry, but does not define the combination behavior of Partial Mode and JSON Mode, a valid prefix format, or any validation guarantee.
This note checked only the official documentation's code and explanations; it did not use an API Key to make a local request. The code blocks are configuration examples, not results from local testing.
partial=True is an assistant message field, not a natural-language instruction to place in the system prompt or user prompt.
reasoning_effort is a top-level field in K3.1 Pro requests; do not rewrite it as the thinking configuration used by older models, and do not treat reasoning_content as a user-visible answer.
If a small max_tokens causes truncation during the thinking stage, the returned content is empty and Partial Mode has no text to continue from; increase the budget and make the request again.
name can help fix the role identity, but cannot replace the system role definition and does not guarantee that a long conversation will never drift.
This page gives no compatibility rules for Partial Mode and JSON Mode. For JSON output, consult the JSON Mode documentation separately and verify whether the prefix can form valid JSON; do not infer from this page that the result will necessarily be parseable JSON after continuation.
The page uses only kimi-k3.1-pro as the default example; the fields, default values, and reasoning behavior of kimi-k3.1-pro-highspeed or other older models cannot be extrapolated directly.
This article contains no measured success rate, latency, token consumption, or results for different max_tokens values.
Open the official Partial Mode page, confirm that its title is Use Kimi API's Partial Mode, and verify that the default model on the page is kimi-k3.1-pro.
Compare the “Make the model continue from a given prefix” code block and check the positions of the assistant message's role, partial, and content fields.
Compare the “Complete output truncated by max_tokens” code block and check finish_reason, prefix, reasoning_content, and the second request's max_tokens.
To verify role consistency, check whether name is in the partial assistant message and observe whether the client concatenates the prefix back.
Before using a real API Key, record the request body and response fields in a test environment; this note did not submit a real request, so it has no conclusion from a local call.
Kimi API Platform official documentation · Source date: Not disclosed · Edited: 2026-10-24
Read the original sourceKimi K3.1 Pro
Run this guide in the environment listed above. Downloading does not transfer the template or establish model availability for your account.