Knowledge Base Sections ▾

Navigation

▸ Start here By roles

Categories

Tools 52
Glossary 12

Tools

MiniMax Code: MiniMax agent with your own key via Gonka

MiniMax Code (command mcode) is a terminal-based coding agent from the MiniMax lab: it analyzes the project, edits files, runs commands and tests, and you control it from a TUI, from scripts, or from an editor. The source code for the terminal version is open, and the vendor's own code is under an MIT license. The product is young and changes quickly, so everything below is tied to version 0.5.1, on which we went from installation to the agent's response.

By default, mcode works through a vendor account and a Token Plan subscription. But it also supports BYOK: your own endpoint and your own key, and you don't need to log in to an account for this—it's explicitly stated in the README. Three API formats are supported: openai-completions, openai-responses, and anthropic-messages; JoinGonka Gateway speaks all three.

The scenario is symmetrical. The Gonka network serves the open MiniMax M2.7 model, and along with it DeepSeek V4 Flash and GLM-5.3 Flash—all at the same price. The vendor's agent works on the same vendor's model, but it is calculated by a decentralized network, and you pay for actual tokens; you can switch to a neighboring model with one command within a session.

What is MiniMax Code and how to install it

The agent has three entry points, and all three work with a BYOK provider the same way:

Entry pointCommandWhat it's for
Interactive TUImcode [prompt]Explore code, hold a conversation, review edits and permissions
Headlessmcode exec [prompt]Scripts, CI, batch tasks
ACPmcode acpEditors and clients with Agent Client Protocol support

The official installer places the latest version in ~/.minimax-code, pulls in a suitable Node.js if needed, and requires no administrator rights:

# macOS / Linux / WSL
curl -fsSL https://filecdn.minimax.chat/public/install.sh | bash

# Windows (PowerShell)
irm https://filecdn.minimax.chat/public/install.ps1 | iex

If you already have Node.js (22.19 or newer in the 22 line, 24.2 or newer in the 24 line, plus 25 and 26), npm will work:

npm install -g @minimax-ai/code@latest --registry=https://registry.npmjs.org/ --ignore-scripts=false --include=optional --allow-scripts=@minimax-ai/code,better-sqlite3

The long command isn't a mistake: the agent needs a native SQLite build, so optional dependencies and install scripts must stay enabled. After installing, reopen your terminal and check: mcode --version.

Inside the TUI, these come in handy: Shift+Tab (planning mode), Alt+M (switch permission modes — Ask, Auto, and Full access), @ to reference a file, and /help for the command list. An interrupted session resumes with mcode --continue, and mcode init . creates an AGENTS.md file in the project with rules for the agent.

User data — config.yaml, sessions, login state — lives separately from the program, in the ~/.minimax directory (for a named profile, ~/.minimax-<profile>); the MINIMAX_DATA_DIR variable sets a different location.

JoinGonka key. Sign up at gate.joingonka.ai/register: after you confirm your address, 3M free tokens will land in your account. Create a key with the jg- prefix in your dashboard, under "API keys"; it's handy to set up a separate one for the agent — its traffic will show up as a separate line.

Fast track: one-command installer

Close mcode if it's running, then run:

npx @joingonka/setup --tool minimax-code --model minimax

The installer will ask for your key, save a copy of the existing config.yaml, append only its own block to it, and finish with a live request to the gateway: the key, address, and model are verified right away, not on your first task. In ~/.minimax/config.yaml a joingonka provider will appear under the custom_provider branch — that's where mcode keeps third-party endpoints:

custom_provider:\n  joingonka:\n    name: JoinGonka\n    kind: custom\n    enabled: true\n    api: openai-completions\n    options:\n      apiKey: jg-your-key\n      baseURL: https://gate.joingonka.ai/v1\n      authMode: api-key\n    models:\n      MiniMaxAI/MiniMax-M2.7:\n        name: MiniMax M2.7 (Gonka)\n        limit:\n          context: 200000\n          output: 8192\n      deepseek-ai/DeepSeek-V4-Flash-0731:\n        name: DeepSeek V4 Flash (Gonka)\n        reasoning: true\n        limit:\n          context: 380000\n          output: 32768\n      zai-org/GLM-5.3-Flash:\n        name: GLM 5.3 Flash (Gonka)\n        reasoning: true\n        limit:\n          context: 390000\n          output: 8192\ndefaultModel: custom_provider:joingonka/MiniMaxAI/MiniMax-M2.7

A few things worth knowing about this block:

  • The API format is set explicitly. Without the api field, mcode treats the provider as Anthropic-compatible; the installer picks openai-completions — the gateway's canonical path.
  • Each model has its own limits. For an unfamiliar model, mcode assumes a 200,000 window and a 16,384-token response; the network's real values differ, so limit is set for all three entries.
  • The key is stored in the file as a literal, and the file itself gets 600 permissions. That's how mcode stores keys too: its --api-key-env flag reads the variable and writes the value into the config, not a reference.
  • Default model. The --model minimax flag sets MiniMax M2.7. Without the flag, the installer picks DeepSeek V4 Flash for coding agents — it has a bigger window and response ceiling — while --model glm gives you GLM-5.3 Flash. If a model from another provider is already selected in the config, re-running without --model won't touch it.
  • Profiles. For a named profile, run the installer with an environment variable, e.g. MINIMAX_DATA_DIR=~/.minimax-work.

Please close mcode during installation for a real reason: the agent rewrites config.yaml in full on its own saves and can overwrite an edit made behind its back.

Manual configuration: mcode provider add and config.yaml

The agent's built-in command gives the same result. The key is passed via an environment variable — it has no business being in arguments or shell history:

# read the key without echo\nread -s JOINGONKA_API_KEY\nexport JOINGONKA_API_KEY\n\nmcode provider add --name JoinGonka \\\n  --base-url https://gate.joingonka.ai/v1 \\\n  --api-format openai-completions \\\n  --model MiniMaxAI/MiniMax-M2.7 \\\n  --api-key-env JOINGONKA_API_KEY \\\n  --context-limit 200000 --output-limit 8192 --use

The --use flag first tests the first of the listed models with a live request and only then saves the provider and sets the model as default; on failure, nothing is saved. A successful run ends with the line Provider added and selected: JoinGonka. From the name, mcode derives the provider key itself — joingonka — so an installer run later will update the same entry rather than create a second one.

The --context-limit and --output-limit flags apply to all models listed in the command, while the network's models have differing limits. So it's convenient to set up one model with the command and add the rest in the file. Close mcode and merge this fragment with the existing provider block in ~/.minimax/config.yaml:

custom_provider:\n  joingonka:\n    models:\n      MiniMaxAI/MiniMax-M2.7:\n        limit: { context: 200000, output: 8192 }\n      deepseek-ai/DeepSeek-V4-Flash-0731:\n        limit: { context: 380000, output: 32768 }\n      zai-org/GLM-5.3-Flash:\n        limit: { context: 390000, output: 8192 }

The third way is interactive: inside the TUI, the /model command opens model selection with a + Add 3rd-party provider… option, while /provider manages saved connections. The address on the model screen is edited with Ctrl+E; a failed check saves nothing, and the draft remains for editing.

Which API format to choose. The gateway accepts all three; only the base URL differs:

--api-format--base-urlWhen to choose it
openai-completionshttps://gate.joingonka.ai/v1The main option: the gateway's canonical path, and the one the installer writes. We ran the full agent cycle on it
openai-responseshttps://gate.joingonka.ai/v1If the rest of your environment is built around the Responses API
anthropic-messageshttps://gate.joingonka.aiAnthropic Messages format: the agent appends the /v1/messages path itself. This is also the value mcode uses when --api-format isn't specified

In our run, all three formats passed the connection check.

Verification and Common Errors

Three commands show that the integration is working. The first lists providers — the active one is marked with an asterisk, the key is masked:

mcode provider list
* custom_provider:joingonka   active   jg-a****9f3c

The second makes a live request and, on success, responds with Provider available: custom_provider:joingonka; the --model flag checks a specific model:

mcode provider test custom_provider:joingonka

The third checks the most important thing — file operations. Put a small file with an obvious bug in the directory and ask it to find it:

mcode exec "Read calc.py and tell me in one sentence whether it has a bug."

The agent should call the read tool on its own and give a substantive answer. In our run, all three models on the network performed this way; you can specify a different model for a single run with a flag like --model custom_provider:joingonka/<model-id>. With the --output-format json flag, the response includes a usage field with the number of input and output tokens — handy for cross-checking with the gateway dashboard: the "Usage" section shows requests by hour and by day, broken down by model and by key.

If the check fails, mcode states the reason right in the message:

What you seeWhat it meansWhat to do
Authentication failed (HTTP 401)The gateway rejected the keyCheck that the variable from --api-key-env is exported in the same shell and contains the full key
HTTP 405 on the checkThe OpenAI-format URL is missing its suffixThe URL must end with /v1: the agent appends /chat/completions itself
HTTP 400: Model "…" not found. Available: …The identifier was entered without the vendor prefixCopy the id from the list that the gateway provides in the message itself
Request timed out after 10000msThe connection check waits ten seconds, but the network under load responded laterRepeat the command. Or save the provider without --use and test it separately with mcode provider test
429 … currently overloaded … (rate limit)The model currently has no spare capacity on the networkRetry in a minute or switch to a neighboring model with the /model command; the status is shown on the status page
The provider's models don't appear in /modelThe provider is disabled or the edit was overwritten by a running mcodeClose the agent and repeat the installation: it restores enabled: true and the model catalog
A large context window is used only halfway, or the response cuts off earlier than expectedThe model was added without limits: the agent assumes a window of 200,000 and a response of 16,384 tokensSet limit as in the examples above

Which model to choose

All models on the network share one price, so the choice comes down to behavior. Below are the limits and how the models behaved in our mcode exec run on the same task (verified September 21, 2026):

ModelIdentifierContext / responseHow it behaves in mcode
MiniMax M2.7MiniMaxAI/MiniMax-M2.7200K / 8192A model from the same vendor as the agent itself. In our run it responded faster than the others. Reasoning arrives in a separate reasoning_content field, and the response text contains only the answer
DeepSeek V4 Flashdeepseek-ai/DeepSeek-V4-Flash-0731380K / 32768A clean, to-the-point answer. A large window and the biggest response ceiling on the network — which is why the installer sets it as the default
GLM-5.3 Flashzai-org/GLM-5.3-Flash390K / 8192A reasoning model: it thinks before answering, and the answer itself is clean. Reasoning counts toward the response limit, so don't set output too low

The rule of thumb is simple. For short tasks and quick edits, use MiniMax M2.7: it currently accounts for the largest share of the network's capacity. If visible reasoning gets in the way — for example, when a script parses the exec output — or you need to read a large repository and get a long edit, switch to DeepSeek V4 Flash. For tangled logic, GLM-5.3 Flash thinks better.

Switching doesn't require editing a file: in the TUI it's the /model command, for one session it's mcode -m custom_provider:joingonka/<model-id>, and for one run it's mcode exec --model with the same value. Your persistent choice is stored in the defaultModel line. The network's lineup changes over time; the current list with limits is always available from GET https://gate.joingonka.ai/v1/models.

How much it costs and what to consider

Agent tools consume tokens differently than chat: for every phrase of yours, mcode adds a system prompt and descriptions of all tools, and then conducts a multi-turn dialogue with the model. In our run, the task "read a file and find an error" cost approximately 40,000 tokens, almost all of which was input. Therefore, the price per token is the deciding factor here.

Through JoinGonka Gateway, tokens cost $0.0069 per million for input and $0.021 per million for output — the price is the same for all models in the network and is pulled onto this page from a live source. Orders of magnitude for prices as of September 2026: a one-time task — hundredths of a cent, a day of active work for 3-7 million tokens — a few cents.

MethodHow it is paidRequirements
Vendor account and Token PlanSubscription with creditsLogin via mcode login and available credits
JoinGonka Gateway (BYOK)Per actual tokens from balancejg-… key; no need to log into a vendor account, usage visible in the dashboard

What BYOK covers. Your provider handles model requests: code reading and editing, commands, subagents, and sessions. Built-in search, mcode-tools media tools, and managed connectors are the vendor's own services; they require account login and credits. Custom tools connect independently of this, via MCP servers in the project's .mcp.json file.

Permissions. In TUI, Ask, Auto, and Full access modes are switched via Alt+M or the /permission command; for mcode exec, the --permission flag controls this.

Telemetry. Statistics, metrics, and diagnostic channels in mcode are disabled by default and enabled separately; the MCODE_DISABLE_TELEMETRY and DO_NOT_TRACK variables disable them all at once. The gateway, for its part, does not store the content of prompts and responses — only usage aggregates remain in the statistics.

If you need image processing — interface screenshots, mockups — set up a second provider with a vision-capable model, specifying the --support-image flag when adding it: Gonka network models are text-only, and you can have multiple providers in mcode.

Agents from the labs themselves exist for all three model families in the network: alongside MiniMax Code are DeepSeek Harness and ZCode from Z.ai, the creators of GLM. All three connect to the same gateway with the same key.

MiniMax Code is a terminal agent from the MiniMax lab with open source and native BYOK: your own endpoint connects without logging into a vendor account. The fast track is npx @joingonka/setup --tool minimax-code --model minimax: the installer will write the joingonka provider to ~/.minimax/config.yaml with openai-completions format, https://gate.joingonka.ai/v1 address, and correct MiniMax M2.7, DeepSeek V4 Flash, and GLM-5.3 Flash limits, and then verify the connection with a live request. Manually, mcode provider add … --use does the same. Verification — mcode provider test custom_provider:joingonka, model switching — /model. Pay for actual tokens at Gonka network prices, no subscriptions or quotas.

Want to learn more?

Explore other sections or start earning GNK right now.

Get a key and free tokens →