Kimi K3.1 Pro API
Multimodal reasoning with a 1M-token context window, text and image understanding, and function calling. Cache writes have separate 5-minute and 1-hour rates. Reasoning tokens count toward output usage.
- Model:
kimi-k3.1-pro - Provider: Moonshot
- Type: chat
POST /v1/chat/completions
Call Kimi K3.1 Pro using the Chat Completions format, supports streaming, caching, and function tools.
Minimum text request
Required parameters: model, messages
Available parameters: model, stream, messages, max_tokens, reasoning_effort, stream_options, prompt_cache_options, tools, tool_choice
Request parameters
| Parameter | Type | Required | Description |
|---|
model | string | Yes | Required, fixed to the model name on this page. Options: kimi-k3.1-pro |
stream | boolean | No | Whether SSE event stream is returned. |
messages | array | Yes | Required, provide system/user/assistant/tool messages in chronological order. Tool results must carry the original tool_call_id; assistant tool calls and thinking content are preserved as-is. |
max_tokens | integer | No | Output budget includes thinking; a very small value may result in no visible content. |
reasoning_effort | string | No | Thinking intensity; 'low' does not indicate disabled thinking. Options: low / high / max |
stream_options | object | No | Suggest enabling streaming with include_usage. |
prompt_cache_options | object | No | Automatic cache configuration; omitted defaults to implicit, 5m. Short prefixes may have no cache read/write; cache creation cannot be disabled by omitting the parameter. |
tools | array | No | Client function tool definition; each entry is type=function, function{name,description,parameters}. |
tool_choice | string | object | No | Fill in according to the official model tool selection format for the selected protocol. |
Usage verification:
- The prompt_tokens in Chat and input_tokens in Responses already include ordinary input, cache read, and cache creation—three mutually exclusive components.
- In Messages, input_tokens counts uncached input only. Add cache_read_input_tokens and cache_creation_input_tokens for total input. The total cache creation usage is the sum of the 5m and 1h values in cache_creation.
- The usage in Chat/Responses may report only the total creation amount; TTL splitting is provided via response metadata. Messages can directly report the cache_creation breakdowns of two types. Requested TTL cannot replace actual response TTL.
- Thinking usage is included in the total output and should not be double-counted. Streaming usage is based on the final accumulated value; a zero initial value or intermediate usage=null does not imply zero consumption.
- A field returning 0 indicates it was reported as zero; absence of a field means it was not reported. In case of errors or interruptions, actual reported usage and billing records take precedence.
Official references:
- [Kimi Model Pricing Information](https://platform.kimi.ai/docs/pricing/chat)
- [Cache Parameters and Usage Guidelines](https://platform.kimi.ai/docs/guide/context-caching)
- [Official Chat Completions reference](https://platform.kimi.ai/docs/api/chat)
- [Responses Official Reference](https://platform.kimi.ai/docs/api/responses)
- [Messages Official Reference](https://platform.kimi.ai/docs/api/messages)
When calling through this site, use the request domain and path specified on this page.
Service behavior and example explanations:
- 5m and 1h determine the validity period of cache creation, but do not guarantee that a cache will be created or hit upon request emission.
- Only the actual usage reported for reading, creation, and TTL granularity is considered in this measurement; missing fields do not imply zero.
- Cache creation and regular input are mutually exclusive; output includes thinking; clients should not add cumulative frames repeatedly.
- Streaming usage can be distributed across the first and last frames: when input and cache arrive before output, retain the latest reported cumulative values per dimension. Missing fields or usage=null do not clear known values; repeated frame accumulation does not add up.
- Different interface tool definitions and return formats follow the specifications on this page; example text inputs for unexecuted function tools or image requests do not constitute operational validation of these features.
Request example
curl --request POST https://api.router.ai/v1/chat/completions \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $ROUTER_API_KEY" \
--data '{
"model": "kimi-k3.1-pro",
"messages": [
{
"role": "user",
"content": "这是虚构示例,请只回复:你好。"
}
],
"max_tokens": 256,
"reasoning_effort": "low",
"stream": false
}'
Endpoint reference: Create a chat completion (OpenAI-compatible)
POST /v1/responses
Use the Responses format to call Kimi K3.1 Pro, supporting streaming, caching, and function tools.
Minimum text request
Required parameters: model, input
Available parameters: model, stream, input, instructions, max_output_tokens, reasoning, text, prompt_cache_options, tools, tool_choice
Request parameters
| Parameter | Type | Required | Description |
|---|
model | string | Yes | Required, fixed to the model name on this page. Options: kimi-k3.1-pro |
stream | boolean | No | Whether SSE event stream is returned. |
input | string | array | Yes | Required, a text or input array; function result uses function_call_output |
instructions | string | No | System guidance text. |
max_output_tokens | integer | No | Output budget includes reasoning and main text. |
reasoning | object | No | The model always reasons. |
text | object | No | Structured output configuration, filled according to official text.format |
prompt_cache_options | object | No | Automatic cache configuration; omitted defaults to implicit, 5m. Short prefixes may have no cache read/write; cache creation cannot be disabled by omitting the parameter. |
tools | array | No | Client function tool definition; each item places type=function, name, description, parameters at the top level, without using Chat's function outer layer. |
tool_choice | string | object | No | Fill in according to the official model tool selection format for the selected protocol. |
Usage verification:
- The prompt_tokens in Chat and input_tokens in Responses already include ordinary input, cache read, and cache creation—three mutually exclusive components.
- In Messages, input_tokens counts uncached input only. Add cache_read_input_tokens and cache_creation_input_tokens for total input. The total cache creation usage is the sum of the 5m and 1h values in cache_creation.
- The usage in Chat/Responses may report only the total creation amount; TTL splitting is provided via response metadata. Messages can directly report the cache_creation breakdowns of two types. Requested TTL cannot replace actual response TTL.
- Thinking usage is included in the total output and should not be double-counted. Streaming usage is based on the final accumulated value; a zero initial value or intermediate usage=null does not imply zero consumption.
- A field returning 0 indicates it was reported as zero; absence of a field means it was not reported. In case of errors or interruptions, actual reported usage and billing records take precedence.
Official references:
- [Kimi Model Pricing Information](https://platform.kimi.ai/docs/pricing/chat)
- [Cache Parameters and Usage Guidelines](https://platform.kimi.ai/docs/guide/context-caching)
- [Official Chat Completions reference](https://platform.kimi.ai/docs/api/chat)
- [Responses Official Reference](https://platform.kimi.ai/docs/api/responses)
- [Messages Official Reference](https://platform.kimi.ai/docs/api/messages)
When calling through this site, use the request domain and path specified on this page.
Service behavior and example explanations:
- 5m and 1h determine the validity period of cache creation, but do not guarantee that a cache will be created or hit upon request emission.
- Only the actual usage reported for reading, creation, and TTL granularity is considered in this measurement; missing fields do not imply zero.
- Cache creation and regular input are mutually exclusive; output includes thinking; clients should not add cumulative frames repeatedly.
- Streaming usage can be distributed across the first and last frames: when input and cache arrive before output, retain the latest reported cumulative values per dimension. Missing fields or usage=null do not clear known values; repeated frame accumulation does not add up.
- Different interface tool definitions and return formats follow the specifications on this page; example text inputs for unexecuted function tools or image requests do not constitute operational validation of these features.
Request example
curl --request POST https://api.router.ai/v1/responses \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $ROUTER_API_KEY" \
--data '{
"model": "kimi-k3.1-pro",
"instructions": "你是虚构示例助手。",
"input": "请只回复:你好。",
"max_output_tokens": 256,
"reasoning": {
"effort": "low"
},
"stream": false
}'
POST /v1/messages
Call Kimi K3.1 Pro using Messages format, supports streaming, caching, and function tools.
Minimum text request
Required parameters: model, messages, max_tokens
Available parameters: model, stream, messages, max_tokens, system, output_config, cache_control, tools, tool_choice
Request parameters
| Parameter | Type | Required | Description |
|---|
model | string | Yes | Required, fixed to the model name on this page. Options: kimi-k3.1-pro |
stream | boolean | No | Whether SSE event stream is returned. |
messages | array | Yes | Required. user/assistant messages. Send tool results as a user tool_result block, with tool_use_id set to the original tool call ID. |
max_tokens | integer | Yes | Required, output budget includes reasoning and main text. |
system | string | array | No | System guidance, not included in messages under the system role. |
output_config | object | No | Reasoning intensity is set in the effort field of this object; does not use the Chat top-level reasoning_effort |
cache_control | object | No | Only effective at the top level; markers within content blocks do not affect this model's TTL. Omitted as 5m. |
tools | array | No | Client function tool definition; each entry contains name, description, input_schema |
tool_choice | string | object | No | Fill in according to the official model tool selection format for the selected protocol. |
Usage verification:
- The prompt_tokens in Chat and input_tokens in Responses already include ordinary input, cache read, and cache creation—three mutually exclusive components.
- In Messages, input_tokens counts uncached input only. Add cache_read_input_tokens and cache_creation_input_tokens for total input. The total cache creation usage is the sum of the 5m and 1h values in cache_creation.
- The usage in Chat/Responses may report only the total creation amount; TTL splitting is provided via response metadata. Messages can directly report the cache_creation breakdowns of two types. Requested TTL cannot replace actual response TTL.
- Thinking usage is included in the total output and should not be double-counted. Streaming usage is based on the final accumulated value; a zero initial value or intermediate usage=null does not imply zero consumption.
- A field returning 0 indicates it was reported as zero; absence of a field means it was not reported. In case of errors or interruptions, actual reported usage and billing records take precedence.
Official references:
- [Kimi Model Pricing Information](https://platform.kimi.ai/docs/pricing/chat)
- [Cache Parameters and Usage Guidelines](https://platform.kimi.ai/docs/guide/context-caching)
- [Official Chat Completions reference](https://platform.kimi.ai/docs/api/chat)
- [Responses Official Reference](https://platform.kimi.ai/docs/api/responses)
- [Messages Official Reference](https://platform.kimi.ai/docs/api/messages)
When calling through this site, use the request domain and path specified on this page.
Service behavior and example explanations:
- 5m and 1h determine the validity period of cache creation, but do not guarantee that a cache will be created or hit upon request emission.
- Only the actual usage reported for reading, creation, and TTL granularity is considered in this measurement; missing fields do not imply zero.
- Cache creation and regular input are mutually exclusive; output includes thinking; clients should not add cumulative frames repeatedly.
- Streaming usage can be distributed across the first and last frames: when input and cache arrive before output, retain the latest reported cumulative values per dimension. Missing fields or usage=null do not clear known values; repeated frame accumulation does not add up.
- Different interface tool definitions and return formats follow the specifications on this page; example text inputs for unexecuted function tools or image requests do not constitute operational validation of these features.
Request example
curl --request POST https://api.router.ai/v1/messages \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $ROUTER_API_KEY" \
--header "anthropic-version: 2023-06-01" \
--data '{
"model": "kimi-k3.1-pro",
"messages": [
{
"role": "user",
"content": "这是虚构示例,请只回复:你好。"
}
],
"max_tokens": 256,
"output_config": {
"effort": "low"
},
"stream": false
}'
Endpoint reference: Create a message (Claude native)