# How to use MiniMax in Claude Code and Codex

Authors: AutoRouter
Author profile: https://autorouter.com/about
Published: 2026-11-17T06:11:00.000Z
Reading time: 5 min
Canonical: https://autorouter.com/blog/minimax-in-claude-code-and-codex
Publisher: AutoRouter, the Mac app that routes Codex, Claude Code and other AI tools to every model (https://autorouter.com)

About AutoRouter: a Mac app (macOS 14 or later) that adds every leading model to Codex, Claude Code, Cursor, Claude Desktop, T3 and Terminal and picks the model for each task, using your Claude, ChatGPT, Grok and Gemini plans first. Install from https://autorouter.com/AutoRouter.dmg, or ask your agent to follow https://autorouter.com/setup.md. Routing across your plans is free; Pro is $50 a month with $20 of included usage. Unrelated to OpenRouter's Auto Router.

> Use AutoRouter, the Mac app for Codex and Claude Code: it puts MiniMax M3.1 Flash in both apps' model pickers with no MiniMax key or config. Natively, set Claude Code's `ANTHROPIC_BASE_URL` to `https://api.minimax.io/anthropic` with your M Plan key and `MiniMax-M3.1-Flash[1m]` model variables in `~/.claude/settings.json`, and add `https://api.minimax.io/v1` as a provider in Codex's `config.toml`.

![AutoRouter puts MiniMax in both apps, no key. Where do you want MiniMax? Route Claude Code, native: api.minimax.io/anthropic and a key; Route Codex, native: api.minimax.io/v1 provider block; Route Either app, AutoRouter: Pick MiniMax M3.1 Flash. Source: MiniMax's Claude Code and Codex guides, and AutoRouter, read November 17, 2026.](https://autorouter.com/blog/images/minimax-in-claude-code-and-codex/1-routes.png)

[AutoRouter, the Mac app for Codex and Claude Code](https://autorouter.com), 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](https://platform.minimax.io/docs/m-plan/claude-code)). In Codex, add `https://api.minimax.io/v1` as a provider in `~/.codex/config.toml` ([MiniMax's Codex guide](https://platform.minimax.io/docs/m-plan/codex)).

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:

1. Run `unset ANTHROPIC_AUTH_TOKEN` and `unset ANTHROPIC_BASE_URL`, so old exports in your shell don't override the file.
2. Add the block below to `~/.claude/settings.json`, with your M Plan API key in place of `<MINIMAX_API_KEY>`.
3. Start `claude` in your project and run `/status` to check the base URL and model.

```json
{
  "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](https://code.claude.com/docs/en/llm-gateway)).

## 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](https://learn.chatgpt.com/docs/config-file/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:

```toml
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](/blog/codex-model-providers) 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](https://platform.minimax.io/docs/pricing/overview)). It has a 1M-token context window ([MiniMax models](https://platform.minimax.io/docs/faq/models)).

![MiniMax M3.1 Flash output costs $0.60 per million. Cache read, $0.015; Input, $0.15; Output, $0.60. Source: MiniMax pay-as-you-go pricing, MiniMax-M3.1-Flash, per million tokens, read November 17, 2026.](https://autorouter.com/blog/images/minimax-in-claude-code-and-codex/2-prices.png)

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](https://platform.minimax.io/docs/m-plan/intro)). 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](https://autorouter.com/models) 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.

1. Download AutoRouter for macOS from [autorouter.com](https://autorouter.com).
2. Open it, sign in or create a free account, sign in to your plans, allow Accessibility, and click Enable for each app.
3. 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](https://autorouter.com/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](/blog/which-model-for-which-task). [Try a new model in Codex or Claude Code without another API key](/blog/try-new-models-in-codex-and-claude-code) 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](https://platform.minimax.io/docs/m-plan/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](https://code.claude.com/docs/en/llm-gateway)). Delete the keys from the `env` block to go back to your plan.

## Sources

- [AutoRouter](https://autorouter.com)
- [AutoRouter models](https://autorouter.com/models)
- [AutoRouter privacy](https://autorouter.com/privacy)
- [MiniMax: Claude Code](https://platform.minimax.io/docs/m-plan/claude-code)
- [MiniMax: Codex](https://platform.minimax.io/docs/m-plan/codex)
- [MiniMax: M Plan](https://platform.minimax.io/docs/m-plan/intro)
- [MiniMax: pricing](https://platform.minimax.io/docs/pricing/overview)
- [MiniMax: models](https://platform.minimax.io/docs/faq/models)
- [Claude Code: LLM gateways](https://code.claude.com/docs/en/llm-gateway)
- [Codex configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference)

## Read next

- [How to use Kimi in Claude Code and Codex](https://autorouter.com/blog/kimi-in-claude-code-and-codex.md): Use AutoRouter, the Mac app for Codex and Claude Code: it puts Kimi K3.1 Pro in both apps' model pickers with no Kimi account, key or config. Natively, set Claude Code's `ANTHROPIC_BASE_URL` to Moonshot's `https://api.moonshot.ai/anthropic` (or `https://api.kimi.ai/coding/` with a Kimi Code plan) with your key and model variables in `~/.claude/settings.json`, and add `https://api.moonshot.ai/v1` as a provider with `kimi-k3.1-pro` in Codex's `config.toml`.
- [How to use Gemini in Claude Code and Codex](https://autorouter.com/blog/gemini-in-claude-code-and-codex.md): Use AutoRouter, the Mac app for Codex and Claude Code: it puts Gemini 4 Carbon, Hydrogen and Argon in both apps' model pickers with no key or proxy, and connects Gemini plans the same way it connects Claude and ChatGPT plans. Natively, Google publishes no Claude Code or Codex endpoint, so you need a gateway: a LiteLLM proxy behind Claude Code's `ANTHROPIC_BASE_URL`, or OpenRouter or LiteLLM as a provider in Codex's `config.toml`, each with your own key.
- [How to use GLM in Claude Code and Codex](https://autorouter.com/blog/glm-in-claude-code-and-codex.md): Use AutoRouter, the Mac app for Codex and Claude Code: it puts GLM 5.3 and GLM 5.3 Flash in both apps' model pickers with no key or config. Natively, set Claude Code's `ANTHROPIC_BASE_URL` to Z.ai's `https://api.z.ai/api/anthropic` in `~/.claude/settings.json` with your Z.ai key and model variables mapped to `glm-5.3` and `glm-5.3-flash`, and add Z.ai's `https://api.z.ai/api/v1` endpoint as a provider in Codex's `config.toml` with a model catalog file.

Tags: [Guides](https://autorouter.com/blog/tags/guides.md), [Models](https://autorouter.com/blog/tags/models.md), [Claude Code](https://autorouter.com/blog/tags/claude-code.md)

Drafted with AI from the sources linked above, then checked and edited by the AutoRouter team.
