How to use MiniMax in Claude Code and Codex
AutoRouter5 min read
AutoRouter, the Mac app for Codex and Claude Code, puts MiniMax M3.1 Flash in both apps' model pickers with no MiniMax key or config, next to the ChatGPT and Claude plans you already pay for. The native route takes a MiniMax key and config in each app. To use MiniMax in Claude Code, set ANTHROPIC_BASE_URL to https://api.minimax.io/anthropic, put your MiniMax M Plan key in ANTHROPIC_AUTH_TOKEN and set the model variables to MiniMax-M3.1-Flash[1m] in ~/.claude/settings.json (MiniMax's Claude Code guide). In Codex, add https://api.minimax.io/v1 as a provider in ~/.codex/config.toml (MiniMax's Codex guide).
AutoRouter wrote this post. The MiniMax routes below bill to your MiniMax account with nothing in between. Every setting is copied from MiniMax's, Anthropic's or OpenAI's docs as checked on November 17, 2026; check the linked page before you paste.
How do you use MiniMax in Claude Code?
Point Claude Code at MiniMax's Anthropic-compatible endpoint and set each model tier to MiniMax-M3.1-Flash. MiniMax offers a setup wizard, npx -y mmx-cli@latest agent setup, or you can edit the file yourself:
- Run
unset ANTHROPIC_AUTH_TOKENandunset ANTHROPIC_BASE_URL, so old exports in your shell don't override the file. - Add the block below to
~/.claude/settings.json, with your M Plan API key in place of<MINIMAX_API_KEY>. - Start
claudein your project and run/statusto check the base URL and model.
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.minimax.io/anthropic",
"ANTHROPIC_AUTH_TOKEN": "<MINIMAX_API_KEY>",
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "524288",
"CLAUDE_CODE_EFFORT_LEVEL": "max",
"ANTHROPIC_MODEL": "MiniMax-M3.1-Flash[1m]",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "MiniMax-M3.1-Flash[1m]",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "MiniMax-M3.1-Flash[1m]",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "MiniMax-M3.1-Flash[1m]"
}
}
MiniMax recommends compacting at 512K tokens, which is what CLAUDE_CODE_AUTO_COMPACT_WINDOW sets, though the model reads up to 1M. Thinking is always on. While CLAUDE_CODE_EFFORT_LEVEL is set, /effort has no effect, so remove that line if you want to change effort during a session. While the token is set, it replaces your claude.ai login, so your Claude plan's limits don't apply (Anthropic docs).
How do you use MiniMax in Codex?
Add MiniMax as a custom provider in ~/.codex/config.toml. Codex speaks only the Responses API (OpenAI config reference), and MiniMax's /v1 endpoint supports it. The same wizard sets Codex up and recommends Codex CLI 0.146.0 or newer; by hand, add:
model = "MiniMax-M3.1-Flash"
model_provider = "minimax"
model_context_window = 524288
preferred_auth_method = "apikey"
forced_login_method = "api"
[model_providers.minimax]
name = "MiniMax"
base_url = "https://api.minimax.io/v1"
experimental_bearer_token = "<MINIMAX_API_KEY>"
wire_api = "responses"
Restart Codex so it reads the change. MiniMax's guide adds an optional model catalog file for reasoning levels and image input, and warns never to send an effort of none, which the API rejects with a 400 error. OpenAI's reference calls experimental_bearer_token discouraged and suggests env_key, which reads the key from an environment variable. Codex model providers and config.toml, explained covers the other provider keys.
What does MiniMax cost?
MiniMax-M3.1-Flash costs $0.15 per million input tokens, $0.015 per million cached input tokens and $0.60 per million output tokens on pay-as-you-go, as of November 17, 2026 (MiniMax pricing). It has a 1M-token context window (MiniMax models).
MiniMax's Claude Code guide uses an M Plan key. The M Plan is MiniMax's coding subscription, in Go, Explore and Build tiers with 1×, 3× and 7.5× Go's quota, and M3.1 Flash is its text model on every tier (MiniMax M Plan). MiniMax retires its M2.5 and M2.7 models on November 18, 2026; the old MiniMax-M3.1-Flash-Preview name already serves M3.1 Flash.
How do you use MiniMax with AutoRouter?
Pick MiniMax M3.1 Flash in the model picker. AutoRouter adds 20+ frontier and open-weight models to Codex and Claude Code with no keys or endpoints to set up, and MiniMax M3.1 Flash is on AutoRouter's models page as of November 17, 2026. Choosing it sends your requests straight to it. Choosing AutoRouter lets it work out how hard each task is and send each one to the model that fits; every task has to clear a quality bar for its difficulty before price counts.
- Download AutoRouter for macOS from autorouter.com.
- Open it, sign in or create a free account, sign in to your plans, allow Accessibility, and click Enable for each app.
- Start a new session and choose a model: in Codex, from the model menu under the message box; in Claude Code, with
/model.
AutoRouter pools the plans you already pay for: Claude, ChatGPT, Grok and Gemini plans connect, any of them can run in either app, and when one account reaches its limit AutoRouter moves on to the account with the most room left before it spends any credit. MiniMax is a pay-per-use model on Pro, at $50 a month with $20 of included usage each month, billed at the provider's price plus 10%. New accounts get Pro free for their first month, or until $20 of usage is spent, whichever comes first.
If MiniMax is all you need, an M Plan or a MiniMax API key is the cheaper, more direct route. AutoRouter runs on macOS 14 or later, and Claude Code needs Node 22.18 or later to use it. Requests pass through AutoRouter's servers; it doesn't store transcripts, but keeps the message that opens each request, up to 4,000 characters, to review routing (AutoRouter privacy).
Which MiniMax setup should you use?
As of November 17, 2026:
| Route | Setup | Key | What pays |
|---|---|---|---|
| Claude Code + MiniMax | Wizard, or env block in ~/.claude/settings.json | M Plan API key | Your M Plan quota |
| Codex + MiniMax | Wizard, or a provider in config.toml | M Plan API key | Your M Plan quota |
| AutoRouter (Mac) | Install, sign in, click Enable | None | Pro usage at the provider's price plus 10% |
For which tasks suit a low-cost model and which need a frontier one, see Which model for which coding task. Try a new model in Codex or Claude Code without another API key covers other providers.
Questions
Why doesn't /effort change anything with MiniMax?
Because CLAUDE_CODE_EFFORT_LEVEL is set in the env block, and MiniMax's guide says /effort has no effect while it is. Remove that line to change effort in a session. MiniMax supports low, medium, high, xhigh and max.
Why compact at 512K when MiniMax reads 1M tokens?
MiniMax says its own ProgramBench run scored about the same at 512K as at 1M, at about 20% lower cost, so its guides compact at 524,288 tokens (MiniMax: Codex). Raise CLAUDE_CODE_AUTO_COMPACT_WINDOW or model_context_window if a task needs more of the window.
Does my Claude plan pay for MiniMax in Claude Code?
No. With ANTHROPIC_AUTH_TOKEN set, Claude Code sends your MiniMax key in place of your claude.ai login, so the requests count against your MiniMax account (Anthropic docs). Delete the keys from the env block to go back to your plan.