Large Language Models

Running MiniMax M3.1 Flash on Claude Code CLI

Published 2026-10-31. Last modified 2026-11-15.
Time to read: 7 minutes.

This page is part of the llm collection.

MiniMax-M3.1 Flash Review discusses the MiniMax M2.x and M3.x LLMs in general. This article provides a sample configuration for MiniMax M3.1-Flash that you can use to quickly get this working. That sample configuration does not contain any credentials. This article shows you how to provide credentials.

By default, Claude Code keeps its settings, transcripts, history and plugins in ~/.claude. I defined the CLAUDE_CONFIG_DIR environment variable to tell Claude CLI to use a different configuration directory, ~/.minimax_public.

Anthropic sessions do not know
that MiniMax exists, and vice-versa

Why a Separate Configuration Directory

The structure of a Claude configuration directory tree includes:

  • settings.json — the user settings file
  • .claude.json — account details, per-project trust decisions, global configuration
  • CLAUDE.md — your global instructions
  • projects/ — session transcripts, one subdirectory per project
  • history.jsonl — command history
  • plugins/, skills/, agents/, tasks/, plans/, shell-snapshots/, file-history/, debug/

Project-scoped files are not relocated. .claude/settings.json, .claude/settings.local.json, .claude/CLAUDE.md and .mcp.json are always read from the project directory. An Anthropic session and a MiniMax session working in the same project still share .claude/settings.local.json. More on this below.

The Directory Layout

This is what ~/.minimax_public looks like:

~/.minimax_public/
  ├── settings.json      endpoint, model, permissions
  ├── .claude.json       written by Claude Code on first run
  ├── projects/          transcripts, one subdirectory per project
  └── history.jsonl      command history

Only the first file is authored by hand. The rest are created on their own as you use Claude Code.

Installing and Authenticating

Create the directory:

Shell
$ mkdir ~/.minimax_public

Put your MiniMax API token in a file that lives outside that directory, and make sure only you can read it:

~/.minimax/token
$ mkdir -p ~/.minimax
$ touch ~/.minimax/token
$ chmod 600 ~/.minimax/token

The token is a 695-character JWT, the same string MiniMax hands out when you subscribe to a coding plan. You need to somehow copy the token into ~/.minimax/token.

Define two aliases that launche Claude Code with the MiniMax configuration directory, injecting the token into the environment for that one command.

  • minimaxh - Enforce /effort high at all times
  • minimax_ - Enable /effort command
~/.bash_aliases entry
# Disallow /effort slash command and enforce effort level high:
alias minimaxh='CLAUDE_CODE_EFFORT_LEVEL=high ANTHROPIC_AUTH_TOKEN="$(cat ~/.minimax/token)" CLAUDE_CONFIG_DIR=~/.minimax_public claude'

# Allow /effort slash command:
alias minimax_='CLAUDE_CODE_EFFORT_LEVEL= ANTHROPIC_AUTH_TOKEN="$(cat ~/.minimax/token)" CLAUDE_CONFIG_DIR=~/.minimax_public claude'

Now type minimax at a command prompt.

Using the alias in this way confines the token to this single invocation. Any previous value of export ANTHROPIC_AUTH_TOKEN is temporarily ignored.

After MiniMax prepared a plan, I asked what effort level I should use for each step. It game me an informative answer:

Shell
Effort recommendation: high for this session, with two cheaper stretches.

┌────────────────────────┬────────┬──────────────────────────────────────────────────────────────────────────┐
│          Step          │ Effort │                                     Why                                  │
├────────────────────────┼────────┼──────────────────────────────────────────────────────────────────────────┤
│ 1. Stale citations     │ low    │ Mechanical: find the string, fix the string.                             │
├────────────────────────┼────────┼──────────────────────────────────────────────────────────────────────────┤
│ 2. One name of a track │ low    │ Four copies, one implementation.                                         │
├────────────────────────┼────────┼──────────────────────────────────────────────────────────────────────────┤
│ 3. Model/serializer    │ high   │ 8 model classes, the number of every track, 3 cross-references. A wrong  │
│ boundary               │        │ number in the report is subtle and expensive to find later.              │
├────────────────────────┼────────┼──────────────────────────────────────────────────────────────────────────┤
│ 4. The verdict holds   │ medium │ The model's API changes; the specs pin the sentences.                    │
│ facts                  │        │                                                                          │
├────────────────────────┼────────┼──────────────────────────────────────────────────────────────────────────┤
│ 5. Model corrections   │ low    │ group?, an unused parameter, an unused ivar.                             │
├────────────────────────┼────────┼──────────────────────────────────────────────────────────────────────────┤
│ 6. The conversion      │ medium │ Correctness in a transformation; specs exist both ways.                  │
│ FIXMEs                 │        │                                                                          │
├────────────────────────┼────────┼──────────────────────────────────────────────────────────────────────────┤
│ 7. The commands        │ medium │ als_to_xsd becomes a library; one command is deleted.                    │
├────────────────────────┼────────┼──────────────────────────────────────────────────────────────────────────┤
│ 8. The documentation   │ high   │ 60% is stale, and the prose is the deliverable. Medium effort is what    │
│                        │        │ produced the prose you just criticized.                                  │
└────────────────────────┴────────┴──────────────────────────────────────────────────────────────────────────┘

On /effort medium it MiniMax is more likely to ignore instructions and do something else. High effort is a bit more trustworthy, but is significantly more expensive. This is where MiniMax is non-competitive. The product's behavior is more random at lower effort settings. Not only is it less capable, but MiniMax is also less trustworthy at lower effort settings.

MiniMax gets very disobedient as its context window fills up.

Plugin

I also installed the frontend-design@claude-plugins-official plugin:

Claude Code session
> /plugin install frontend-design@claude-plugins-official

settings.json

No credentials are set in the configuration file.

Do not attempt to set ANTHROPIC_API_KEY in the configuration file. ANTHROPIC_AUTH_TOKEN is sent as Authorization: Bearer and ANTHROPIC_API_KEY is sent as x-api-key. Do not attempt to set both at the same time.

Here is the whole starter file. Some tweaks are discussed next.

~/.minimax_public/settings.json
{
  "autoConnectIde": false,
  "autoUpdatesChannel": "stable",
  "enabledPlugins": {
    "gopls-lsp@claude-plugins-official": true
  },
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.minimax.io/anthropic",
    "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]",
    "CLAUDE_CODE_MAX_OUTPUT_TOKENS": "64000",
    "DISABLE_TELEMETRY": "1",
    "DISABLE_ERROR_REPORTING": "1"
  },
  "model": "minimax-m3.1-flash[1m]",
  "outputStyle": "Default",
  "permissions": {
    "allow": [
      "Bash(git status:*)",
      "Bash(git diff:*)"
    ],
    "defaultMode": "bypassPermissions"
  },
  "skipDangerousModePermissionPrompt": false,
  "tui": "default"
}

Key Notes

  • ANTHROPIC_BASE_URL — MiniMax’s Anthropic-compatible endpoint. The global platform is api.minimax.io; the China platform is api.minimaxi.com.
  • ANTHROPIC_MODEL — the model, with the [1m] suffix. That suffix is doing real work. I explain it below.
  • ANTHROPIC_DEFAULT_SONNET_MODEL and its Opus and Haiku siblings do not choose the model. They define what the aliases sonnet, opus and haiku resolve to. Pointing all three at the same model means /model sonnet cannot land on an Anthropic model with a 200,000-token window.
  • autoConnectIde is a global configuration setting that controls whether Claude automatically links to a running VS Code or JetBrains IDE when you start a session from a standalone terminal (like iTerm2, Windows Terminal, or Ghostty). I enable this feature, but it is disabled above because some people might find this setting confusing.
  • autoUpdatesChannel keeps your Claude Code software updated. I use stable updates because I do not want to work on the bleeding edge.
  • CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC suppresses telemetry, update checks and remote feature flags. It cuts startup latency, and it keeps Anthropic-specific traffic out of a session that is not talking to Anthropic.
  • enabledPlugins — plugins are installed under the configuration directory too, so enabling one here does not enable it for my Anthropic sessions.
  • model is the model for new sessions when neither the command line nor the environment says otherwise. I keep it identical to ANTHROPIC_MODEL for the reason described below.
  • The new Claude Code fullscreen renderer solves screen flickering and long-session memory bloat, but it comes with several well-documented problems. The most aggregious problem is that scrollback is disabled, which means you cannot view an entire response. Other issues include broken copy/paste and Windows terminal problems. The settings.json file shown above sets "tui": "default" so you are not prompted to use this problematic feature.

Permissions and Approval Modes

defaultMode

Claude Code asks permission before it edits a file or runs a command. The permissions.defaultMode key chooses the mode that new sessions start in:

  • default — ask for everything.
  • acceptEdits — file edits are approved automatically; commands still prompt. A reasonable middle ground.
  • plan — research and plan, without touching anything.
  • bypassPermissions — nothing prompts. The agent edits files and runs commands without asking.

bypassPermissions means the agent can do anything you can. I use it because I want to see what MiniMax does without answering a prompt every thirty seconds. Think hard about using this setting without a backup before you point Claude Code at a directory you care about.

As of Claude Code v2.1.123, this setting is only honored in the user settings file; if this setting occurs in a project or local settings file it will be ignored. To disable bypassPermissions, set permissions.disableBypassPermissionsMode to disable. At the other extreme, enabling skipDangerousModePermissionPrompt will suppress the confirmation dialog for the current and future sessions.

allow

The permissions.allow list holds the rules for commands that never need permission to run. A rule is a command name, optionally followed by a specifier:

  • Bash allows every Bash command.
  • Bash(npm run build) allows only that exact command.
  • Bash(npm run *) specifies an allowed prefix.

Configuration Tweaking With Slash Commands

You can use Claude Code slash commands to modify the configuration; this is more convenient than editing config files by hand. Most configuration slash commands persist across sessions. Some configuration items can be scoped globally or only to the current project. Here are a few slash commands that you might want to experiment with:

/config
Writes most options to ~/.claude/settings.json (global), global config options like copyFullResponse to ~/.claude.json, and project-specific options to .claude/settings.local.json. /config displays the same header as /status but does not allow you to view status, usage or statistics. Think of it as a shortcut to a subset of the /status command.
/model
Saves the selected model as the global default in ~/.claude/settings.json.
/output-style
Saves the selection to .claude/settings.local.json for the current project. To make it persist globally across all projects, add outputStyle to ~/.claude/settings.json.
/permissions
Saves allow/deny rules to your local or user settings.json files.
/status
Displays session status, configuration, usage, and statistics.

Context Window

The /context slash command displays the context window usage.

Run /context every 20 minutes or whenever MiniMax slows down, starts asking stupid questions, becomes disobedient, or its behavior changes (for example, if it stops providing recaps.)

If you see the context window is filling up, run /compact (this is an expensive and slow operation), or start a new chat session.

The above image shows the /context output; the chat session has used 66% of its 1-million-token context window (662.6k / 1m tokens), leaving 300.9k tokens (30.1%) of free space before hitting the 33k-token (3.3%) autocompact buffer.

Because 639.5k tokens are tied up in messages, there is plenty of room (~300.9k tokens) to continue working. However, before starting an unrelated task, run /compact or /clear to free up that space, or (my preference) exit Claude Code and start a new chat session.

1M Token Context Window

Claude Code determines a model’s context window size from its name. For any unrecognized model, it defaults to 200,000 tokens and warns you:

Model "minimax-m3.1-flash" isn't recognized · context assumed to be 200k tokens

Although MiniMax M3.1 Flash supports a much larger window, Claude Code caps it at 200k tokens because the model name is unrecognized. Before fixing this, auto-compaction was triggering just below that limit (peaking at 166,329 tokens in my session transcripts).

To unlock the 1,000,000-token window, append [1m] to the model ID (minimax-m3.1-flash[1m]). When Claude Code sees the [1m] suffix, it raises the context limit to 1,000,000 tokens, adds the context-1m beta header, and strips the suffix before sending the request—so MiniMax still receives the minimax-m3.1-flash model ID.

Claude Code exposes several settings related to context size and compaction, though only one raises the default 200k cap. Here are two settings to be aware of:

  • [1m] suffix on the model ID — raises the context window to 1,000,000 tokens. The [1m] suffix only changes Claude Code’s client-side limit; it does not change what the MiniMax API accepts.
  • CLAUDE_CODE_AUTO_COMPACT_WINDOW — sets the token threshold where auto-compaction triggers. It can only lower the effective window, never raise it above the model’s limit.

Which Model Is Actually Running?

There are three ways to specify a model for Claude Code, and their priority is:

  1. The --model command line flag.
  2. The ANTHROPIC_MODEL environment variable.
  3. The model key in a settings file.

Use /status to see the selected model.

The First Run

A brand new configuration directory triggers the onboarding wizard once: it asks about your theme and about terminal setup. After that it does not ask again. The wizard writes its answers into the new directory, so my Anthropic configuration is untouched.

Claude Code also keeps .claude.json in the configuration directory, holding account details and per-project trust decisions. The MiniMax directory has never seen my projects, so it has no trust decisions for them. I am asked to trust a project the first time I work in it with MiniMax.

Conclusion

The Claude Code CLI is a much better harness than Mini-Agent. MiniMax’s Anthropic-compatible endpoint allows an agentic coding harness designed for Anthropic products to work with MiniMax models. This article shows how to set up a configuration for Claude Code to work with MiniMax M3.1 flash model without affecting the configuration for Anthropic models.

References

* indicates a required field.

Please select the following to receive Mike Slinn’s newsletter:

You can unsubscribe at any time by clicking the link in the footer of emails.

Mike Slinn uses Mailchimp as his marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp’s privacy practices.