Connect MiMo 2.6 with Python and Keep Tool-Call History Intact
Configure the correct MiMo 2.6 key, endpoint and model ID, then understand thinking fields and the differences between Chat Completions and Responses.
For a standard Xiaomi MiMo API integration, use the exact model ID with the matching key and endpoint from your account. A common integration mistake is mixing a free gateway identifier, a Token Plan key or a conversation format from another API into a direct Xiaomi request.
This guide follows official documentation checked on September 22, 2026. The examples show request construction and preservation of conversation fields; they are not paid end-to-end test results.
Match the key to the service
The first-call guide documents the ordinary OpenAI-compatible base URL as https://api.xiaomimimo.com/v1. Token Plan keys use their assigned service path; obtain that path from your console instead of treating a regional documentation example as universal.
For ordinary direct API calls, the relevant names are mimo-v2.6-flash, mimo-v2.6-pro and the separately provisioned mimo-v2.6-pro-ultraspeed. OpenCode’s opencode/mimo-v2.6-flash-free names a different provider route and does not belong in a Xiaomi direct request.
Make a small Python request
Install the OpenAI Python SDK in an isolated environment and record its version. Set your key in MIMO_API_KEY; the variable name below is a local convention, not an API requirement.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["MIMO_API_KEY"],
base_url="https://api.xiaomimimo.com/v1",
)
response = client.chat.completions.create(
model="mimo-v2.6-flash",
messages=[{
"role": "user",
"content": "Explain the difference between Python sorted() and list.sort().",
}],
extra_body={"thinking": {"type": "disabled"}},
)
print(response.choices[0].message.content)
print(response.usage)
Starting with a short text request makes account, endpoint and response-format problems easier to isolate. Check the HTTP outcome and returned usage, then inspect the answer itself. A successful response is not evidence that a larger coding task will pass its tests.
Thinking changes the history you must retain
The deep-thinking documentation describes thinking.type as enabled or disabled. For a thinking-mode tool conversation, preserve the assistant’s complete reasoning_content alongside its tool calls in the subsequent history. The provider warns that omitting the field can produce a 400 response.
A framework may hide this field while displaying the final answer. Inspect what it sends on the next request, not only what appears in the UI. Preserve the original assistant tool-call item, then append each tool result with its matching call ID.
Thinking also affects evaluation settings. The documentation fixes sampling parameters in that mode, so setting a nominal temperature of zero is not a reliable way to claim deterministic, equal-setting comparisons with another provider. Record the actual supported controls and repeat task runs to observe variation.
Responses is not identical to another provider’s Responses API
MiMo also documents a Responses endpoint. Its current compatibility limits matter:
| Feature | Documented behavior |
|---|---|
previous_response_id | Not supported |
background | Not supported |
context_management | Not supported |
reasoning.effort = none | Disables thinking |
| Other effort levels | Enable thinking without distinct intensity levels currently |
Do not assume that a successful request to another provider can be redirected by changing only base_url. Check the supported fields and manage the conversation according to MiMo’s schema. In particular, an effort label shared by two providers does not prove equal computation or comparable evaluation conditions.
Connect through a coding client
Choose one route before adding configuration: the client’s own model service, Xiaomi’s ordinary API, or a Token Plan connection. Then verify provider name, base URL, key type and exact model ID together. For OpenCode’s free route and its current data-use conditions, see the MiMo access guide.
After the first request succeeds, test a short multi-turn exchange. If your intended workflow uses tools, add one harmless local tool and verify that its result is returned to the right call ID. Capture redacted request structure and error messages; do not publish keys or private task data in a support log.
Read usage before running a long task
Billed output can include reasoning as well as the final answer. A completion-token budget must leave room for both; a small visible answer does not establish a small bill. Compare the complete usage record against the MiMo price schedule and examples.
For a deployment check, retain the SDK version, selected model, endpoint, key type, supported thinking mode, response status and usage. This creates evidence you can use to distinguish a client regression from an account or model issue later.
Frequently Asked Questions
- Can I use an OpenCode free model ID with the Xiaomi API?
- No. Use the identifier for the selected provider; the OpenCode free route and Xiaomi direct API are different services.
- Does MiMo Responses support previous_response_id?
- The September 2026 documentation says it does not. Check the supported schema before porting another provider’s integration.


