# Run MiniMax M3.1 Flash Inside Claude Code: Setup and Costs

> Source: <https://www.digitalapplied.com/blog/run-minimax-m3-1-flash-inside-claude-code-setup>
> Published: 2026-10-19 00:00:00+00:00

Claude Code sends its requests in Anthropic's API format, and it can send them to a different address. MiniMax runs an Anthropic-compatible endpoint and publishes a [Claude Code setup guide](https://platform.minimax.io/docs/m-plan/claude-code) that points it at M3.1 Flash, the model MiniMax released on October 19, 2026. You keep Claude Code's file editing, terminal tools, slash commands and subagents, and the model doing the work becomes MiniMax's, at $0.15 per million input tokens and $0.60 per million output on pay-as-you-go.

We have covered this pattern before with [GLM-5.2 inside Claude Code](https://www.digitalapplied.com/blog/run-glm-5-2-inside-claude-code-setup-guide). What is different here is the model: a brand-new, cheap model with image and video input and a one-million-token context, which we cover in [our M3.1 Flash release post](https://www.digitalapplied.com/blog/minimax-m3-1-flash-price-benchmarks-release).

Everything below comes from MiniMax's and DeepSeek's own setup documentation, read on October 19. Settings files change between releases, so treat the vendor's page as the source for exact key names.

1. 01One base URL changes the model.Pointing Claude Code at https://api.minimax.io/anthropic with your Subscription Key, and setting the model names to MiniMax-M3.1-Flash[1m] in the settings file (or MiniMax-M3.1-Flash with Declare 1M in CC Switch), does the switch. MiniMax offers a wizard, a settings file and a provider tool to do it.
2. 02Set the 512K compaction window.MiniMax recommends CLAUDE_CODE_AUTO_COMPACT_WINDOW=524288, so Claude Code compacts long sessions at 524,288 tokens (512K) rather than running to the full 1M window.
3. 03Check with /status and /model.MiniMax's guide says /status should show the MiniMax base URL and /model should show MiniMax-M3.1-Flash. If either still says Claude, you are still paying Anthropic.
4. 04Subscription or metered.M Plan, billed annually from $220 a year, includes M3.1 Flash with 5-hour and weekly usage windows. Pay-as-you-go is $0.15 input and $0.60 output per million tokens.
5. 05DeepSeek works the same way.DeepSeek documents an equivalent setup and maps Claude model names to its own models. Its web search through Claude Code starts billing at 16:00 UTC on October 31.

## 01 — WhyWhy run it inside *Claude Code*.

A coding agent is two things: the harness, which reads files, runs commands, manages context and asks for permission, and the model that decides what to do. Claude Code is a harness many teams already know well, with their own `CLAUDE.md` files, skills, hooks and habits built around it. Swapping the model behind it keeps all of that and changes the bill.

The use case is cost on volume. Background tasks, test writing, refactors across many files and long exploratory sessions burn tokens fast. Running those on a model at $0.15 and $0.60 per million, while keeping a Claude model for the hardest work, is a reasonable split. OpenRouter's public usage page for M3.1 Flash's free route listed Claude Code among the apps sending it the most traffic on launch day, so the pattern is already in use.

The failure case is expecting the same results. The harness stays the same; the judgement inside it does not. A cheaper model may take more steps, misread a tool result or stop early on work a Claude model would finish. Treat the switch as a trial on real tasks, not a drop-in replacement.

## 02 — SetupThree ways to *set it up*.

MiniMax's guide offers three routes. All three end with Claude Code sending requests to MiniMax's Anthropic-compatible endpoint with an M Plan subscription key.

##### Setup *wizard*

Run npx -y mmx-cli@latest agent setup and select Claude Code. It runs Claude Code's official installer if needed, checks the installed version, updates ~/.claude/settings.json and adds MiniMax's model list. Fastest for a single machine.

##### Edit the settings file

Clear any exported ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL, add MiniMax's base URL, your Subscription Key, the model names and the compaction window to Claude Code's user settings, then run claude and select Trust This Folder. Best when you want every value visible in one file; keep the key out of version control.

##### CC Switch

Add the MiniMax preset with your key, set all model names to MiniMax-M3.1-Flash, select Declare 1M, add the compaction setting and enable. Best when you switch between providers often.

The example that suits most teams: use the wizard on one machine to see a working configuration, then copy the resulting settings, minus the key, into your team's managed settings so everyone runs the same configuration with their own key; MiniMax's FAQ says not to share a Subscription Key and describes the M Plan as built for individual use. The failure case is three developers each configuring it differently and comparing results from three different setups.

## 03 — SettingsThe settings that *matter*.

Whichever route you take, four values do the work. First, clear any `ANTHROPIC_AUTH_TOKEN` and `ANTHROPIC_BASE_URL` already exported in your shell: MiniMax's guide says they take priority over the settings file and tells you to remove them from `~/.bashrc` or `~/.zshrc` too. Its manual example for `~/.claude/settings.json` follows, with your Subscription Key in place of the placeholder; the table explains what each value changes.

```
unset ANTHROPIC_AUTH_TOKEN
unset ANTHROPIC_BASE_URL
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.minimax.io/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "<MINIMAX_API_KEY>",
    "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "524288",
    "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]"
  }
}
```

| Source: MiniMax Claude Code setup guide and its verification steps, read October 19, 2026. Settings-file keys are in MiniMax's manual example above. |  |  | 
|---|---|---|
| Setting | Value | What it does | 
|---|---|---|
| Base URL | https://api.minimax.io/anthropic | Sends Claude Code's requests to MiniMax instead of Anthropic | 
| API key | M Plan subscription key | Authenticates and bills against your MiniMax plan | 
| Model names | MiniMax-M3.1-Flash[1m] | Set for the main model and the Sonnet, Opus and Haiku aliases; the [1m] suffix tells Claude Code the model has a 1M window | 
| Compaction window | CLAUDE_CODE_AUTO_COMPACT_WINDOW=524288 | Summarises long sessions at 512K tokens, MiniMax's recommendation | 

The compaction window deserves a word. Claude Code compacts a long conversation, summarising older turns, when it approaches the model's context limit. M3.1 Flash has a one-million-token context, but MiniMax recommends compacting at 524,288 tokens (512K) rather than running to the full window, and links to its own guidance on why. The [1m] suffix on the model names matters too: Anthropic's documentation says Claude Code assumes a 200K window for a model ID it does not recognise and caps the auto-compact window at the model's context window, so without the suffix the 512K setting is likely to stop at 200K. Set both deliberately.

Web search is the other gap. MiniMax's guide says to add web search through its own Web Search MCP server, so if your workflow relies on Claude Code searching the web, install that server as part of the setup rather than discovering the gap mid-task.

## 04 — VerifyCheck it is really *MiniMax*.

MiniMax's guide gives two checks to run inside Claude Code after starting it. `/status` should show the base URL pointing to `api.minimax.io/anthropic`. `/model` should show the active model as `MiniMax-M3.1-Flash`.

Run both every time you change settings, and again after a Claude Code update. The failure case is subtle and expensive: a settings file that is not picked up, an environment variable that overrides it, or a project-level setting that takes precedence, leaving Claude Code quietly sending requests to Anthropic on your Anthropic account while you believe you are on MiniMax. Thirty seconds with two commands prevents a surprise bill on the wrong account.

## 05 — CostM Plan or pay as you *go*.

MiniMax offers two ways to pay. The [M Plan](https://platform.minimax.io/docs/m-plan/intro) is a subscription for individuals with three tiers, all including M3.1 Flash as the text model and an API key for coding tools. The alternative is metered API use at the standard price list.

| Sources: MiniMax M Plan page (annual billing) and API pricing page, read October 19, 2026. M Plan usage is limited by 5-hour and weekly windows. |  |  | 
|---|---|---|
| Option | Price | Usage | 
|---|---|---|
| M Plan Go | $220 / year | Base usage; light use | 
| M Plan Explore | $550 / year | 3× Go; adds the H3 video model | 
| M Plan Build | $1,320 / year | 7.5× Go; heavy use | 
| Pay as you go | $0.15 / $0.60 | Per million input / output tokens; cached input $0.015 | 

The plans are not unlimited. MiniMax's M Plan FAQ says text, image and audio models share one usage allowance with a 5-hour window and a weekly window, both starting from your first use, and that rate limits may tighten during peak traffic. Multi-step agent tasks, which is what Claude Code runs, use far more of the allowance than single questions.

The decision is the usual one: a subscription suits steady individual use, metered billing suits teams and spiky workloads, and MiniMax's FAQ recommends pay-as-you-go for production. A useful test is a week on pay-as-you-go with spend tracked, using a standard API key in place of the Subscription Key, since MiniMax says the two are not interchangeable. Then compare it with the plan that would have covered it: the Go tier's $220 a year works out to about $4.23 a week, so if a week of real Claude Code work costs less than that metered, the plan buys convenience rather than savings.

## 06 — Trade-offsWhat changes in *Claude Code*.

Claude Code's interface stays the same, but some of what sits behind it is Anthropic's, not the harness's. Features that depend on Anthropic's own API or servers, such as Anthropic-hosted tools, its prompt caching behaviour or model-specific options, may behave differently or not at all when the endpoint is a third party's. Anthropic's documentation names two: with the base URL pointing at a host other than Anthropic's, MCP tool search is off by default and Remote Control is disabled. DeepSeek's documentation, for example, lists Anthropic request fields it ignores, including MCP server definitions passed in the request and some sampling options.

Your data also goes somewhere new. Every file Claude Code reads into context is sent to MiniMax's API instead of Anthropic's. Check MiniMax's terms and where it processes data before using it on client code or anything covered by a confidentiality agreement. Anthropic's commitments for Claude Code users do not travel with your requests to another provider.

Finally, your `CLAUDE.md` files and skills were probably written with a Claude model in mind. Most instructions transfer, but phrasing tuned to one model's habits may not suit another. Our [guide to Claude Code subagent limits and budget caps](https://www.digitalapplied.com/blog/claude-code-subagent-depth-limits-budget-caps-2026) is a good reminder of the settings worth revisiting when the model underneath changes.

## 07 — AlternativeThe DeepSeek *alternative*.

DeepSeek documents the same pattern in its [Claude Code integration guide](https://api-docs.deepseek.com/quick_start/agent_integrations/claude_code). You set environment variables for the base URL, `https://api.deepseek.com/anthropic`, your DeepSeek API key and the model names. DeepSeek's example sets the main, Opus and Sonnet names to `deepseek-flash[1m]`, the Haiku and subagent names to `deepseek-flash`, the effort level to max and the auto-compact window to 786,432 tokens. DeepSeek also maps Claude model names it receives: names starting with claude-opus go to its V4 Pro model, billed at the Pro price, and claude-sonnet or claude-haiku names go to `deepseek-flash`, which is now V4.1 Flash 1017.

The difference that matters this month is web search. DeepSeek says its API natively supports Claude Code's web search tool, running the search through DeepSeek's own Search API. Those server-side calls are free until 16:00 UTC on October 31, then billed at $0.75 per 1,000 successful calls, and DeepSeek notes that summarising the results adds model token costs on top. We cover the details in [our DeepSeek V4.1 Flash 1017 post](https://www.digitalapplied.com/blog/deepseek-v4-1-flash-1017-search-api-october-31).

##### Screenshots, recordings, UI work

M3.1 Flash reads video as well as images. DeepSeek's Flash reads images. Pick MiniMax if your agent works from recordings.

##### Claude Code searching the web

DeepSeek runs Claude Code's search natively, billed from October 31. MiniMax needs its Web Search MCP server added.

##### Flat price, any time

MiniMax is flat. DeepSeek doubles in weekday peak windows, and an opus-named request bills at the Pro price.

##### A self-hosting fallback

DeepSeek's weights are MIT-licensed today; MiniMax's are promised later.

## 08 — JudgementWhen to switch *back*.

The most useful setup is not all-or-nothing. Keep a Claude configuration and a MiniMax configuration side by side, with CC Switch or two settings profiles, and choose per task. Route test writing, mechanical refactors, documentation and exploratory reading to the cheap model. Keep architectural changes, security-sensitive code and anything where a wrong step is expensive on the model you trust most.

Watch two signals during a trial week. If the cheaper model needs noticeably more turns or more of your corrections to finish the same kind of task, the per-token saving is being spent on your time. If it finishes cleanly at a fraction of the cost, move more work over. If you want help setting up a mixed-model Claude Code workflow for a team, with shared settings and cost tracking, that is part of our [AI transformation work](https://www.digitalapplied.com/services/ai-transformation).

## 09 — ConclusionKeep the harness, *test the model*.

### Set up a second Claude Code profile on MiniMax, confirm it with /status and /model, run a week of routine tasks on it, and compare turns and spend with your Claude profile.

MiniMax documents three routes to run M3.1 Flash inside Claude Code, all pointing it at MiniMax's Anthropic-compatible endpoint with the model names set to M3.1 Flash with a 1M window (MiniMax-M3.1-Flash[1m] in the settings file) and a recommended 512K compaction window. Two slash commands confirm the switch worked.

It costs $0.15 input and $0.60 output per million tokens metered, or an M Plan from $220 a year with 5-hour and weekly usage windows. Thinking stays on, data goes to MiniMax, and some Anthropic-specific features may not carry over. DeepSeek offers the same pattern with native web search that starts billing on October 31.

The harness you know stays the same. Whether the cheaper model earns its place is a question for a week of your own tasks.
