kimi-k3-1-pro
Use Kimi K3.1 Pro through reAPI Chat Completions. Official parameters, preserved thinking, tool calls, structured output and dated capability checks.
Kimi K3.1 Pro uses POST https://reapi.ai/api/v1/chat/completions with model ID kimi-k3.1-pro. It returns a synchronous Chat Completions response or SSE stream, rather than a task ID. Current pricing and playground.
The request contract follows Moonshot's official Chat API. Unknown fields pass through; acceptance of a request does not establish that every field changed the result. The dated observations below identify the capabilities checked during integration.
Quickstart
Create a key in API keys. Keep it on your server. These examples send one request with retries disabled where the SDK otherwise retries.
curl https://reapi.ai/api/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kimi-k3.1-pro",
"messages": [{"role":"user","content":"Explain three edge cases for an average function."}],
"reasoning_effort": "low"
}'from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://reapi.ai/api/v1",
max_retries=0,
)
response = client.chat.completions.create(
model="kimi-k3.1-pro",
messages=[{"role": "user", "content": "Explain three edge cases for an average function."}],
reasoning_effort="low",
)
print(response.choices[0].message.content)
# Retain the entire message for another turn, including extra reasoning fields.
assistant_message = response.choices[0].message.model_dump(exclude_none=True)import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'YOUR_API_KEY',
baseURL: 'https://reapi.ai/api/v1',
maxRetries: 0,
});
const response = await client.chat.completions.create({
model: 'kimi-k3.1-pro',
messages: [{ role: 'user', content: 'Explain three edge cases for an average function.' }],
reasoning_effort: 'low',
});
console.log(response.choices[0].message.content);
const assistantMessage = response.choices[0].message;package main
import (
"bytes"
"io"
"net/http"
"os"
"time"
)
func main() {
body := []byte(`{"model":"kimi-k3.1-pro","messages":[{"role":"user","content":"Explain three edge cases for an average function."}],"reasoning_effort":"low"}`)
req, err := http.NewRequest("POST", "https://reapi.ai/api/v1/chat/completions", bytes.NewReader(body))
if err != nil { panic(err) }
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 120 * time.Second,
CheckRedirect: func(req *http.Request, via []*http.Request) error { return http.ErrUseLastResponse }}
res, err := client.Do(req)
if err != nil { panic(err) }
defer res.Body.Close()
if _, err := io.Copy(os.Stdout, res.Body); err != nil { panic(err) }
if res.StatusCode >= 400 { os.Exit(1) }
}Endpoint
POST https://reapi.ai/api/v1/chat/completions
Send Authorization: Bearer YOUR_API_KEY and Content-Type: application/json. Responses use application/json, or text/event-stream when stream: true. There is no task-polling endpoint.
Official input parameters
The inventory below contains all 17 top-level fields in Moonshot's KimiK31ProChatRequest OpenAPI schema, checked October 24, 2026. Omitted values retain the official default. Both token-cap spellings are forwarded as supplied; neither is silently substituted for the other.
| Parameter | Type | Required / default | Meaning |
|---|---|---|---|
model | string | Required | kimi-k3.1-pro; the separate Highspeed ID is not served by this integration. |
messages | array | Required | Complete conversation; roles system, user, assistant, tool. Content can be text or content parts. |
reasoning_effort | string | max | low, high, max. Thinking is always enabled. |
max_completion_tokens | integer | 131072 | Official output allowance, up to 1048576, including reasoning. See measured limitation below. |
max_tokens | integer | Omitted | Deprecated official output-cap alias. Still forwarded. |
stream | boolean | false | Set true for SSE. |
stream_options | object | include_usage: false | reAPI requests include_usage: true for streaming settlement; other fields remain unchanged. |
response_format | object | type: text | text, json_object, or json_schema. Schema form includes json_schema.name, schema and optional strict. |
tools | array | Omitted | Function definitions: type: function, function.name, parameters, optional description, strict (official default true). |
tool_choice | string or object | auto | auto, none, required, or type: function with function.name. |
stop | string or string array | Omitted | Up to five stop strings, each at most 32 UTF-8 bytes. |
logprobs | boolean | false | Request output token probabilities; see observations below. |
top_logprobs | integer | Omitted | 0–20; use with logprobs: true. |
prediction | object | Omitted | type: content with expected string or text-part content. |
prompt_cache_key | string or null | Omitted / null | Optional prefix-cache key. |
prompt_cache_options | object | Implicit, 5m | mode: implicit; ttl: 5m or 1h. |
safety_identifier | string | Omitted | Optional caller-provided safety identifier. |
Function names follow ^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$. Tool parameter schemas are JSON objects. Nested message fields include name, assistant reasoning_content, tool_calls, tool tool_call_id, and final-assistant partial. Return complete assistant messages rather than selecting only the visible text.
Moonshot fixes temperature=1, top_p=0.95, n=1, and both penalties at 0; these are not adjustable controls in its current K3.1 Pro request schema. Existing clients may still send fields: reAPI forwards them and leaves model-specific handling upstream.
The context window is 1,048,576 tokens shared by input and output. Moonshot documents automatic reduction of the output allowance when input plus requested output exceeds that window. No maximum-window stress test was performed here.
Preserved thinking and tool results
Keep reasoning_content and tool_calls exactly as returned. Supply one result for each requested function. Tool execution happens in your application, never automatically in this endpoint or playground.
messages = [{"role": "user", "content": "Look up the synthetic inspection result."}]
tools = [{"type": "function", "function": {
"name": "inspect", "description": "Read a test fixture.",
"parameters": {"type": "object", "properties": {}, "additionalProperties": False},
"strict": True,
}}]
first = client.chat.completions.create(
model="kimi-k3.1-pro", messages=messages, tools=tools,
tool_choice="required", reasoning_effort="low",
)
assistant = first.choices[0].message.model_dump(exclude_none=True)
messages.append(assistant)
for call in assistant.get("tool_calls", []):
# Replace this synthetic value with your application's actual tool result.
messages.append({"role": "tool", "tool_call_id": call["id"],
"content": "Synthetic inspection result: seven teal circles."})
second = client.chat.completions.create(
model="kimi-k3.1-pro", messages=messages, tools=tools,
reasoning_effort="low",
)
print(second.choices[0].message.content)Official dynamic tools use a system message containing tools and no content. Preserve that message on later turns. This form returned an unsupported-tools error during current integration checks; it remains forwarded unchanged. Use top-level tools for the verified tool loop.
For partial completion, the last message can be role: assistant, content: <prefix>, partial: true. The response contains the continuation: prepend your original prefix when presenting the complete result.
Images and video
Public media inputs must use reachable HTTP(S) URLs. Do not send base64, data URIs or vendor file IDs to reAPI. The service downloads public media and prepares the vendor representation internally. Private addresses, credentials in URLs and nonstandard ports are blocked; redirects are checked again. The request JSON limit is 32 MiB and combined downloaded media is capped at 24 MiB.
{
"model": "kimi-k3.1-pro",
"reasoning_effort": "low",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "Describe the visible scene."},
{"type": "image_url", "image_url": {"url": "https://example.com/scene.jpg"}}
]
}]
}Replace the example URL with your own accessible image. Moonshot documents JPEG, PNG, GIF, WebP, BMP, HEIC and HEIF. It also documents video parts under video_url, with a URL string or object containing url. The current video probe returned HTTP 400: video input unsupported. The official field remains available for passthrough, but current video support is not claimed.
Structured output and streaming
{
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "review",
"strict": true,
"schema": {
"type": "object",
"properties": {"result": {"type": "string"}},
"required": ["result"],
"additionalProperties": false
}
}
}
}Add this object to a complete request. Parse choices[0].message.content, not the separate reasoning field. A schema-valid answer still needs checks against the source data.
For SSE, send stream: true. Accumulate delta.content, delta.reasoning_content and indexed delta.tool_calls, including fragmented function arguments. The final usage frame may have an empty choices array. A [DONE] event ends the stream; treat an interrupted stream as incomplete.
Capability observations — October 24, 2026
These are focused integration checks, not a model-quality benchmark or a deployed account-billing audit.
| Capability | Observation |
|---|---|
| Text and SSE | Correct sentinel answer; SSE included usage and completed. |
| Effort | low, high, max accepted; relative quality and latency effects unmeasured. |
| JSON Schema / JSON object | Returned the required structure; schema test used a conflicting plain-text prompt. |
| Tools | Required, named and none choices behaved as requested. Complete thinking/tool-result round trip passed. |
| Dynamic tools in system messages | HTTP 400; current execution not supported by the tested path. |
| Partial prefix and stop | Continuation and stop-string effects observed. |
| Probabilities / prediction | Requests accepted; probabilities absent, prediction acceleration unmeasured. |
| Cache | Creation recorded in cache_creation_input_tokens; repeated prefix reported 3,072 cached tokens. TTL retention and cache-key isolation unmeasured. |
| Image | Correctly described a fixed image containing a large creature, ruined towers and bridge. |
| Video | HTTP 400, unsupported. |
| Output cap | max_completion_tokens: 8 was accepted but output exceeded eight tokens. Deprecated max_tokens: 8 produced finish_reason: length at eight tokens. |
| Unknown field | Accepted; no parameter-effect claim. |
Do not treat max_completion_tokens as an enforced spending limit on the tested path. Both official spellings remain available; no fallback request or silent parameter substitution is made. The platform's existing settlement checks still refuse untrusted usage above the admitted bound. This is separate from the model's documented ceiling.
The local test machine's DNS proxy mapped the media host into a reserved address range, so the safe downloader correctly rejected that address. Media understanding probes used separately downloaded, fixed public fixtures through the same conversion code. Production URL retrieval and very large media remain unverified.
Pricing and billing
Input, generated output (including reasoning) and cached input have separate token rates. View current rates; no numeric prices are embedded in this document. Repeated context does not guarantee a cache hit. Inspect usage, and measure the entire tool loop when comparing costs.
Accounting uses integer micro-USD: microUSD = ceil(settled_USD_charge × 1,000,000) and credits = microUSD / 1,000. One credit equals $0.001; token rates are available on the model page.
The service makes one inference request for each accepted client submission. It does not retry failed calls or execute tools. Existing postpaid settlement requires delivery and valid usage/cost evidence; failed or untrusted settlements are not charged. Production account debits were not exercised during these isolated checks.
Output schema
A non-streaming response has this shape (illustrative fields, not a token estimate):
{
"id": "req_example",
"object": "chat.completion",
"model": "kimi-k3.1-pro",
"choices": [{
"index": 0,
"message": {"role": "assistant", "content": "OK", "reasoning_content": "..."},
"finish_reason": "stop"
}],
"usage": {"prompt_tokens": 91, "completion_tokens": 28, "total_tokens": 119}
}Errors
Errors use error.code, error.message, error.request_id, plus the Chat-compatible error.type where applicable:
| HTTP / code | Meaning |
|---|---|
401 / 10001–10005 | Missing, invalid, revoked key or missing session. |
400 / 20001, 20002, 20003, 20004 | Invalid JSON, missing input, invalid value or unsupported model. |
413 / 20008 | Request payload too large. |
402 / 30001 | Insufficient balance. |
429 / 50001 | Rate or in-flight limit on this chat path. |
502–503 / 70001 | Upstream/configuration/pricing service unavailable. |
See the error-code catalog. Use the returned message and request ID to diagnose an error. Correct the request before submitting again; resubmission is a new request.
Tips
- Begin with a small task whose result you can check; record total usage across all turns.
- Use top-level tools for the verified function-call loop and preserve the returned assistant state.
- Consult the dated output-cap observation before relying on a spending limit.
Related
Compare the Kimi K3 documentation and Claude Opus 5.5 documentation, or use the task comparison guide.