MiniMax M3 to M4 Migration: Which API Parameters to Change?

Moving from MiniMax M3 to M4? Delete thinking disabled and effort none, set effort on every call, raise output limits. Raw errors and checks, tested Dec 3, 2026.

AIHubMix12 мин четене
MiniMax M3 to M4 Migration: Which API Parameters to Change?

To move code from MiniMax M3 to M4 through AIHubMix, change the model ID to minimax-m4 (model page), delete thinking: {"type": "disabled"} and every effort of none, set an effort level on every call, and raise output limits so thinking has room. The base URL, endpoints, tool definitions, sampling settings and caching setup can stay as they are. The exception is a workload that depends on M3 answering without thinking: M4 can't switch thinking off, so measure it at low effort before moving that traffic.

Which parameters must change?

Parameter M3 M4 What to do
Model ID minimax-m3 minimax-m4 Change it
Thinking disabled Skips thinking 400 on Chat Delete it
Effort none Ignored No error, still thinks Use low
Effort unset Not tunable Runs at max Set it per call
Output limit No thinking on Messages Always thinks Raise it
reasoning_split false Think tags in content Not supported Delete it
service_tier priority 1.5x price tier Not listed Delete it

AIHubMix measured the M4 side of the model ID, thinking disabled, effort none, output limit and service_tier rows on December 3, 2026, between 14:43 and 14:47 UTC. The M3 column, the max default and reasoning_split come from MiniMax's API references; reasoning_split wasn't tested. On Anthropic Messages, thinking disabled returned 200 instead of 400 (see the silent failures below).

Which settings can stay as they are?

The base URL, API key and SDKs stay. Chat Completions, Anthropic Messages and the Responses API all answered for minimax-m4 in AIHubMix's test, and every response reported the model as MiniMax-M4.

Sampling settings never steered either model, so they can stay: MiniMax's API references fix temperature at 1 and top_p at 0.95, ignore penalties on Chat Completions and accept only auto for tool_choice on Messages. Tool definitions keep their format; AIHubMix's tool loops on M4 used standard OpenAI and Anthropic tool schemas.

Caching needs no code change. MiniMax caches calls of 512 or more input tokens automatically, matching the prefix in the order system prompt, tools, messages. In AIHubMix's test the same 1,395-token system prompt, sent twice 3 seconds apart, showed 180 cached tokens and then 1,392. Images also carry over: in the same test, a 400-pixel base64 JPEG sent through Chat Completions was described correctly. Video wasn't tested.

How do you fix the 400 "requires adaptive thinking" error?

The trigger is a request that switches thinking off. With your key in AIHUBMIX_API_KEY (see the AIHubMix quick start), this reproduces it:

curl https://aihubmix.com/v1/chat/completions \
  -H "Authorization: Bearer $AIHUBMIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "minimax-m4", "thinking": {"type": "disabled"}, "messages": [{"role": "user", "content": "ping"}]}'

Measured through AIHubMix on December 3, 2026, it returned HTTP 400 with this body (trace ID shortened). Adding reasoning_effort: "none" returned the same error.

{"error": {"message": "invalid params, model \"MiniMax-M4\" requires adaptive thinking; thinking.type=\"disabled\" (including reasoning.effort=none) is not allowed (2013) (tid: …)", "type": "bad_request_error", "param": "", "code": null}}

M4 always thinks, and MiniMax's OpenAI-compatible API reference documents this error. Code 2013 means "invalid parameters" in MiniMax's error table, so a retry gets the same answer. The JSON code field is null, so match "requires adaptive thinking" or "(2013)" in the message.

The fix deletes the thinking field (or sends {"type": "adaptive"}) and asks for the lowest effort. This prompt has a known answer, which makes the result easy to check:

curl https://aihubmix.com/v1/chat/completions \
  -H "Authorization: Bearer $AIHUBMIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "minimax-m4", "reasoning_effort": "low", "messages": [{"role": "user", "content": "How many prime numbers are there between 100 and 150? Answer with the number only."}]}'

Expect HTTP 200, finish_reason: "stop", content: "10" and a reasoning_content field. That is what AIHubMix got at 14:43 UTC, with 51 reasoning tokens in one run. On the other protocols, MiniMax's references put the same settings here:

Protocol Effort field Thinking in Output limit
OpenAI Chat reasoning_effort reasoning_content max_completion_tokens
Anthropic output_config.effort thinking blocks max_tokens
Responses reasoning.effort reasoning item max_output_tokens

All three accept low, medium, high, xhigh and max; low is the floor.

Why is the reply empty, and how do you fix it?

Thinking tokens count toward the output limit, MiniMax's docs say, so a tight limit gets spent before any answer. Chat Completions then returns HTTP 200 with finish_reason: "length" and an empty content. MiniMax's Anthropic-compatible API reference gives the Messages version, stop_reason: "max_tokens" with no text, which AIHubMix didn't test.

AIHubMix reproduced the Chat Completions case with max_completion_tokens set to 30 on the prime question. The response, with the ID, duplicate reasoning fields and cache details removed:

{"choices": [{"finish_reason": "length", "message": {"role": "assistant", "content": "", "reasoning_content": "We need answer number only. Need count primes between 100 and 150. Need determine inclusive? \"between 100 and 150\" endpoints"}}], "usage": {"prompt_tokens": 217, "completion_tokens": 30, "completion_tokens_details": {"reasoning_tokens": 30}}}

Limits sized for M3 on Messages, where M3 didn't think unless asked, are the likeliest to be too small (an inference from MiniMax's docs). In AIHubMix's coding benchmark on December 3 (15:18–15:30 UTC, 10 Python tasks with hidden tests, 2 runs each, Chat Completions, a 32,000-token limit), the longest M4 reply was 7,816 output tokens at low and 25,854 at max, and no call reached the limit.

Bigger jobs need far more. In Sulat's hands-on review, published December 4, 2026 (one run per task, in opencode), M4 at its default max spent a whole 32,000-token limit thinking on the larger single-file builds and returned nothing. Those builds needed a limit of up to 200,000 tokens and took 12 to 39 minutes; one game used 213,050 reasoning tokens. MiniMax's docs don't state M4's maximum output, and Vals.ai ran M4 with a 262,144-token limit.

Raise the limit, lower effort, and treat a length stop with no text as a failure. This turn does both and also handles tool-call turns that arrive without thinking:

import os
from openai import OpenAI

client = OpenAI(base_url="https://aihubmix.com/v1", api_key=os.environ["AIHUBMIX_API_KEY"])

resp = client.chat.completions.create(
    model="minimax-m4",
    reasoning_effort="low",
    max_completion_tokens=32000,  # thinking counts toward this limit
    messages=messages,
    tools=tools,
)
choice = resp.choices[0]
msg = choice.message

if choice.finish_reason == "length" and not msg.content and not msg.tool_calls:
    raise RuntimeError("Thinking used the whole output limit: raise it or lower effort")

thinking = getattr(msg, "reasoning_content", None)  # absent on some tool-call turns
messages.append(msg)  # the full message: content, tool_calls, reasoning_content

To verify, rerun the prime question without the 30-token cap. In AIHubMix's test it returned finish_reason: "stop" and the answer 10.

Which settings fail silently?

What happens to an effort of none?

MiniMax's docs say M4 returns 400 for none on every protocol. Through AIHubMix it didn't: none on Chat Completions, the Responses API and Messages returned 200, and so did thinking: {"type": "disabled"} on Messages. M4 thought anyway, spending 16 to 19 thinking tokens on a one-word prompt. Whether AIHubMix or MiniMax accepts the value can't be told from outside. Code that sends none to save time gets no error and no saving; replace it with low.

What does leaving effort unset cost?

A request without effort runs at max, per MiniMax's docs, so M3 code that never set effort gets M4's deepest thinking. Thinking is billed as output; AIHubMix's responses counted it inside completion_tokens or output_tokens. MiniMax's pricing page lists M4 output at $3.10 per 1M tokens, against $1.20 for M3 up to 512K input (December 3, 2026).

On the prime question, AIHubMix measured 51 reasoning tokens at low, 85 at max and 90 with effort unset. Coding tasks widen the gap. In the benchmark, M4 at max, the level an unset request gets, cost $0.01437 per task at MiniMax list prices against $0.00462 at low: 3.1 times as much and 2.5 times the median latency, for 19 passes out of 20 against 18. In this set that one-pass gap is within run-to-run noise.

Set effort on every call, by task type. On hard work the extra thinking can pay: MiniMax's technical report shows M4 scoring 32.0 at low and 50.3 at max on its internal coding set, at 1.5 times the output tokens. MiniMax's model pairing guide, written for its MiniMax Code app, suggests high or max for design and pre-commit review and max for hard debugging.

Why do think-tag parsers find nothing?

With reasoning_split: false, MiniMax's Chat Completions API wraps thinking in <think> tags inside content. Its docs say M4 doesn't support false without saying whether it errors; AIHubMix didn't test it. On M4, thinking arrives in reasoning_content and content holds only the answer. Read reasoning_content, or the thinking blocks on Messages. Through AIHubMix, Chat Completions responses also carried reasoning and reasoning_details with the same text.

What breaks in tool loops?

MiniMax's tool use and interleaved thinking guide asks for the full assistant message back in the history every turn, with reasoning_content and tool_calls (on Messages, the thinking blocks unchanged). It also says M4 may skip thinking on a simple tool call, leaving no reasoning_content field or thinking block, so code that reads the field unconditionally breaks there.

AIHubMix ran a two-turn tool loop at low on Chat Completions and on Messages. Both first turns returned only the tool call with no thinking; after the full message and tool result went back, both second turns answered correctly. The getattr line above covers the missing field. With no thinking in those first turns, the test doesn't show how returned thinking is handled, so check that in your first real loop.

Does service_tier still buy priority?

MiniMax's pricing page lists the Priority tier, at 1.5 times the standard price, for M3 only, and its API references don't document service_tier for M4. Through AIHubMix, a request with service_tier: "priority" returned 200 with a normal answer and no service tier in the response. Nothing indicates it buys priority on M4; remove it.

How do you set up Claude Code and Codex?

Claude Code uses Anthropic Messages and Codex the Responses API. Both endpoints answered for minimax-m4 in AIHubMix's test, but the tools themselves weren't run. The settings below adapt MiniMax's guides for its own M Plan subscription (not served by AIHubMix). Installation is in AIHubMix's guides to Claude Code settings.json and environment variables and Codex config.toml setup.

How do you configure Claude Code?

In ~/.claude/settings.json:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://aihubmix.com",
    "ANTHROPIC_AUTH_TOKEN": "<your AIHubMix key>",
    "ANTHROPIC_MODEL": "minimax-m4",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "minimax-m4",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "minimax-m4",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "minimax-m4",
    "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "524288",
    "CLAUDE_CODE_EFFORT_LEVEL": "high"
  }
}

In a new session, /status should show the AIHubMix base URL and /model should show minimax-m4, the check MiniMax's guide gives for its own endpoint. The 524288 value is the 512K window MiniMax recommends for coding tools, based on a ProgramBench run on M3.1-Flash, not M4. Common failure points:

  • MiniMax's guide appends [1m] to the model ID. Through AIHubMix, a Messages request for minimax-m4[1m] returned 400 ("This model ID is incorrect"), while minimax-m4 with Anthropic's context-1m beta header returned 200. Leave the suffix off.
  • MiniMax's guide says shell exports of ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN override this file; AIHubMix's guide says settings.json wins. Unset them.
  • While CLAUDE_CODE_EFFORT_LEVEL is set, /effort does nothing. Remove it to switch mid-session, or start with claude --effort <level>.
  • MiniMax's guide says some Claude Code versions send xhigh as high, and MAX_THINKING_TOKENS=0 doesn't stop M4 from thinking.

How do you configure Codex?

In ~/.codex/config.toml, with the key exported as AIHUBMIX_API_KEY:

model = "minimax-m4"
model_provider = "aihubmix"
model_context_window = 524288

[model_providers.aihubmix]
name = "AIHubMix"
base_url = "https://aihubmix.com/v1"
wire_api = "responses"
env_key = "AIHUBMIX_API_KEY"

MiniMax recommends Codex CLI 0.146.0 or newer. To pick effort in /model, copy the model catalog from MiniMax's Codex guide, point model_catalog_json at it, and change these fields:

"slug": "minimax-m4",
"display_name": "minimax-m4",
"default_reasoning_level": "high",
"supported_reasoning_levels": [
  { "effort": "low", "description": "Low" },
  { "effort": "medium", "description": "Medium" },
  { "effort": "high", "description": "High" },
  { "effort": "xhigh", "description": "Extra high" },
  { "effort": "max", "description": "Maximum" }
],
"supports_reasoning_summaries": true,

/model should then list minimax-m4 with five levels. Without supports_reasoning_summaries: true, MiniMax's guide says Codex omits reasoning.effort and M4 runs at max. Don't add a none level: MiniMax says it returns 400, and through AIHubMix's Responses endpoint it returned 200 with M4 thinking anyway.

How do you verify the migration?

Send the prime question at low to each endpoint your code uses, then check the failure cases. Expected results are what AIHubMix measured on December 3, 2026, one run each:

Check Expected result
Chat Completions, low 200, stop, answer 10
Messages, low 200, end_turn, answer 10
Responses, low 200, completed, answer 10
Output limit of 30 200, length, empty text
Thinking disabled on Chat 400, error 2013
Same long prompt twice Cached tokens rise

The Chat Completions request is the fix above. The other two:

curl https://aihubmix.com/v1/messages \
  -H "Authorization: Bearer $AIHUBMIX_API_KEY" \
  -H "Content-Type: application/json" \
  -H "anthropic-version: 2023-06-01" \
  -d '{"model": "minimax-m4", "max_tokens": 2048, "output_config": {"effort": "low"}, "messages": [{"role": "user", "content": "How many prime numbers are there between 100 and 150? Answer with the number only."}]}'

curl https://aihubmix.com/v1/responses \
  -H "Authorization: Bearer $AIHUBMIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "minimax-m4", "reasoning": {"effort": "low"}, "input": "How many prime numbers are there between 100 and 150? Answer with the number only."}'

Messages should return a thinking block before the text block, and Responses a reasoning item before the message. For cost tracking, prompt_tokens on Chat Completions includes cached tokens, while input_tokens on Messages excludes them.

For Claude Code or Codex, which AIHubMix didn't run, set effort to medium in a small repository with a working test runner. Ask for a unit test for one untested function, then an edge-case test in the same session. The run passes when no request returns 400, every reply has visible text, the new tests pass when you run them yourself, and the second turn reports cached input tokens. A 2013 error means something still sends thinking: disabled; empty replies mean the output limit is too small for the effort level.

When should you not migrate yet?

  • The workload needs answers without thinking. M3 skips thinking on request and M4 can't. In AIHubMix's coding benchmark, M4 at low still averaged 1,091 reasoning tokens and a 10.9-second median latency per task.
  • Your product depends on video input. AIHubMix lists text and image input for minimax-m4, and video wasn't tested.
  • An agent will run long tasks with write access before caps are in place. AIHubMix tested single requests and two-turn tool loops only. Cap tokens per call and steps per task, and keep human approval for deletes, force-pushes and migrations.
  • Your output budget needs a documented ceiling. MiniMax's docs don't state M4's maximum output; Vals.ai ran it with a 262,144-token limit.
  • Token price is the constraint. MiniMax lists M4 at $0.80 input and $3.10 output per 1M tokens, against $0.30 and $1.20 for M3 up to 512K input.

FAQ

Why does MiniMax M4 return 400 "requires adaptive thinking"?
The request turned thinking off, which M4 doesn't allow, so MiniMax rejects it with error 2013. Delete the thinking field and use low effort. Through AIHubMix this happened on Chat Completions, while an effort of none got no error.

Can thinking be turned off on M4?
No. Low effort is the minimum on every protocol, and Claude Code settings such as MAX_THINKING_TOKENS=0 don't change that. Keep workloads that need answers without thinking on M3 until low has been measured on them.

Why is the M4 reply empty?
Thinking used the whole output limit, so the call stopped with finish reason length or stop reason max_tokens before any answer text. Raise the limit or lower effort, and treat that stop with no text as a failure.

Which effort level should M4 use after moving from M3?
Set one on every call, since leaving it out means max. In AIHubMix's coding benchmark, low cost about a third as much per task as max and passed 18 of 20 runs against 19.

Do the base URL and SDK change?
No. The same AIHubMix base URL, key and SDKs work, and all three endpoints answered for minimax-m4 in AIHubMix's test.

Does service_tier priority work on M4?
MiniMax lists the Priority tier for M3 only. Through AIHubMix the field was accepted on M4 with no sign of priority in the response, so remove it.

Do Claude Code and Codex work with M4 through AIHubMix?
Their endpoints, Anthropic Messages and the Responses API, both answered for minimax-m4 on December 3, 2026. The tools themselves weren't run, and AIHubMix rejects minimax-m4[1m] as a model ID, so run the verification steps before a long session.

Keep reading: the MiniMax M4 series

Sources

  1. MiniMax OpenAI-compatible API reference: thinking control, the 2013 error, effort, output limits, reasoning_split, sampling parameters. Accessed December 3, 2026.
  2. MiniMax Anthropic-compatible API reference: thinking defaults per model, output_config.effort, max_tokens, tool_choice. Accessed December 3, 2026.
  3. MiniMax pricing, prompt caching and tool use guide: list prices, the M3-only Priority tier, cache rules, passing back full messages, thinking on demand. Accessed December 3, 2026.
  4. MiniMax guides for Claude Code, Codex and model pairing: effort settings, the 512K window, catalog fields, suggested levels per task. Accessed December 3, 2026. MiniMax M4 technical report: low versus max on MiniMax's internal coding set. Accessed December 4, 2026.
  5. AIHubMix MiniMax M4 model page: the minimax-m4 model ID and input types, plus AIHubMix's requests to minimax-m4 on December 3, 2026 (14:43–14:47 UTC) and its coding benchmark the same day (15:18–15:30 UTC). Third-party runs: Sulat's M4 hands-on review and Vals.ai's M4 results, accessed December 4, 2026.

Един шлюз към множество AI доставчици. Създаден за продукционна среда.

Посетете AIHubMix