MiMo - Xiaomi
This topic describes how to call Xiaomi's MiMo series models on Alibaba Cloud Model Studio.
ImportantThis document applies only to the China (Beijing) region. To use the models, you must obtain an API key from the China (Beijing) region.
Quick start
mimo-v2.5-pro is a hybrid reasoning model provided by Xiaomi. It runs in thinking mode by default (enable_thinking defaults to true). To disable thinking and get direct responses, explicitly pass enable_thinking: false. The following example calls mimo-v2.5-pro in thinking mode with streaming enabled.
Before you begin, make sure you have Obtain an API key and Configure API key as an environment variable. If you are using an SDK, you also need to Install the SDK.
OpenAI-compatible
Noteenable_thinking is not a standard OpenAI parameter. In the OpenAI Python SDK, pass it via extra_body. In the Node.js SDK, pass it as a top-level parameter.
Python
Sample code
from openai import OpenAI
import os
client = OpenAI(
# Replace with your Model Studio API Key: api_key="sk-xxx"
api_key=os.getenv("DASHSCOPE_API_KEY"),
# China (Beijing) region. Replace {WorkspaceId} with your Bailian workspace ID. URLs vary by region.
base_url="https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
)
messages = [{"role": "user", "content": "What is 1+1?"}]
completion = client.chat.completions.create(
model="xiaomi/mimo-v2.5-pro",
messages=messages,
# Thinking mode is enabled by default. To disable: extra_body={"enable_thinking": False}
stream=True,
stream_options={
"include_usage": True
},
)
reasoning_content = "" # Full thinking process
answer_content = "" # Final answer
is_answering = False
print("\n" + "=" * 20 + " Thinking " + "=" * 20 + "\n")
for chunk in completion:
if not chunk.choices:
print("\n" + "=" * 20 + " Usage " + "=" * 20 + "\n")
print(chunk.usage)
continue
delta = chunk.choices[0].delta
if hasattr(delta, "reasoning_content") and delta.reasoning_content is not None:
if not is_answering:
print(delta.reasoning_content, end="", flush=True)
reasoning_content += delta.reasoning_content
if hasattr(delta, "content") and delta.content:
if not is_answering:
print("\n" + "=" * 20 + " Answer " + "=" * 20 + "\n")
is_answering = True
print(delta.content, end="", flush=True)
answer_content += delta.content
Sample response
==================== Thinking ====================
The user asked a simple arithmetic question: what is 1+1.
This is a basic addition operation. The answer is 2. I'll give a direct answer.
==================== Answer ====================
1+1 equals 2. This is a basic addition operation.
==================== Usage ====================
CompletionUsage(completion_tokens=42, prompt_tokens=9, total_tokens=51, prompt_tokens_details={'cached_tokens': 0})
Node.js
Sample code
import OpenAI from "openai";
import process from 'process';
const openai = new OpenAI({
// Replace with your Model Studio API Key: apiKey: "sk-xxx"
apiKey: process.env.DASHSCOPE_API_KEY,
// China (Beijing) region. Replace {WorkspaceId} with your Bailian workspace ID. URLs vary by region.
baseURL: 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1'
});
let reasoningContent = '';
let answerContent = '';
let isAnswering = false;
async function main() {
try {
const messages = [{ role: 'user', content: 'What is 1+1?' }];
const stream = await openai.chat.completions.create({
model: 'xiaomi/mimo-v2.5-pro',
messages,
// Thinking mode is enabled by default. To disable: enable_thinking: false
stream: true,
stream_options: {
include_usage: true
},
});
console.log('\n' + '='.repeat(20) + ' Thinking ' + '='.repeat(20) + '\n');
for await (const chunk of stream) {
if (!chunk.choices?.length) {
console.log('\n' + '='.repeat(20) + ' Usage ' + '='.repeat(20) + '\n');
console.log(chunk.usage);
continue;
}
const delta = chunk.choices[0].delta;
if (delta.reasoning_content !== undefined && delta.reasoning_content !== null) {
if (!isAnswering) {
process.stdout.write(delta.reasoning_content);
}
reasoningContent += delta.reasoning_content;
}
if (delta.content !== undefined && delta.content) {
if (!isAnswering) {
console.log('\n' + '='.repeat(20) + ' Answer ' + '='.repeat(20) + '\n');
isAnswering = true;
}
process.stdout.write(delta.content);
answerContent += delta.content;
}
}
} catch (error) {
console.error('Error:', error);
}
}
main();
Sample response
==================== Thinking ====================
The user asked a simple arithmetic question: what is 1+1.
This is a basic addition operation. The answer is 2. I'll give a direct answer.
==================== Answer ====================
1+1 equals 2. This is a basic addition operation.
==================== Usage ====================
{ prompt_tokens: 9, completion_tokens: 42, total_tokens: 51, prompt_tokens_details: { cached_tokens: 0 } }
HTTP
Sample code
curl
# China (Beijing) region. Replace {WorkspaceId} with your Bailian workspace ID. URLs vary by region.
curl -X POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1/chat/completions \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "xiaomi/mimo-v2.5-pro",
"messages": [
{
"role": "user",
"content": "What is 1+1?"
}
],
"stream": true,
"stream_options": {
"include_usage": true
}
}'
Supported features
Feature | Supported | Notes |
|---|---|---|
Supported | In thinking mode, you must include the | |
Supported |
| |
Supported | Implicit caching, automatically enabled | |
Supported |
| |
Not supported | — | |
Not supported | — | |
Multimodal input | Not supported | Passing image, audio, or video input returns an error |
mimo-v2.5-pro does not support the following parameters: top_k, reasoning_effort, thinking_budget, modalities, repetition_penalty, vl_high_resolution_images, preserve_thinking, tool_stream, enable_code_interpreter, parallel_tool_calls, seed, logprobs, top_logprobs, n,audio,enable_search,search_options,X-DashScope-DataInspection,skill. These parameters are ignored or return an error if passed.
Some parameter ranges and functional behaviors in MiMo differ from those in the Bailian platform. Please refer to the table below for details:
Full screen copy
Parameter | ModelStudio | MiMo |
|---|---|---|
| Range: [0, 2) | Range: [0, 1.5], Default: 1.0 |
| Range: (0, 1.0] | Range: [0.01, 1.0], Default: 0.95 |
| — | Range: [-2, 2], Default: 0 |
| — | Up to 4 sequences |
| Limits output length only (does not limit CoT length) | Limits both output and Chain-of-Thought (CoT) length |
Models and pricing
The MiMo series models are hybrid reasoning models provided by Xiaomi, supporting both thinking and non-thinking modes.
For context length and pricing details, refer to the Model Studio console.
Billing is based on input and output tokens.
In thinking mode, the chain-of-thought is billed as output tokens.
Error codes
The MiMo series models are provided directly by Xiaomi. Their error codes differ from the standard Model Studio error codes. When calling MiMo models, refer to the table below.
Error code | Cause | Solution |
|---|---|---|
400 | Invalid request body |
|
401 | Missing or invalid API Key, or incorrect Authorization header format | Verify your API Key and Authorization header format are correct |
402 | Insufficient account balance | Check your account balance and top up as needed |
403 | Service not available in the current region, or API Key is blocked | Create a new API Key and ensure your input content complies with safety policies |
404 | The endpoint or model does not support image input | Confirm that the model or endpoint supports multimodal image input |
421 | Content moderation triggered | Avoid inputting unsafe or sensitive content |
429 | Too many requests, or Token Plan quota exhausted |
|
500 | Internal server error | Retry later, or contact us for assistance |
503 | Server overloaded | Retry later |