How to Use MiniMax M3.1 Flash: API Setup, Effort Levels, Tool Calls and Claude Code
Read time: ~11 minutes.
Key facts:
- MiniMax released M3.1 Flash on October 19, 2026. MiniMax says the anonymous “Space Bunny” model, which processed more than 200 trillion tokens, was an early version of it (MiniMax blog).
- Model ID
MiniMax-M3.1-Flash. Two endpoints:https://api.minimax.io/anthropic(Anthropic-compatible, recommended by MiniMax) andhttps://api.minimax.io/v1(OpenAI-compatible). 1,000,000-token context, text, image and video input (MiniMax model docs).- Price: $0.15 input, $0.60 output, $0.015 cached input per 1M tokens, half of MiniMax-M3’s standard-tier input and output prices (MiniMax pricing).
- Thinking is always on. You tune it with
effort(low,medium,high,xhigh,max), and the default ismax. Trying to disable thinking returns HTTP 400.- Weights are not out yet. MiniMax’s post says “Model weights will be released later” and gives no date.
What we checked: we read MiniMax’s launch post, model guide, both API references, the tool-use guide, the Claude Code guide, the rate-limit page and the pricing page. We installed the current
anthropic(1.15.0) andopenai(3.35.1) Python SDKs and confirmed theircreate()methods acceptoutput_configandreasoning_effort. We sent unauthenticated requests to both MiniMax endpoints to record the exact 401 errors, and confirmed via OpenRouter’s public models API thatminimax/minimax-m3.1-flash:freeis listed. We did not run paid generations, so every benchmark and speed number below is MiniMax’s own.
If you build agents, the interesting part of M3.1 Flash is the price-to-capability ratio: MiniMax claims agent-grade results (73.7% on DeepSWE v1.1, 61.7 on OSWorld V2, 82% on CyberGym) at $0.60 per million output tokens. The catch is that it always thinks, so every call spends reasoning tokens unless you turn the effort down. This guide shows you how to get the first request working, pick the right effort level, keep multi-step tool calls from breaking, and run it inside Claude Code.
If you used the previous model, our MiniMax M3 guide covers M3’s API and local setup; most of it carries over. For other budget-tier options, see the Gemini 3.6 Flash guide and our Mercury 3 tutorial. More builder guides are on the 7minai homepage.
1. What M3.1 Flash is, and how it differs from M3
All figures below are from MiniMax’s launch post, model guide and API reference.
| MiniMax-M3.1-Flash | MiniMax-M3 | |
|---|---|---|
| Released | Oct 19, 2026 | Jun 1, 2026 |
| Context window | 1,000,000 tokens | 1,000,000 tokens |
| Input | Text, image, video | Text, image, video |
| Max output (OpenAI endpoint) | 524,288 tokens (131,072 recommended) | 524,288 tokens (131,072 recommended) |
| Thinking | Always on, tune with effort | Can be turned off |
effort / reasoning_effort | low to max, default max | Ignored |
Priority tier (service_tier) | Not supported | Supported, 1.5x price |
| Price per 1M tokens (in / out / cached) | $0.15 / $0.60 / $0.015 | $0.30 / $1.20 / $0.06 (≤512K input, standard tier) |
MiniMax’s headline benchmark claims, all self-reported:
- Coding: 73.7% on DeepSWE v1.1.
- Computer use: 61.7 on OSWorld V2 and 29.6 on Agents’ Last Exam (ALE). MiniMax says both rank first among Chinese models.
- Agentic work: 76.2 on BankerToolBench and “among the top performers” on AutomationBench-AA.
- Security: 82% on CyberGym.
- Speed: “200+ TPS” output in everyday use, with median (P50) speeds “consistently reaching 170+ TPS.”
MiniMax also says overall usage cost on agentic tasks is 70% lower than its predecessor and online inference is “nearly three times faster.” Treat those as vendor numbers; the per-token price halving is the part you can verify on the pricing page.
When to pick it: agent loops, coding agents and tool-heavy workflows where you make many calls and cost per call matters. When to think twice: latency-sensitive chat where you can’t afford any reasoning tokens. Thinking can’t be turned off, only reduced.
2. Get an API key
- Sign in at platform.minimax.io.
- MiniMax’s docs link to the subscription key page for the key. Copy it.
- If you’re paying as you go, add balance from the recharge page.
- Export it so the examples below can read it:
export MINIMAX_API_KEY="paste-your-key-here"
The same model is also offered through MiniMax’s M Plan subscription and its MiniMax Code desktop app (launch post). This guide sticks to the API.
3. Your first request
MiniMax accepts both Anthropic-style and OpenAI-style requests. It recommends the Anthropic-compatible route because it “supports thinking blocks, interleaved thinking, and other advanced features” (model guide). Use whichever SDK your code already uses.
Option A: Anthropic-compatible (recommended)
With curl:
curl https://api.minimax.io/anthropic/v1/messages \
-H "Authorization: Bearer $MINIMAX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "MiniMax-M3.1-Flash",
"output_config": {"effort": "medium"},
"max_tokens": 4096,
"messages": [
{"role": "user", "content": "Explain idempotency keys in two sentences."}
]
}'
With the Python SDK (pip install anthropic):
import os
import anthropic
client = anthropic.Anthropic(
base_url="https://api.minimax.io/anthropic",
api_key=os.environ["MINIMAX_API_KEY"],
)
message = client.messages.create(
model="MiniMax-M3.1-Flash",
output_config={"effort": "medium"},
max_tokens=4096,
messages=[{"role": "user", "content": "Explain idempotency keys in two sentences."}],
)
for block in message.content:
if block.type == "thinking":
print("Thinking:\n", block.thinking)
elif block.type == "text":
print("Answer:\n", block.text)
The response comes back as content blocks. thinking blocks hold the reasoning and text blocks hold the answer.
MiniMax’s SDK page also shows an environment-variable setup, which lets you call anthropic.Anthropic() with no arguments (Anthropic SDK page):
export ANTHROPIC_BASE_URL=https://api.minimax.io/anthropic
export ANTHROPIC_API_KEY=$MINIMAX_API_KEY
Option B: OpenAI-compatible
If you’re already on the OpenAI SDK, you only swap the base URL and model:
curl https://api.minimax.io/v1/chat/completions \
-H "Authorization: Bearer $MINIMAX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "MiniMax-M3.1-Flash",
"reasoning_effort": "medium",
"messages": [
{"role": "user", "content": "Explain idempotency keys in two sentences."}
]
}'
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.minimax.io/v1",
api_key=os.environ["MINIMAX_API_KEY"],
)
response = client.chat.completions.create(
model="MiniMax-M3.1-Flash",
reasoning_effort="medium",
messages=[{"role": "user", "content": "Explain idempotency keys in two sentences."}],
)
msg = response.choices[0].message
print("Thinking:", getattr(msg, "reasoning_content", None))
print("Answer:", msg.content)
On this endpoint the reasoning comes back in a separate reasoning_content field, and content holds only the final answer, so you don’t have to strip <think> tags. reasoning_split is the switch that would put thinking back inside content, but M3.1 Flash does not support setting it to false (API reference).
MiniMax also documents an OpenAI Responses-compatible endpoint, where the effort field is reasoning.effort and the output limit is max_output_tokens (model guide).
4. Pick an effort level
This is the setting that most affects your bill and latency. effort accepts low, medium, high, xhigh and max. Higher levels “think more thoroughly and produce more output tokens at higher latency,” and if you omit it, you get max (model guide).
The field name changes by protocol:
| Protocol | Effort field | Where thinking comes back | Output limit field |
|---|---|---|---|
| Anthropic-compatible | output_config.effort | thinking content block | max_tokens |
| OpenAI Chat Completions | reasoning_effort | reasoning_content field | max_completion_tokens (max_tokens is deprecated) |
| OpenAI Responses | reasoning.effort | type: "reasoning" output item | max_output_tokens |
A practical way to choose:
low: classification, extraction, routing, short rewrites. Anything where the answer is obvious.medium: most chat and single-step tool calls. A reasonable default for production.high/xhigh: multi-file code changes, planning steps in an agent loop.max: hard debugging or long reasoning tasks where you’d rather pay for quality.
MiniMax doesn’t publish per-level token counts, so measure on your own prompts: run the same request at low, medium and max and compare usage in the responses.
Set a big enough output limit. On the Anthropic endpoint, “thinking tokens count toward” max_tokens, so a value that’s too small gives you stop_reason: "max_tokens" with no text at all (Anthropic SDK page). On the OpenAI endpoint, MiniMax recommends max_completion_tokens of 131,072 and allows up to 524,288; if you see finish_reason: "length", raise it (API reference).
5. Stream responses
Set "stream": true on either endpoint. With the Anthropic SDK, thinking and text arrive as separate delta types. This is adapted from MiniMax’s own example (Anthropic SDK page):
stream = client.messages.create(
model="MiniMax-M3.1-Flash",
output_config={"effort": "medium"},
max_tokens=4096,
messages=[{"role": "user", "content": "Write a haiku about cache misses."}],
stream=True,
)
for chunk in stream:
if chunk.type == "content_block_delta":
if chunk.delta.type == "thinking_delta":
print(chunk.delta.thinking, end="", flush=True) # reasoning
elif chunk.delta.type == "text_delta":
print(chunk.delta.text, end="", flush=True) # answer
On the OpenAI endpoint, add stream_options: {"include_usage": true} if you want token usage in the stream (API reference).
6. Tool calling without breaking the reasoning chain
M3.1 Flash supports what MiniMax calls interleaved thinking: it reasons between tool calls, looking at each tool result before deciding the next step (tool-use guide). The one rule that matters:
In multi-turn function call conversations, the complete model response (i.e., the assistant message) must be appended to the conversation history to maintain the continuity of the reasoning chain.
In practice:
- OpenAI SDK: append the whole
response_messageobject, includingreasoning_contentandtool_calls, not a rebuilt dict with justcontent. - Anthropic SDK: append the full
response.contentlist, with everythinking,textandtool_useblock, unchanged.
Here’s the OpenAI-style loop, condensed from MiniMax’s guide:
import json, os
from openai import OpenAI
client = OpenAI(base_url="https://api.minimax.io/v1", api_key=os.environ["MINIMAX_API_KEY"])
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather of a location, the user should supply a location first.",
"parameters": {
"type": "object",
"properties": {"location": {"type": "string", "description": "The city and state, e.g. San Francisco, US"}},
"required": ["location"],
},
},
}]
def send(messages):
return client.chat.completions.create(
model="MiniMax-M3.1-Flash", messages=messages, tools=tools,
).choices[0].message
messages = [{"role": "user", "content": "How's the weather in San Francisco?"}]
reply = send(messages)
if reply.tool_calls:
call = reply.tool_calls[0]
args = json.loads(call.function.arguments)
messages.append(reply) # the full message, reasoning included
messages.append({
"role": "tool",
"tool_call_id": call.id,
"content": "24℃, sunny", # call your real tool here
})
final = send(messages)
print(final.content)
Two details from the guide that save debugging time:
- Thinking can be missing. M3.1 Flash “thinks on demand: for simple tool calls, the model may call the tool directly without producing thinking content.” Check that
reasoning_contentor thethinkingblock exists before reading it, and append the message either way. tool_choiceworks on the Anthropic endpoint, along withtools,system,temperature,top_pandmetadata.top_k,stop_sequences,mcp_servers,context_managementandcontainerare silently ignored (Anthropic SDK page). If your stop sequences seem to do nothing, that’s why.
7. Images and video
Both endpoints accept image and video input for M3.1 Flash. On the Anthropic endpoint, images (JPEG, PNG, GIF, WEBP) go in via URL or base64, and video (MP4, AVI, MOV, MKV) via URL, base64 or an uploaded file reference mm_file://{file_id} (Anthropic SDK page).
Size limits from the same page:
- Images up to 10 MB and URL or base64 videos up to 50 MB.
- Whole request body up to 64 MB.
- Larger videos (up to 512 MB) must go through the Files API.
Images cost tokens based on size and detail. MiniMax’s rough guide is up to about 600 tokens at low detail, often 1k–3k at default, and several thousand up to 15k+ at high. To check before you send, use POST /anthropic/v1/messages/count_tokens, which returns input token usage without generating anything.
8. Use it in Claude Code
MiniMax publishes a Claude Code setup (MiniMax Claude Code guide). Note that this points Claude Code at a non-Anthropic model through MiniMax’s Anthropic-compatible endpoint.
Step 1: clear conflicting variables. MiniMax warns these take priority over the settings file:
unset ANTHROPIC_AUTH_TOKEN
unset ANTHROPIC_BASE_URL
Remove them from ~/.bashrc or ~/.zshrc too if they’re exported there.
Step 2: edit ~/.claude/settings.json:
{
"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]"
}
}
CLAUDE_CODE_AUTO_COMPACT_WINDOW=524288 is MiniMax’s recommended 512K auto-compaction window. If you’d rather not edit JSON, MiniMax also documents a wizard, npx -y mmx-cli@latest agent setup, which updates the same file.
Step 3: verify. Start claude in your project, trust the folder, then run:
/status
/model
/status should show the base URL pointing at api.minimax.io/anthropic, and /model should show MiniMax-M3.1-Flash. If it still shows a Claude model, one of the variables from Step 1 is still set in your shell.
Changing the model doesn’t change what the agent is allowed to do on your machine. Those rules live in Claude Code itself, so our Claude Code permissions guide applies unchanged.
9. Try it free on OpenRouter
OpenRouter’s public models API lists minimax/minimax-m3.1-flash:free at $0 input and output, with a 1,000,000-token context and up to 524,288 completion tokens (OpenRouter models API). It marks reasoning as mandatory, with efforts low through max and max as the default, the same as MiniMax’s own API. The listed parameters include reasoning_effort, tools, tool_choice and response_format.
curl https://openrouter.ai/api/v1/chat/completions \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "minimax/minimax-m3.1-flash:free",
"reasoning_effort": "low",
"messages": [{"role": "user", "content": "Say hi in five words."}]
}'
Free variants on OpenRouter usually come with tighter rate limits and can change or disappear, so use this for evaluation and switch to MiniMax’s paid API, or a paid OpenRouter route if one appears, for production.
10. Limits, pricing math and errors
Rate limits on MiniMax’s API for M3.1 Flash (shared with M3): 200 requests per minute and 10,000,000 tokens per minute (rate limits). Higher limits go through api@minimax.io.
Pricing math. At $0.15 per million input and $0.60 per million output, an agent step with 20,000 input tokens and 3,000 output tokens (thinking included) costs about $0.003 + $0.0018 = $0.0048. If 15,000 of those input tokens are a cached prefix, the input part drops to 5,000 × $0.15/M + 15,000 × $0.015/M ≈ $0.00098. Reasoning tokens are billed as output, which is why effort level matters. MiniMax’s rough conversion is about 1,000 tokens per 750 English words (pricing).
Errors you’ll actually hit:
| Symptom | Cause | Fix |
|---|---|---|
401 with Please carry the API secret key in the 'Authorization' field of the request header (1004) | No key on the OpenAI endpoint | Send Authorization: Bearer <key> |
401 authentication_error mentioning the X-Api-Key field | No key on the Anthropic endpoint | Set api_key in the SDK or send the header |
400 with model "MiniMax-M3.1-Flash" requires adaptive thinking | You sent thinking: {"type": "disabled"} or effort none | Remove it and lower effort instead |
stop_reason: "max_tokens" with no text | Thinking used up max_tokens | Raise max_tokens or lower effort |
finish_reason: "length" | Output limit too small | Raise max_completion_tokens (up to 524,288) |
| Tool loop gets confused after the first call | Reasoning was dropped from history | Append the full assistant message every turn |
service_tier: "priority" doesn’t apply | Not supported on M3.1 Flash | Remove it; priority is M3-only |
Request rejected for temperature | Outside 0–2 | Keep it in range; MiniMax recommends 1 |
We recorded the two 401 messages ourselves by calling each endpoint without a key; the 400 message is quoted from MiniMax’s docs.
FAQ
Is MiniMax M3.1 Flash open-weight? Not yet. MiniMax calls it “an ultra-efficient open-weight model,” but its launch post says “Model weights will be released later.” No date is given in the official post, so you can’t self-host it today.
Can I turn thinking off to save tokens?
No. M3.1 Flash always thinks, and disabling it returns HTTP 400. Set effort to low instead. If you need a no-thinking option from MiniMax, M3 lets you disable thinking, at twice the per-token price.
What does “Space Bunny” have to do with it? MiniMax says Space Bunny, a model that ran anonymously and processed more than 200 trillion tokens, was an early version of M3.1 Flash.
Is there a bigger version coming? MiniMax says a Pro model “which pushes the boundaries of intelligence, will also arrive later.” No date or specs yet.
Should I migrate from M3? For agent and coding workloads, test it. Per token it’s half the price of M3’s standard tier, with the same context window and input types. Keep M3 if you need priority-tier admission or the option to turn thinking off.
Which endpoint should I use?
MiniMax recommends the Anthropic-compatible one because thinking blocks and interleaved thinking are first-class there. If your stack is built on the OpenAI SDK, the OpenAI-compatible endpoint works with the same model ID and returns reasoning in reasoning_content.
Sources
- MiniMax M3.1 Flash launch post, MiniMax, October 19, 2026
- Model invocation guide, MiniMax docs
- OpenAI-compatible Chat Completions reference, MiniMax docs
- Anthropic SDK compatibility, MiniMax docs
- Tool use and interleaved thinking, MiniMax docs
- Claude Code setup, MiniMax docs
- Rate limits and pricing, MiniMax docs
- OpenRouter models API, checked October 20, 2026