MiMo Code long-horizon agent routing: Max Mode, Goal checks, and OpenAI-compatible backends

MiMo Code is Xiaomi's open-source coding agent for long-horizon work. Learn how Max Mode, Goal verification, worker/judge routing, and OpenAI-compatible backends change API gateway cost and reliability planning.

TheRouter Newsroomvia Xiaomi MiMo
MiMo Code long-horizon coding agent architecture diagram showing Max Mode parallel sampling and Goal verification loop

Most coding agents are designed for tasks that fit inside a single conversation turn. When a task stretches to dozens or hundreds of tool calls, the naive approach — grow the context window — hits compounding failure modes: diminishing model instruction-following at long contexts, runaway token spend, and agents that hallucinate completion before finishing the job. Xiaomi's MiMo team published the engineering design of MiMo Code on June 10, a terminal-based coding agent built on OpenCode and open-sourced under MIT.

If you searched for "MiMo Code," "MimoCode," or "how to use MiMo Code," the short version is: install the CLI, connect either MiMo Auto/Xiaomi MiMo Platform or a custom OpenAI-compatible provider, then decide whether features such as Max Mode and Goal verification are worth the extra API calls for your workload. Those choices have direct consequences for teams that route agent workloads through an API gateway.

What MiMo Code actually ships

MiMo Code is a harness, not a model. The GitHub README describes it as a terminal-native AI coding assistant that can read and write code, run commands, manage Git, and preserve project memory across sessions. It can start with MiMo Auto, sign in to the Xiaomi MiMo Platform, import Claude Code authentication, or connect to a custom provider through an OpenAI-compatible API.

On top of the base loop, MiMo Code adds three architectural layers:

Max Mode — parallel sampling. At each agent step, MiMo Code generates N candidate plans in parallel (default N=5, temperature=1). A separate "judge" model call compares the reasoning traces and action plans, then selects the best candidate for execution. No candidate executes until the judge has voted. On SWE-Bench Pro, Max Mode improves solve rates by 10–20% at the cost of roughly 4–5× the token consumption per step.

Goal — independent completion verifier. When the agent attempts to terminate, an independent model call reviews the full conversation history against a natural-language stopping condition (e.g., "all tests pass and the code has been committed"). If the condition is not met, the gap is fed back to the agent and execution continues. False-blocking rate (goal met but verifier disagrees) is the more common error; infinite-loop probability is reported at under 0.5%, with a hard step limit as a safety valve.

Structured memory retrieval. Rather than compressing history into rolling summaries, MiMo Code maintains explicit storage structures for task state and uses retrieval to selectively recall prior context. The design is motivated by the observation that rolling-summary compression behaves like a recurrent model — it has state but cannot look back on demand.

Max Mode and Goal are orthogonal: Max Mode is parallel (wider per step), Goal is serial (more steps per task). They can run simultaneously, and the token cost compounds accordingly.

How to use MiMo Code v0.1

The public repo documents two basic install paths: a one-line installer from Xiaomi's site or npm install -g @mimo-ai/cli, followed by running mimo in a terminal. On first launch, the CLI guides provider configuration. For routing teams, the important setup decision is not the installer; it is which backend each agent role should use:

  • MiMo Auto for a fast zero-configuration trial, while available.
  • Xiaomi MiMo Platform when you want Xiaomi-hosted model access and OAuth login.
  • Custom Provider when you want MiMo Code to call your own OpenAI-compatible gateway.
  • Imported Claude Code auth when migrating an existing local coding-agent setup.

MiMo Code v0.1 also exposes agent modes such as build for full development permissions, plan for read-only analysis, and compose for specs-driven orchestration. The /goal command sets a natural-language stopping condition that an independent judge checks before the session is allowed to stop.

Why this matters for engineering teams

1. Model-agnostic deployment is the key routing decision

MiMo Code supports custom OpenAI-compatible backends, and the release discussion framed open coding harnesses as a way to keep LLMs more interchangeable. In practice, that means operators running MiMo Code for automated coding pipelines need to choose:

  • Which model to route to for the worker role (most steps, high volume, cost-sensitive)
  • Which model to route to for the judge role (Max Mode, accuracy-critical, lower volume)
  • Whether worker and judge should use the same model or different models

The worker/judge split creates a natural place to apply routing policy: use a faster, cheaper provider for worker turns and a higher-accuracy model for judge calls. An AI gateway that handles per-request model selection can route these two roles independently without changes to the agent harness.

2. Max Mode changes your token budget math

At N=5, every agent step consumes approximately 5× the tokens of a single-sample agent. For a 50-step task:

  • Standard mode: ~50 worker turns + 50 judge turns = ~100 API calls
  • Max Mode: ~250 worker turns + 50 judge turns = ~300 API calls

The actual multiplier depends on task complexity and step count, but the budget implication is clear: Max Mode is a throughput amplifier for the underlying provider. Teams should model this as a separate cost tier and consider rate-limit headroom when Max Mode is enabled. If your routing layer enforces per-model TPM caps, Max Mode can silently push single-task sessions into rate-limit territory.

3. MiMo-V2 deprecation is now a cost-accounting deadline

Operators pinned to mimo-v2-flash or mimo-v2-tts model IDs have already crossed the first automatic re-route milestone: on June 18, 2026 at 00:00 GMT+8, the Xiaomi platform began routing v2-flash and v2-tts requests to their V2.5 equivalents — at V2.5 pricing. Full deprecation follows on June 30.

If your routing layer uses vendor-side model aliases (i.e., you pass mimo-v2-flash to the Xiaomi endpoint), the June 18 re-route may have changed your per-token cost without changing your configuration. If your routing layer normalizes model IDs to provider-neutral names, audit your mappings before June 30 to ensure the V2.5 variant (and its price) is reflected in your cost accounting.

The router/operator angle

MiMo Code surfaces two recurring operator patterns that apply beyond this specific tool:

Worker/judge asymmetry. Agent harnesses that use a "planning" or "verification" call alongside the main worker call are increasingly common. Routing these two roles to different providers — or the same provider at different quality tiers — requires a gateway that can dispatch calls based on role metadata in the request, not just the model name.

Step-count amplification. Long-horizon agents multiply API call volume non-linearly. A governance layer that treats each "task" as one unit of consumption will mismatch the actual token spend when Max Mode or Goal is active. Accurate cost attribution requires per-request accounting at the API call level, not the task level.

What to watch

  • MiMo-V2-Flash and MiMo-V2-TTS began auto-routing to V2.5 pricing on June 18; full deprecation lands June 30 — audit model ID mappings now.
  • MiMo Code v0.1 is an early release; the constrained shell command-line tool-call syntax (reducing token overhead vs JSON) is listed as a future migration, not yet live.
  • Max Mode is currently experimental and must be enabled manually in configuration.
  • The MiMo Code GitHub repo is open under MIT and supports mainstream provider APIs plus custom OpenAI-compatible backends.
  • If you route MiMo or Xiaomi model IDs through a gateway, track provider-side alias and pricing changes separately from MiMo Code itself; otherwise model-cost drift can appear without a code change.

Routing teams evaluating long-horizon coding agents should treat model selection for worker vs judge roles, Max Mode token multipliers, and provider rate-limit headroom as first-class parameters in their routing and cost model.

Help & contact