# Kimi K3.1 Pro

> Kimi K3.1 Pro on FlyMy.AI: Moonshot's thinking model for agents, coding and long documents, with text and images, function tools, a priority tier, private mode, OpenAI-compatible API, pricing.

Kimi K3.1 Pro is Moonshot AI's flagship model for agentic coding, tool use and
work over long documents, released on October 23, 2026. It thinks before it
answers, reads text and images, calls your function tools and holds a
1M-token context. Call it with the OpenAI SDK or with the native FlyMy.AI API,
on the same wallet as every other model, or pick it as your agent's brain.

| | |
| --- | --- |
| Endpoint id | `flymyai/kimi-k3_1-pro` |
| Model page | https://app.flymy.ai/models/flymyai/kimi-k3_1-pro |
| OpenAI `base_url` | `https://api.flymy.ai/api/v1/flymyai/kimi-k3_1-pro/openai/v1` |
| Native route | `POST https://api.flymy.ai/api/v1/flymyai/kimi-k3_1-pro/predict` |
| Agent model id | `kimi-k3.1-pro` |

## OpenAI-compatible API

```python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.flymy.ai/api/v1/flymyai/kimi-k3_1-pro/openai/v1",
    api_key="fly-***",
)

response = client.chat.completions.create(
    model="kimi-k3.1-pro",
    messages=[
        {"role": "system", "content": "Answer briefly."},
        {"role": "user", "content": "Write a Python one-liner that reverses a string."},
    ],
    reasoning_effort="low",
    max_tokens=2000,
)

print(response.choices[0].message.content)
print(response.usage)
```

The model is selected by the `base_url`; `model` is echoed back. The key is your
FlyMy.AI key as a `Bearer` token. Leave out `temperature` and `top_p`: the model
sets its own (see [Parameters](#parameters)).

With `stream=True`, the answer arrives as one content chunk when the model has
finished, followed by a chunk with `finish_reason`, the `usage` chunk and
`data: [DONE]`.

`usage` follows the OpenAI convention: `completion_tokens` includes the
reasoning tokens, itemized in `completion_tokens_details.reasoning_tokens`;
`prompt_tokens_details.cached_tokens` shows the part of the prompt read from
the cache, and `usage.cost` is the price of the call.

### Function tools

```python
tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Current weather for a city",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"],
        },
    },
}]
messages = [{"role": "user", "content": "What's the weather in Paris right now?"}]

first = client.chat.completions.create(
    model="kimi-k3.1-pro", messages=messages, tools=tools
)
call = first.choices[0].message.tool_calls[0]
messages += [
    first.choices[0].message,
    {"role": "tool", "tool_call_id": call.id, "content": '{"temp_c": 14, "sky": "light rain"}'},
]
final = client.chat.completions.create(
    model="kimi-k3.1-pro", messages=messages, tools=tools
)
print(final.choices[0].message.content)
```

`tool_choice` takes `auto` (the default) or `required`. Kimi K3.1 Pro does not
take a named function in `tool_choice`: to make it call one tool, send only
that tool with `tool_choice="required"`. Send the assistant message with its
`tool_calls` back as it came, then one `tool` message per call.

### Priority tier

Set `service_tier="priority"` (or `"nitro"`) for Moonshot's faster Highspeed
serving at the priority price. Without it the call runs on the default tier.
The response's `service_tier` says which tier answered.

## Native API

The native route takes form fields or a JSON body and answers with one
Server-Sent Event carrying the result:

```bash
curl -X POST https://api.flymy.ai/api/v1/flymyai/kimi-k3_1-pro/predict \
  -H "X-API-KEY: fly-***" -H "Content-Type: application/json" \
  -d '{"prompt": "Write a haiku about rain.", "reasoning_effort": "low"}'
```

`output_data` holds `output` (the answer), `finish_reason`, `model`,
`service_tier`, `stream_details` (`input_tokens`, `output_tokens`,
`cached_tokens`, `reasoning_tokens`), `reasoning` when the model shows it, and
`charge_usd`, the price of the call.

Kimi K3.1 Pro does not use `/predict/stream/`. For long jobs, `/predict/async/`
works as for other models, except in private mode.

## Parameters

| Parameter | Values |
| --- | --- |
| `prompt` | One user message |
| `messages` | Chat history in the Chat Completions format (a JSON array in form data); used instead of `prompt`. Text and `image_url` content parts |
| `system_prompt` | Instructions for the whole chat, added unless `messages` already has a system message |
| `reasoning_effort` | `none` (answers at once), `low`, `medium` (default) or `high` |
| `service_tier` | `default` or `priority` (alias `nitro`) |
| `max_tokens` | Most tokens to generate, reasoning included, 1 to 943,718 (`max_completion_tokens` works too) |
| `private_mode` | `true` keeps the prompt and the answer out of FlyMyAI storage and logs |

The model sets its own `temperature` and `top_p`. Leave them out: sent together
with `tools`, they make the call fail; without tools they have no effect.

The OpenAI-compatible route also accepts up to 128 function `tools`,
`tool_choice` (`auto` or `required`) and tool-result messages.
`response_format` is rejected with `400 unsupported_parameter`.

Repeated prompt content is read from the cache by itself and billed at the
cached rate. Keep the system prompt and tool definitions first and unchanged
across turns; the first call with a new prefix is billed in full.

## Private mode

Send `private_mode: true` - `extra_body={"private_mode": True}` in the OpenAI
SDK, or a form or JSON field on the native route. FlyMy.AI then keeps neither
the prompt nor the answer: the request history shows the call, its token
counts and its price, without the text. Private mode works with synchronous
calls only; an async request with it is refused, because an async request is
replayed from storage.

The host that serves the call keeps its own retention policy.

## From an AI assistant

An assistant connected to FlyMy.AI quotes Kimi K3.1 Pro with `get_pricing`,
which also returns its OpenAI `base_url`, and asks it with `run_model`
(`endpoint_id: flymyai/kimi-k3_1-pro`, the same input as `/predict`). The
result is the answer as text, followed by its token counts and `charge_usd`.

### Use Kimi as your agent's brain

Choose **Kimi K3.1 Pro** in the agent model picker, pass `"model":
"kimi-k3.1-pro"` on the REST API, or pass `model: "kimi-k3.1-pro"` to
`create_agent` or `update_agent` on the Agents MCP. `list_agent_models` lists
its reasoning levels: `low`, `medium` (the default), `high` and `max`. Each
model call is debited from the agent owner's FlyMy balance as it completes, at
the default tier's prices; you do not need a Moonshot key.

## Pricing

| Tier | Input | Cached input | Output |
| --- | --- | --- | --- |
| Default | $2 / 1M | $0.20 / 1M | $10 / 1M |
| Priority | $4 / 1M | $0.20 / 1M | $20 / 1M |

Reasoning tokens are billed as output. The price of every call is in
`charge_usd` (native) or `usage.cost` (OpenAI-compatible) and in your
[usage](https://docs.flymy.ai/api/usage.md).

## Errors

| What you see | Meaning |
| --- | --- |
| `422` on the OpenAI route | A parameter is out of range, `service_tier` is not `default` or `priority`, or `messages` is malformed; the message says which |
| `400 unsupported_parameter` | `response_format` |
| `500 model_error` on the OpenAI route | Usually a named function in `tool_choice`, or `temperature` or `top_p` sent with `tools`: send the one tool with `tool_choice="required"` and leave the sampling fields out |
| HTTP 200 with `status_code: 400` from `/predict/stream/` | Use `/predict` or the OpenAI-compatible route |
| `private mode does not support async requests` | Send the private call synchronously |
| `403 Insufficient funds` | Top up your balance |

## Related guides

- [OpenAI-Compatible API](https://docs.flymy.ai/guides/llm-openai-compat.md)
- [Using LLMs](https://docs.flymy.ai/guides/use-llms.md)
- [DeepSeek V4.1 Flash](https://docs.flymy.ai/guides/deepseek-v4-1-flash.md)
- [Grok 4.7](https://docs.flymy.ai/guides/grok-4-7.md)
