> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyfast.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Kimi K3.1 Pro

> Call Kimi K3.1 Pro and Kimi K3.1 Pro Highspeed through the AnyFast OpenAI-compatible API.

Kimi K3.1 Pro is Moonshot AI's K3.1 flagship model for long-horizon coding, 3D creation, financial research, and end-to-end agent workflows. It is a 3-trillion-parameter-class model with native vision understanding and a 1,048,576-token context window.

Kimi K3.1 Pro Highspeed uses the same model positioning and context window, with Moonshot AI describing output speed as approximately 2–3× the standard model. Choose the standard model for the default price/speed balance and Highspeed when response latency is the priority.

> [!NOTE]
>
> The public model IDs are `kimi-k3.1-pro` and `kimi-k3.1-pro-highspeed`. Availability depends on the models enabled for your AnyFast project. This page follows the current Kimi API contract; confirm the IDs in your project's model list before sending production traffic.

## Model comparison

| Model | Positioning | Context window | Speed | Reasoning |
| - | - | -: | - | - |
| `kimi-k3.1-pro` | Standard K3.1 flagship for coding, 3D, finance, and long-horizon agents | 1,048,576 tokens | Standard | Always on; `low`, `high`, or `max` |
| `kimi-k3.1-pro-highspeed` | High-speed variant with the same capability target | 1,048,576 tokens | Approximately 2–3× the standard model, according to Moonshot AI | Always on; `low`, `high`, or `max` |

Both models support text, image, and video input, function tools, structured output, streaming, Partial Mode, and automatic prefix caching when the unchanged prefix is eligible. Use the same request shape for both variants; only change the `model` value.

## Quick example

```bash cURL theme={null}
curl https://www.anyfast.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kimi-k3.1-pro",
    "reasoning_effort": "high",
    "messages": [
      {"role": "user", "content": "Explain how to review a large codebase safely."}
    ]
  }'
```

```python Python theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://www.anyfast.ai/v1",
)

completion = client.chat.completions.create(
    model="kimi-k3.1-pro-highspeed",
    reasoning_effort="high",
    messages=[
        {"role": "user", "content": "Explain how to review a large codebase safely."}
    ],
)

print(completion.choices[0].message.content)
```

## Reasoning effort

K3.1 Pro always reasons. Set the top-level `reasoning_effort` field to `low`, `high`, or `max`; the default is `max`. Do not send the K2.x `thinking` object to these models. Select the effort before a long conversation because changing it can prevent prefix-cache reuse.

```python theme={null}
completion = client.chat.completions.create(
    model="kimi-k3.1-pro",
    reasoning_effort="max",
    messages=[
        {"role": "user", "content": "Derive a robust migration plan for this service."}
    ],
)
```

## Multimodal input

Send text, image, or video parts in a typed `content` array. AnyFast accepts public URLs and Base64 data URIs in the corresponding `image_url` or `video_url` part.

```json theme={null}
{
  "model": "kimi-k3.1-pro",
  "messages": [
    {
      "role": "user",
      "content": [
        {"type": "image_url", "image_url": {"url": "https://example.com/diagram.png"}},
        {"type": "text", "text": "Summarize this diagram."}
      ]
    }
  ]
}
```

## Tools and multi-turn conversations

Define function tools at the top level and use `tool_choice` with `auto`, `none`, or `required`. After executing a tool, append the complete assistant message and the matching `role: "tool"` result for each `tool_call_id` before the next request.

For any multi-turn request, preserve the complete assistant message returned by AnyFast, including `reasoning_content` and `tool_calls`. Do not reconstruct the assistant message from only its visible text.

## Parameters and limits

| Parameter | Type | Required | Description |
| - | - | - | - |
| `model` | string | Yes | `kimi-k3.1-pro` or `kimi-k3.1-pro-highspeed` |
| `messages` | array | Yes | Conversation history with text, image, video, or tool messages |
| `reasoning_effort` | string | No | `low`, `high`, or `max`; default `max` |
| `max_completion_tokens` | integer | No | Default 131,072; maximum 1,048,576. Input plus output must fit the 1M context window |
| `stream` | boolean | No | Enable SSE streaming; default `false` |
| `stream_options` | object | No | Set `include_usage: true` to receive usage in the final stream chunk |
| `response_format` | object | No | `text`, `json_object`, or `json_schema` |
| `tools` | array | No | Function definitions available to the model |
| `tool_choice` | string | No | `auto`, `none`, or `required` |
| `stop` | string / array | No | Up to five stop strings, each no longer than 32 bytes |
| `prompt_cache_key` | string | No | Stable session or task identifier for prefix-cache reuse |
| `safety_identifier` | string | No | Stable end-user identifier; prefer a one-way hash instead of direct personal data |

> [!NOTE]
>
> Sampling parameters are fixed for the K3 series: `temperature` is `1.0`, `top_p` is `0.95`, `n` is `1`, and `presence_penalty` and `frequency_penalty` are `0`. Omit them from requests.

> [card] [API reference](https://docs.anyfast.ai/api-reference/model-api/moonshot/kimi-k3-1-pro.md)
>
> View the request and response schema for both K3.1 Pro model IDs.

> [card] [Official Kimi documentation](https://platform.kimi.com/docs/guide/kimi-k3-1-pro-quickstart)
>
> Compare the provider's current model guide, API examples, and limits.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.