Model ID
Use with the Workers AI binding, the AI Gateway REST API, or the Unified API.
Calling the provider directly? Use the provider's model name instead, including with provider-native endpoints or the provider's own SDK. For example, Anthropic's name for anthropic/claude-opus-4.8 is claude-opus-4-8.
- Third-party
Xiaomi MiMo-V2.6-Pro is a reasoning model served by PrimaLabs. It thinks before it answers, supports tool calling and prompt caching, and has a context window of about 1M tokens through an OpenAI-compatible Chat Completions API.
| Model Info | |
|---|---|
| Context Window ↗ | 1,048,576 tokens |
| More information | link ↗ |
| Request formats | Chat Completions |
| Pricing |
|
const response = await env.AI.run(
'xiaomi/mimo-v2.6-pro',
{
messages: [{ role: 'user', content: 'Explain KV caching in two sentences.' }],
max_completion_tokens: 2048,
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/chat/completions \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "xiaomi/mimo-v2.6-pro",
"messages": [
{
"role": "user",
"content": "Explain KV caching in two sentences."
}
],
"max_completion_tokens": 2048
}'KV caching stores the key and value tensors computed at each layer during the autoregressive generation of a transformer so that, on the next token prediction, the model only needs to compute attention for the new token against the cached keys and values rather than reprocessing the entire sequence from scratch. This avoids redundant computation across decoding steps, reducing time complexity from O(n²) to O(n) per new token and making text generation significantly faster.
{
"id": "chatcmpl-b690f48c7de59601",
"object": "chat.completion",
"created": 1794584767,
"model": "xiaomi/mimo-v2.6-pro",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "KV caching stores the key and value tensors computed at each layer during the autoregressive generation of a transformer so that, on the next token prediction, the model only needs to compute attention for the new token against the cached keys and values rather than reprocessing the entire sequence from scratch. This avoids redundant computation across decoding steps, reducing time complexity from O(n²) to O(n) per new token and making text generation significantly faster.",
"reasoning_content": "The user wants a concise two-sentence explanation of KV caching.",
"provider_specific_fields": {
"refusal": null,
"reasoning": "The user wants a concise two-sentence explanation of KV caching."
}
},
"finish_reason": "stop",
"provider_specific_fields": {
"token_ids": null,
"routed_experts": null
}
}
],
"usage": {
"prompt_tokens": 15,
"completion_tokens": 103,
"total_tokens": 118,
"completion_tokens_details": {
"reasoning_tokens": 13
},
"prompt_tokens_details": {
"cached_tokens": 0,
"created_cache_tokens": 0
}
}
}Streaming chat — Stream a short explanation of exponential backoff.
const response = await env.AI.run(
'xiaomi/mimo-v2.6-pro',
{
messages: [{ role: 'user', content: 'Explain exponential backoff in two sentences.' }],
max_completion_tokens: 2048,
stream: true,
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/chat/completions \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "xiaomi/mimo-v2.6-pro",
"messages": [
{
"role": "user",
"content": "Explain exponential backoff in two sentences."
}
],
"max_completion_tokens": 2048,
"stream": true
}'Exponential backoff is a retry strategy where the wait time between successive attempts increases exponentially (e.g., 1s, 2s, 4s, 8s…) rather than remaining constant. This prevents overwhelming a struggling service or network with rapid repeated requests and gives it time to recover before the next attempt.
[
{
"id": "chatcmpl-b41c1b2c54f92779",
"object": "chat.completion.chunk",
"created": 1794584769,
"model": "primalabs-ai/MiMo-V2.6-Pro-cloudflare",
"choices": [
{
"index": 0,
"delta": {
"role": "assistant",
"content": ""
}
}
]
},
{
"id": "chatcmpl-b41c1b2c54f92779",
"created": 1794584769,
"model": "primalabs-ai/MiMo-V2.6-Pro-cloudflare",
"object": "chat.completion.chunk",
"choices": [
{
"index": 0,
"delta": {
"reasoning_content": "The user wants a concise two-sentence explanation of exponential backoff."
}
}
]
},
"... 27 more chunks omitted ...",
{
"id": "chatcmpl-b41c1b2c54f92779",
"created": 1794584769,
"model": "primalabs-ai/MiMo-V2.6-Pro-cloudflare",
"object": "chat.completion.chunk",
"choices": [
{
"index": 0,
"delta": {}
}
],
"usage": {
"completion_tokens": 82,
"prompt_tokens": 16,
"total_tokens": 98,
"completion_tokens_details": {
"reasoning_tokens": 14
},
"prompt_tokens_details": {
"cached_tokens": 0,
"created_cache_tokens": 16
},
"cost": 0.00072
}
}
]Tool calling — Ask MiMo-V2.6-Pro to call a weather lookup function.
const response = await env.AI.run(
'xiaomi/mimo-v2.6-pro',
{
messages: [{ role: 'user', content: 'What is the weather in Paris?' }],
max_completion_tokens: 2048,
tools: [
{
type: 'function',
function: {
name: 'get_weather',
description: 'Get the current weather for a city.',
parameters: {
type: 'object',
properties: { city: { type: 'string' } },
required: ['city'],
},
},
},
],
tool_choice: { type: 'function', function: { name: 'get_weather' } },
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/chat/completions \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "xiaomi/mimo-v2.6-pro",
"messages": [
{
"role": "user",
"content": "What is the weather in Paris?"
}
],
"max_completion_tokens": 2048,
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a city.",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string"
}
},
"required": [
"city"
]
}
}
}
],
"tool_choice": {
"type": "function",
"function": {
"name": "get_weather"
}
}
}'{
"id": "chatcmpl-8692555c2e4e4ec8",
"object": "chat.completion",
"created": 1794584770,
"model": "xiaomi/mimo-v2.6-pro",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "",
"tool_calls": [
{
"function": {
"arguments": "{\"city\": \"Paris\"}",
"name": "get_weather"
},
"id": "chatcmpl-tool-85225333bedb366a",
"type": "function"
}
],
"reasoning_content": "The user wants weather in Paris.",
"provider_specific_fields": {
"refusal": null,
"reasoning": "The user wants weather in Paris."
}
},
"finish_reason": "tool_calls",
"provider_specific_fields": {
"token_ids": null,
"routed_experts": null
}
}
],
"usage": {
"prompt_tokens": 90,
"completion_tokens": 27,
"total_tokens": 117,
"completion_tokens_details": {
"reasoning_tokens": 7
},
"prompt_tokens_details": {
"cached_tokens": 16,
"created_cache_tokens": 64
}
}
}▶messages[]
arrayrequiredtemperature
numberminimum: 0maximum: 2max_tokens
numberexclusiveMinimum: 0max_completion_tokens
numberexclusiveMinimum: 0top_p
numberminimum: 0maximum: 1frequency_penalty
numberminimum: -2maximum: 2presence_penalty
numberminimum: -2maximum: 2stream
boolean▶stream_options{}
object▶tools[]
arraytool_choice
response_format
▶modalities[]
array▶audio{}
objectreasoning_effort
stringOptional reasoning control; availability and accepted values are model-dependent.id
stringobject
stringcreated
numbermodel
string▶choices[]
array▶usage{}
object