A start-from-zero guide to calling mimo-v2.6-pro from code. It assumes you can open a terminal and have used Python once or twice.
What you're about to do
The model runs on someone else's computers. You send an HTTP request containing your question and get a response containing the answer — no download, no install, no GPU.
We go through AIHubMix, a gateway that hosts many companies' models behind one account and one address. The request format is the same whichever model you pick, so what you learn here transfers.
| Term | What it means |
|---|---|
| Model ID | The model's exact name in code: mimo-v2.6-pro
|
| API key | A secret string identifying your account, like a password |
| Base URL | Where your code sends requests: https://aihubmix.com/v1
|
| Token | The unit models count text in. Prices are per million tokens |
The model
| Model ID | mimo-v2.6-pro |
| Context window | 1,048,576 tokens |
| Longest answer | 131,072 tokens |
| Accepts | Text, images, video, audio |
| Price | $0.48/M input · $0.96/M output |
The previous model, mimo-v2.5-pro, took text only and retires on 21 October 2026, after which the ID returns 404 model_retired. Price and context window are identical, so there is no reason to start there.
Step 1 — Get a key
Create an account and an API key at https://console.aihubmix.com/, then put it in an environment variable rather than in your script:
export AIHUBMIX_API_KEY="paste-your-key-here"
Check it took:
test -n "$AIHUBMIX_API_KEY" && echo set || echo missing
Anything typed into a file can end up in a screenshot, a backup or a public repository. An environment variable stays in your shell.
Step 2 — Make one request with no code
Prove the key works with curl, already installed on macOS and Linux:
curl -s https://aihubmix.com/v1/chat/completions \
-H "Authorization: Bearer $AIHUBMIX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"mimo-v2.6-pro","messages":[{"role":"user","content":"Reply with exactly: AIHubMix is connected"}],"max_tokens":64}'
-H adds a header — your key, and a note that you're sending JSON. -d is the request body: which model you want, and what to say to it. It worked if the reply contains AIHubMix is connected.
One trap worth knowing now. A response can come back with HTTP 200 — "success" — and still be useless. If the text is cut off, check finish_reason: length means you capped the answer too short, not that anything is broken.
Step 3 — Install the library
python3 -m venv .venv
.venv/bin/pip install openai
The first line makes an isolated folder for this project's packages. The second installs OpenAI's official Python library — yes, OpenAI's library for a Xiaomi model. That is the point of the gateway: AIHubMix accepts requests in OpenAI's format.
Step 4 — Your first script
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AIHUBMIX_API_KEY"],
base_url="https://aihubmix.com/v1",
)
response = client.chat.completions.create(
model="mimo-v2.6-pro",
messages=[{"role": "user", "content": "Explain what an API key is, in two sentences."}],
max_completion_tokens=1024,
)
print(response.choices[0].message.content)
-
os.environ["AIHUBMIX_API_KEY"]reads the key you exported in Step 1. -
base_urlpoints the library at AIHubMix. This is the only line that differs from a standard OpenAI script. -
messagesis the conversation. Each entry has arole—useris you,assistantis the model,systemis standing instructions — andcontent. -
max_completion_tokenscaps the answer. Reasoning counts against this budget too, so don't set it stingily.
Run it:
.venv/bin/python chat.py
Step 5 — Send a picture
This is the ability the previous model didn't have. Instead of a plain string, content becomes a list of parts:
response = client.chat.completions.create(
model="mimo-v2.6-pro",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "What's wrong with this layout?"},
{"type": "image_url", "image_url": {"url": "https://example.com/screenshot.png"}},
],
}],
)
The image can be a public URL or a base64 data-URI for a local file. Audio uses input_audio, video uses video_url.
When something goes wrong
Every error response includes a tid — a trace ID. Quote it if you contact support.
| Code | What it actually means |
|---|---|
| 400 | The model didn't accept one of your settings |
| 401 | Your key is missing, wrong, or expired |
| 403 | Out of balance, or your key can't use this model |
| 404 | The model ID is wrong, or the model has been retired |
| 429 | You sent requests too quickly |
| 503 | The gateway couldn't reach the model right now |
Testing without paying
The free version is xiaomi-mimo-v2.6-pro-free, accepting the same text, image, audio and video input. Change one string in your script. Ten trial calls across all free models, no credit card, no expiry.
Trying things without code
Open this webpage, then log in and select your key.
Then, select the mimo-v2.6-pro model to start the conversation.



Top comments (0)