Knowledge Base Sections ▾

Navigation

▸ Start here By roles

Categories

Tools 52
Glossary 12

Tools

MiMo Code + JoinGonka Gateway: Xiaomi agent on Gonka network models

MiMo Code (the mimo command) is a terminal coding agent from the Xiaomi MiMo lab: it reads and writes code, executes commands, works with Git, and maintains persistent project memory across sessions. It is a fork of OpenCode: everything the parent project can do is present, with added session checkpoints, context restoration, sub-agents, and ready-made workflows. The code is open-source under the MIT license; the project is young and changing rapidly, so everything below is tied to version 0.1.15, released on September 22, 2026.

The inference layer in MiMo Code is swappable: any OpenAI-compatible API can be connected as a provider by adding a description in mimocode.jsonc and a key in auth.json. The JoinGonka Gateway is exactly that, so the setup process comes down to a single installer command.

There are no proprietary MiMo models on the Gonka network: the decentralized network serves DeepSeek V4 Flash, GLM-5.3 Flash, and MiniMax M2.7 — all at the same price of $0.0069 per million input tokens. The agent is not tied to Xiaomi models: providers are interchangeable, and the entire framework — memory, checkpoints, sub-agents — runs on top of the model you choose. The commands, files, and messages below were verified by a live run of MiMo Code through the gateway on September 23, 2026. After confirming your address, 3M free tokens will be credited to your account — enough to repeat all this yourself.

Quick Start: Installation and One Command

Step 1: install MiMo Code. The official methods from the project README:

# macOS and Linux
curl -fsSL https://mimo.xiaomi.com/install | bash

# Windows (PowerShell)
powershell -ep Bypass -c "irm https://mimo.xiaomi.com/install.ps1 | iex"

# via npm, on any system
npm install -g @mimo-ai/cli

The script installs the binary into ~/.mimocode/bin and adds that directory to PATH through your shell profile (the --no-modify-path flag disables this). It downloads the build from Xiaomi's repository; if the download fails, install via npm — it is the same release, and we got 0.1.15 both ways. To verify, run mimo --version.

Step 2: get a key. Sign up at gate.joingonka.ai/register, confirm your address and create a key with the jg- prefix under the "API Keys" section. One key and one balance work for every model on the network.

Step 3: run the installer.

npx @joingonka/setup --tool mimo-code

The installer will ask for your key — it is not passed in command-line arguments — and writes the same two files as MiMo Code's own provider wizard, only with the full catalog and limits right away:

  • registers the joingonka provider in the global config ~/.config/mimocode/mimocode.jsonc (or in mimocode.json or config.json, if MiMo Code is already writing there): the @ai-sdk/openai-compatible adapter, the gateway address with /v1, and three models on the network with context windows, response ceilings and tool support;
  • puts the key in MiMo Code's own key storage — ~/.local/share/mimocode/auth.json with 600 permissions. The config itself contains no key, so you can safely keep it in dotfiles;
  • sets the default model — the model field — to DeepSeek V4 Flash, but only if none is selected or the current one points to a model that has left the network. It does not override a choice you made, including in another global config;
  • saves copies of the previous files, leaves other providers, keys and comments untouched, and does not overwrite a file it cannot parse — it stops and tells you what to fix;
  • finally, sends a live request to the gateway and tells you plainly whether the key, address and model were accepted.

The installer handles non-standard directories on its own: MIMOCODE_HOME, XDG_CONFIG_HOME, XDG_DATA_HOME and MIMOCODE_CONFIG. To set a different default model, use the --model flag with the shorthand deepseek, glm or minimax; for dotfiles and servers there is a non-interactive mode:

JOINGONKA_API_KEY=jg-your-key npx @joingonka/setup --tool mimo-code --non-interactive

If MiMo Code was running, restart it: the new provider is picked up at startup.

Manual Configuration: mimocode.jsonc and auth.json

Everything the installer does can be done by hand. There are two files, and each has its own job: the config describes the provider and the models, auth.json holds the key. The provider identifier ties them together — joingonka must match in both files. The config, ~/.config/mimocode/mimocode.jsonc:

{
  "$schema": "https://mimo.xiaomi.com/mimocode/config.json",
  "provider": {
    "joingonka": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "JoinGonka (Gonka)",
      "options": {
        "baseURL": "https://gate.joingonka.ai/v1"
      },
      "models": {
        "deepseek-ai/DeepSeek-V4-Flash-0731": {
          "name": "DeepSeek V4 Flash (Gonka)",
          "tool_call": true,
          "reasoning": true,
          "limit": { "context": 380000, "output": 32768 }
        },
        "zai-org/GLM-5.3-Flash": {
          "name": "GLM 5.3 Flash (Gonka)",
          "tool_call": true,
          "reasoning": true,
          "limit": { "context": 390000, "output": 8192 }
        },
        "MiniMaxAI/MiniMax-M2.7": {
          "name": "MiniMax M2.7 (Gonka)",
          "tool_call": true,
          "limit": { "context": 200000, "output": 8192 }
        }
      }
    }
  },
  "model": "joingonka/deepseek-ai/DeepSeek-V4-Flash-0731"
}

The key, ~/.local/share/mimocode/auth.json with 600 permissions:

{
  "joingonka": { "type": "api", "key": "jg-your-key" }
}
FieldValueWhat matters
provider.joingonkaprovider identifierLowercase; the same key goes in auth.json, otherwise MiMo Code won't link the key to the provider
npm@ai-sdk/openai-compatibleThe adapter for OpenAI-compatible APIs — MiMo Code uses it to talk to the gateway over Chat Completions
options.baseURLhttps://gate.joingonka.ai/v1With /v1 at the end: MiMo Code appends the /chat/completions path itself
modelskeys are the network's model idsThe identifier is sent in the request as-is, vendor prefix and all
limitcontext and output per the list aboveWithout them MiMo Code assumes the model's window is a million tokens and starts compressing the history too late — the request will hit the model's real limit
tool_calltrueThe model calls tools. For its own models MiMo Code assumes this by default anyway; the installer writes the flag explicitly
reasoningtrueThe reasoning-model marker: DeepSeek V4 Flash and GLM-5.3 Flash get it, while the MiniMax M2.7 entry does without

The default model is written as provider/model-id; the provider is split off at the first slash, so network identifiers with a slash of their own are written as-is.

Where else the key can live. The MiMo Code README also shows the option of putting the key straight in the config — options.apiKey. It works, but then the key is easy to commit along with your dotfiles, and a stale key left there will override the new one from auth.json — which is why the installer removes options.apiKey from its block. And definitely don't put the key in the project's .mimocode/mimocode.jsonc.

Which file wins. MiMo Code merges the global config.json, mimocode.json and mimocode.jsonc in that order, each one overriding the previous. The result is printed by mimo debug config, and the paths to the config and keys on your system by mimo debug paths.

Provider from the interface, auth.json, and model selection

You can set up your provider without files using the built-in wizard. Upon the first launch, MiMo Code in the project directory asks if you trust the folder (Yes, I trust this folder): the agent will gain permission to read, edit, and run files within it. Then the /connect command opens the Select provider list: at the top, there is access to the Xiaomi MiMo platform, Codex, and import from Claude Code, below is the directory of providers, and at the very end is + Custom provider. The wizard asks six questions:

StepWhat to enterNote
Provider id (1/6)joingonkaThe same id as the installer: if run later, it will update this entry instead of creating a second one
Display name (2/6)JoinGonkaLabel in lists; defaults to the id
Base URL (3/6)https://gate.joingonka.ai/v1With the /v1 suffix
API key (4/6)your jg-… keyGoes into auth.json, not written to config
First model id (5/6)deepseek-ai/DeepSeek-V4-Flash-0731Full model id of the network, with the vendor prefix
First model name (6/6)DeepSeek V4 FlashLabel; defaults to the id itself

In our run, the wizard recorded a provider block with one model without limits and two fields that the installer does not have: env with the variable name JOINGONKA_API_KEY, where MiMo Code will also search for the key, and options.setCacheKey: true. This works with the gateway, but the configuration should be finished: without limit, mimo models joingonka will show a 1M token window. The easiest way is to run the installer once after the wizard — it will append the full catalog with limits to the same block.

Selecting a model. A constant selection is the model field in the config. In the interface, the model is changed by the /models command, for a one-time run — by the -m flag. To see which models MiMo Code sees from the provider and what window it works with, use mimo models joingonka — along with the threshold at which the agent will start compressing the history:

joingonka/deepseek-ai/DeepSeek-V4-Flash-0731 — window 380K, compacts at 342K
joingonka/MiniMaxAI/MiniMax-M2.7 — window 200K, compacts at 180K
joingonka/zai-org/GLM-5.3-Flash — window 390K, compacts at 351K

The price for all network models is the same, so the choice is about behavior. This is how they performed in our mimo run on a single task — reading a file and finding a bug:

ModelContext / responseBehavior in MiMo Code
DeepSeek V4 Flash380K / 32768Solves the task correctly; the largest response limit in the network — its installer sets it by default
GLM-5.3 Flash390K / 8192Clean response in two steps and a few seconds. Reasoning model: reasoning is included in the response limit
MiniMax M2.7200K / 8192Solves the task correctly. The model's reasoning comes separately from the response: by default, mimo run shows only the response and tool calls, while the --thinking flag also outputs reasoning

Why DeepSeek V4 Flash is chosen by default is explained in the model overview.

Verification: what should happen

First, make sure MiMo Code can see the provider and the key:

mimo models joingonka
mimo providers list

The first command lists the three network models with their context windows, as in the example above; the second prints the path to the key store and the line joingonka api. Then do a one-off run. Put a file calc.py in your project directory with an obvious bug — say, the area of a rectangle where the sides are added instead of multiplied — and ask it to find the bug:

mimo run "Read the file calc.py in the current project directory and tell me in one sentence whether it has a bug."

The output will show the agent and model (> build · deepseek-ai/DeepSeek-V4-Flash-0731), the tool call (→ Read calc.py) and a response that gets to the point — naming the faulty expression. The --format json flag turns the output into a stream of events, where each step has a token counter, and -m joingonka/<model-id> runs it on a different model. In our run, all three network models completed the loop "request → tool call → result → response".

The third check is on the gateway side: in the dashboard under "Usage", the request will show up in the "By model" breakdown, and the "By key" section will update the time of the last request.

If something goes wrong, the diagnosis is usually right there in the message:

What you seeWhat it meansWhat to do
Error: Invalid API keyThe gateway rejected the keyCheck the key in auth.json or run the installer again; note that options.apiKey in the provider block overrides auth.json
Error: Method Not AllowedThe baseURL is missing the /v1 suffixThe address must be exactly https://gate.joingonka.ai/v1
Error: Model not found: joingonka/… Did you mean: …?The model isn't in the provider's models list — most often the id was entered without the vendor prefixTake the full id from the hint or from mimo models joingonka
permission requested: external_directory (…); auto-rejecting, and the run ends without a responseIn mimo run, access outside the project is denied and the run stops. This happens when the model looks for a file outside the project — in your home directory, for exampleSpecify that the file is in the project directory; a permission.external_directory rule grants permanent access to the directory you need
mimo models joingonka shows a 1M windowThe model has no limit — this happens after the Custom provider wizardSet a limit in the config or run the installer
429 … is currently overloaded in the Gonka network (rate limit)The model currently has no free capacity on the networkTry again in a minute or switch to a neighboring model with the /models command or the -m flag; you can check the state on the status page
402Your balance is out of fundsTop up in the "Billing" section; the key itself still works
The response cuts off mid-sentenceThe response stream was interrupted along the way — this happens at peak hoursmimo run -c "continue" will resume the last session from where it left off

How much it costs

Agentic tools spend tokens differently than chats: MiMo Code adds a system prompt, tool descriptions, and agent service context to each of your phrases, and the task takes several steps. In our run, each request to the model carried 22–25 thousand input tokens, and the task of “reading a file and finding an error” which took two steps cost about 45–50 thousand tokens — almost all of it being input. Therefore, the price per token is what matters here.

Via JoinGonka Gateway, tokens cost $0.0069 per million for input and $0.021 per million for output — the price is the same for all network models and is pulled onto this page from a live source.

ScenarioConsumptionVia Gateway
One-off task: read a file, find an error45-50K tokensfractions of a cent
A day of active work3-7M tokensa few cents
A month of active development~150M tokensabout a dollar

The estimates in the right column are based on September 2026 prices. For comparison — how you can pay for models in MiMo Code in general:

MethodHow paidWhat is needed
Xiaomi MiMo Platformper platform termsXiaomi MiMo account, browser login
CodexChatGPT subscriptionChatGPT Plus or Pro plan, browser login
Vendor key from provider catalogper vendor token pricingseparate key for each vendor
JoinGonka Gatewayper tokens from prepaid balancejg-… key; three network models at one price, usage visible in the dashboard

The cost estimate within MiMo Code for gateway models is zero — their records do not have a cost field, and in --format json events, "cost": 0 is shown. Actual consumption and balance are in your dashboard, in the “Usage” and “Billing” sections.

Things to consider

Permissions. In the MiMo Code interface, it asks for confirmation for risky actions, but in mimo run there is no one to ask—it rejects requests for access outside the project on its own. For trusted one-time environments, there is the --dangerously-skip-permissions flag (or the MIMOCODE_DANGEROUSLY_SKIP_PERMISSIONS=1 variable): it allows everything not explicitly forbidden by a rule—only within a container or sandbox. In the interface, a similar mode can be enabled for the duration of a session using /skip-permissions.

Agents. By default, build runs with a full set of tools, plan only reads and analyzes, and compose manages the process from specification to verified code; you can switch between them using Tab.

Long Context. At the context window limit, MiMo Code rebuilds the context from the latest checkpoint, project memory, and fresh messages; it calculates the threshold starting from limit.context. You can compress it earlier using the /context-limit command, separately for each model.

What is tied to the Xiaomi account. Voice input (/voice) recognizes speech using the MiMo platform model and is available after logging in. Code, commands, and sub-agents work through a connected provider—in our test run, without any login.

Images. The network models are text-based: in /modalities, leave only text for them, and for screenshots, set up a second provider with a model capable of vision.

MiMo Code and OpenCode are relatives with different settings. They have their own directories and files, so settings are not transferred from one to the other:

OpenCodeMiMo Code
Commandopencodemimo
Config~/.config/opencode/opencode.json~/.config/mimocode/mimocode.jsonc
Keys~/.local/share/opencode/auth.json~/.local/share/mimocode/auth.json
Installer--tool opencode--tool mimo-code

Version. The project updates frequently; for reproducibility, pin the version: npm install -g @mimo-ai/[email protected] or curl -fsSL https://mimo.xiaomi.com/install | bash -s — --version 0.1.15.

Agents from the labs themselves are also available for the families serviced by the network: MiniMax Code runs on its vendor's MiniMax M2.7 model; DeepSeek and Z.ai, the authors of GLM, have their own agents. They all connect to the same gateway with a single key.

MiMo Code is the Xiaomi MiMo terminal agent, a fork of OpenCode with project memory and checkpoints. There are no MiMo models in the Gonka network, but the provider in the agent is replaceable: npx @joingonka/setup --tool mimo-code will register the joingonka provider in ~/.config/mimocode/mimocode.jsonc (adapter @ai-sdk/openai-compatible, address https://gate.joingonka.ai/v1, DeepSeek V4 Flash, GLM-5.3 Flash, and MiniMax M2.7 with honest limits) and place the jg-… key in the native auth.json. You can do the same manually via the /connect wizard → + Custom provider, after which you should add the models and limits. Verification: mimo models joingonka and mimo run; in a single run, keep paths inside the project.

Want to learn more?

Explore other sections or start earning GNK right now.

Get key and free tokens →