Editorial split banner showing MiniMax M4 2.74T MoE router hub, MFlashKV SSD cache tiers, and 1M context chips
LLMs
Intermediate
22 min read Updated

MiniMax M4: 2.74T MoE Architecture, Benchmarks, Pricing & API Guide

Explore MiniMax M4: 2.74T MoE (66B active), 1M context, MSA2 and MFlashKV SSD caching, $0.80/$3.10 API pricing, benchmarks, Python/TS SDK code, and fixes.

MiniMax M4 LLMs Open Source AI MoE Architecture AI Agents Python

MiniMax M4 scales Mixture-of-Experts language modeling to 2.74 trillion total parameters while activating 66 billion parameters per token across a native 1M-token context window. Released on December 3, 2026, the flagship model prices API inference at a flat $0.80 per million input tokens, $3.10 per million output tokens, and $0.05 per million prompt cache reads.

To sustain long-context serving without depending solely on scarce high-bandwidth memory, MiniMax co-designed sparse attention with direct SSD key-value caching. Engineering teams integrating the API must also account for always-on adaptive reasoning, where disabling thinking triggers an immediate HTTP 400 error.

Key Takeaways

  • Extreme Sparsity at 2.74T Scale: MiniMax M4 pairs 2.74T total parameters with 66B active parameters per token (~2.4% active compute) and supports up to 524,288 completion tokens inside a 1-million-token input window.
  • SSD-Backed Long-Context Throughput: MiniMax Sparse Attention 2 (MSA2) and MFlashKV offload 16-token KV blocks aligned to 4 KiB NVMe pages, reaching 1,589 tokens per second per chip on Huawei Ascend 950DT at 100 tokens per second per user.
  • Split Benchmark Profile: The model leads open-weight rankings on Agent Arena Index (1,194) and Code Arena WebDev (1,731), yet trails top proprietary flagships on deep repository maintenance suites such as SWE-Marathon (44.0).
  • Mandatory Reasoning Controls: Both the Anthropic-compatible endpoint (output_config.effort) and OpenAI-compatible gateway (reasoning_effort) default to max effort and reject disabled thinking payloads.

What Is MiniMax M4 and How Does It Scale from M2.5 and M3?

MiniMax M4 (MiniMax-M4) is a natively multimodal Mixture-of-Experts (MoE) reasoning model built for long-horizon coding, agentic tool execution, and end-to-end artifact generation. It advances MiniMax’s hardware-aware architecture so massive sparse models run competitively on accelerators with tighter high-bandwidth memory (HBM) envelopes.

Rather than training a dense monolithic transformer that multiplies FLOPs linearly with parameter count, the MiniMax M4 model routes each token through a narrow slice of specialized weights. Only 66B parameters fire during any forward pass, keeping per-token arithmetic comparable to mid-sized MoE checkpoints while retaining the world knowledge of a 2.74T parameter pool.

Evolution Across MiniMax M2.5, M3, and M4

Across three rapid iterations in 2026, MiniMax expanded both active capacity and context retention while dropping per-token memory overhead. Examining MiniMax M4 vs MiniMax M3 and the earlier M2.5 release shows a consistent push toward agentic execution across multi-megabyte repositories.

Model Generation Total Parameters Active Parameters Context Window Key Architectural Milestone
MiniMax M2.5 ~230B ~10B ~205K tokens Lightning Attention, spec-writing coding loops
MiniMax M3 ~428B ~23B 1,000,000 tokens Native multimodality and Anthropic Messages API
MiniMax M4 2.74T 66B 1,000,000 tokens MSA2 sparse attention, MFlashKV SSD tiering, 28-teacher MOPD

M2.5 established structured spec planning before code edits, and M3 extended context to a full million tokens with multimodal inputs. M4 multiplies total parameter capacity more than sixfold over M3 while introducing hardware-co-designed memory offloading to prevent HBM bottlenecks from capping batch concurrency.

Open-Weight Status: Technical Report Live, Weights Pending

MiniMax classifies the release as an open-weight flagship and published the full MiniMax-M4 Technical Report PDF on launch day. However, engineers planning a MiniMax M4 open weights release deployment should note a practical caveat at launch.

While the official MiniMax-M4 GitHub repository is live with architectural documentation and benchmark figures, the downloadable model checkpoints are listed as releasing soon. Until those weights publish, production workloads must route through the hosted MiniMax API, OpenRouter, or M Plan subscriptions.

Teams evaluating self-hosted cluster alternatives while waiting for checkpoints can compare current open-weight contenders in our open source LLM benchmark guide. Even once weights drop, hosting 2.74T parameters in FP8 or INT4 will demand multi-node GPU or accelerator clusters rather than single-box workstations.

Under-the-Hood Architecture: MSA2, MFlashKV SSD Offloading, and MOPD Training

MiniMax M4 architecture solves two intertwined systems bottlenecks described in the lab’s technical paper, “Scaling Intelligence Under Compute Constraints.” First, it shrinks and offloads the 1M-token KV cache so accelerators with smaller HBM pools avoid memory starvation; second, it consolidates 28 specialized reinforcement learning teachers into a single generalist checkpoint.

Isometric diagram of MiniMax M4 MSA2 sparse attention, 66B MoE routing, and MFlashKV NVMe SSD cache tiering Figure 1: MiniMax-M4 execution pipeline pairing 68-layer MSA2 indexer lookahead with 4 KiB aligned MFlashKV SSD offloading.

Standard dense attention balloons KV cache memory linearly as sequences cross 128K to 1M tokens, leaving accelerators memory-bandwidth bound during decode. MiniMax co-designed the attention layers and storage scheduler together so inference workloads stay pinned near compute ceilings rather than stalling on HBM capacity.

MiniMax Sparse Attention 2 (MSA2) Across 68 Layers

Every one of the model’s 68 attention layers runs MiniMax Sparse Attention 2, an evolution of MiniMax’s native sparse attention stack. MSA2 shares query-key-value projections in a multi-query pattern and applies fine-grained block sparsity so each decode step attends only to high-salience context blocks.

Critically, MSA2 introduces an indexer lookahead mechanism that predicts required KV blocks multiple layers ahead of actual attention computation. Because the scheduler knows which historical context chunks layer $L+k$ will read before layer $L$ finishes, it hides storage fetch latency behind ongoing matrix multiplications.

MFlashKV SSD Offloading and Huawei Ascend 950DT Co-Design

MFlashKV SSD offloading pairs directly with MSA2 lookahead to extend effective context memory from accelerator HBM into local NVMe flash storage. MFlashKV partitions runtime key-value tensors into 16-token blocks sized to match 4 KiB SSD read and write pages.

By aligning attention block granularity with physical NVMe page boundaries, the runtime avoids read-modify-write amplification during asynchronous prefetching. On Huawei Ascend 950DT clusters, where HBM capacity sits below Nvidia GB300 tiers, this design achieves 1,589 tokens per second per chip decoding throughput at a 100 tokens per second per-user streaming rate.

Scale-Out-Then-Scale-In RL and Multi-Teacher On-Policy Distillation

Training a single 2.74T Mixture-of-Experts model across conflicting reinforcement learning domains often triggers gradient interference, where coding gains degrade creative writing or financial formatting. MiniMax sidestepped that instability using a “scale-out-then-scale-in” RL pipeline across 28 domain experts.

  1. Parallel Domain Specialization: Independent clusters trained 28 specialist models covering software engineering, desktop GUI control, cybersecurity, finance, science, and chip circuit design.
  2. On-Policy Consolidation: MiniMax merged those capabilities back into the single flagship checkpoint through multi-teacher on-policy distillation (MOPD), where the unified student generates rollouts scored online by the domain teachers.

Because MOPD distills on the student’s own token trajectories rather than static offline datasets, the unified model preserves cross-domain generalization without losing specialist accuracy. Engineers designing smaller student pipelines can explore similar trade-offs in our knowledge distillation architecture guide.

MiniMax M4 Benchmarks and Comparison Against Claude Opus 5.5, Gemini 4 Neon, and DeepSeek

MiniMax M4 benchmarks establish a sharp split between agentic web workflows and deep multi-file repository maintenance. Independent and launch evaluations place it #1 among open-weight models on Agent Arena Index (1,194) and Code Arena WebDev (1,731), while showing a measurable gap against elite proprietary coding agents on SWE-Marathon and Terminal-Bench 4.1.

Quadrant chart comparing MiniMax M4 cost efficiency and agentic capability against frontier models Figure 2: Cost efficiency versus agentic coding capability positioning MiniMax-M4 against frontier proprietary and open-weight models.

Headline leaderboard scores only reveal operational fit when paired with token rates and domain strengths. Teams evaluating open-weight vs proprietary frontier models should test M4 specifically on UI generation, financial modeling, and high-context agent orchestration before committing mission-critical repository pipelines.

Agent Arena, Code Arena WebDev, and Vals Index Scorecard

Early evaluation suites highlight strong end-to-end artifact creation alongside mid-pack terminal debugging accuracy. On the Vals Index v2.2 workspace benchmark spanning finance, legal, and software tasks, MiniMax M4 scores 61.65%, ranking #15 overall and tracking closely with peer open-weight flagships.

Benchmark Suite Evaluation Domain MiniMax M4 Score Leaderboard Context
Agent Arena Index Multi-step autonomous tool execution 1,194 #1 among open-weight models at launch
Code Arena (WebDev) Interactive frontend and web app builds 1,731 #1 among open-weight models
Vals Index (v2.2) Applied finance, law, and enterprise tasks 61.65% #15 overall; competitive with Qwen4-Max
Terminal-Bench 4.1 Shell, CLI, and system debugging 56.6 Trails top specialists like Kimi K3.1 Pro (~68.2)
SWE-Marathon Long-horizon multi-file code maintenance 44.0 Trails top proprietary flagships (70+ range)

Notice the divergence between Code Arena WebDev (1,731) and SWE-Marathon (44.0). M4 shines when generating self-contained web applications, 3D/game scenes, financial spreadsheets, and design artifacts, whereas iterative multi-file legacy patches still favor heavier proprietary reasoning models.

Head-to-Head Matrix: MiniMax M4 vs Proprietary and Open-Weight Rivals

Comparing MiniMax M4 vs Claude Opus 5.5 and Gemini 4 Neon comes down to cost per 1M tokens and context throughput. The flagship MoE undercuts Gemini 4 Neon by 73% on input tokens and Claude Opus 5.5 by 80% while preserving a flat rate card across all 1,000,000 input positions.

Model Params (Total / Active) Context Window Input / Output / Cache (per 1M) Best Production Fit
MiniMax-M4 2.74T / 66B MoE 1,000,000 tokens $0.80 / $3.10 / $0.05 Cost-sensitive 1M-context agents, WebDev, finance
Gemini 4 Neon Proprietary 1,048,576 tokens $3.00 / $15.00 / $0.15 Fast coding agents, STEM synthesis, high Terminal-Bench
Claude Opus 5.5 Proprietary 200K (1M opt-in) $4.00 / $20.00 / $0.20 Strict multi-file legacy codebases and IDE refactors
GPT-6.2 Astra Proprietary ~1.1M tokens $8.00+ / $40.00+ / $0.40+ Peak mathematical rigor and GUI computer use
DeepSeek-V4.1-Flash 552B CED + 196B / 16B 1,000,000 tokens MIT Open Weights Immediate self-hosted clusters and DeepSWE coding

Evaluating MiniMax M4 vs Gemini 4 Neon or MiniMax M4 vs DeepSeek also highlights distinct runtime trade-offs. For a deeper breakdown of how Google’s mid-tier workhorse handles repository runners and xhigh reasoning budgets, compare these metrics against our Gemini 4 Neon architecture and benchmark guide.

Where Proprietary Flagships and Peer Models Win

An honest architectural assessment reveals four scenarios where competing models beat MiniMax M4 in production today:

  1. Deep Multi-File Repository Maintenance (Claude Opus 5.5 / Fable 5.2): When agents must trace subtle side effects across dozens of legacy modules without introducing regressions, Claude Opus 5.5 maintains higher pass rates than M4’s 44.0 SWE-Marathon mark.
  2. CLI and Terminal Automation (Gemini 4 Neon / Kimi K3.1 Pro): Workloads dominated by bash debugging, container orchestration, and shell state recovery benefit from Gemini 4 Neon (65.2% on Terminal-Bench 4.1) over M4’s 56.6 score.
  3. Immediate Air-Gapped Self-Hosting (DeepSeek-V4.1-Flash / GLM-5.2): Because MiniMax-M4 weights are pending release at launch, teams requiring on-premise VPC deployment today must run MIT-licensed open weights such as DeepSeek-V4.1-Flash.
  4. High-Precision Mathematical Proofs (GPT-6.2 Astra): Quantitatively unforgiving verification pipelines justify GPT-6.2 Astra’s higher price ceiling when a single arithmetic slip invalidates an entire workflow.

How to Use the MiniMax M4 API in Python, TypeScript, and OpenRouter

Engineers learning how to use MiniMax M4 API endpoints can choose between an Anthropic-compatible gateway, an OpenAI-compatible gateway, and OpenRouter. MiniMax explicitly recommends the MiniMax M4 Anthropic compatible endpoint (https://api.minimax.io/anthropic) because it exposes native interleaved thinking blocks alongside the output_config.effort control.

Light editorial decision flowchart routing MiniMax M4 requests across Anthropic, OpenAI, OpenRouter, and effort tiers Figure 3: Endpoint selection and output_config.effort routing rules to avoid HTTP 400 adaptive thinking errors.

Because adaptive reasoning cannot be turned off, every integration should treat thinking depth as a latency-vs-quality dial (low, medium, high, xhigh, max). Choosing the right SDK pattern also determines whether your client receives clean separated thinking traces or raw assistant text.

Anthropic-Compatible Endpoint with Python and output_config.effort

Installing the official Anthropic SDK alongside Pydantic gives Python services full access to MiniMax M4 thinking blocks and strict schema validation. Setting output_config={"effort": "high"} overrides the max API default so routine extraction calls finish faster without sacrificing structured accuracy.

pip install --upgrade anthropic openai pydantic
export MINIMAX_API_KEY="your-minimax-api-key"

The typed Python script below routes a repository audit prompt through https://api.minimax.io/anthropic, separates internal thinking blocks from the final JSON payload, and validates the response with Pydantic.

import json
import os
from typing import Literal
import anthropic
from pydantic import BaseModel, Field

class AuditFinding(BaseModel):
    severity: Literal["high", "medium", "low"]
    component: str = Field(..., min_length=2)
    recommendation: str = Field(..., min_length=10)

def run_minimax_audit(
    prompt: str,
    effort: Literal["low", "medium", "high", "xhigh", "max"] = "high",
    max_tokens: int = 8192,
) -> tuple[str, AuditFinding]:
    """Call MiniMax-M4 via Anthropic-compatible API with thinking separation."""
    client = anthropic.Anthropic(
        base_url="https://api.minimax.io/anthropic",
        api_key=os.environ["MINIMAX_API_KEY"],
    )

    response = client.messages.create(
        model="MiniMax-M4",
        max_tokens=max_tokens,
        output_config={"effort": effort},
        system=(
            "Return strictly valid JSON matching keys: "
            "severity (high|medium|low), component, recommendation."
        ),
        messages=[{"role": "user", "content": prompt}],
    )

    thinking_trace = ""
    text_payload = ""

    for block in response.content:
        if block.type == "thinking":
            thinking_trace += block.thinking
        elif block.type == "text":
            text_payload += block.text

    parsed = AuditFinding.model_validate(json.loads(text_payload))
    return thinking_trace, parsed

if __name__ == "__main__":
    trace, finding = run_minimax_audit(
        "Review Redis session store missing TTL on auth tokens.",
        effort="medium",
    )
    print(f"Thinking chars: {len(trace)}")
    print(finding.model_dump_json(indent=2))

Allocating max_tokens=8192 leaves ample headroom for the thinking block before the model emits the final JSON text block. Always inspect block.type == "text" rather than assuming response.content[0] holds the user-facing answer, because response.content[0] is almost always the thinking block.

TypeScript SDK Implementation with Structured Output Parsing

Node.js and TypeScript backends use the standard @anthropic-ai/sdk package pointed at the same Anthropic-compatible base URL. Type-safe block filtering ensures downstream API handlers never accidentally stream internal reasoning traces into end-user chat bubbles.

import Anthropic from '@anthropic-ai/sdk';

type EffortLevel = 'low' | 'medium' | 'high' | 'xhigh' | 'max';

interface MiniMaxResult {
  thinking: string;
  answer: string;
  inputTokens: number;
  outputTokens: number;
}

const client = new Anthropic({
  baseURL: 'https://api.minimax.io/anthropic',
  apiKey: process.env.MINIMAX_API_KEY,
});

export async function queryMiniMaxM4(
  prompt: string,
  effort: EffortLevel = 'high',
): Promise<MiniMaxResult> {
  const response = await client.messages.create({
    model: 'MiniMax-M4',
    max_tokens: 8192,
    output_config: { effort } as Record<string, unknown>,
    messages: [{ role: 'user', content: prompt }],
  });

  let thinking = '';
  let answer = '';

  for (const block of response.content) {
    if (block.type === 'thinking') {
      thinking += block.thinking;
    } else if (block.type === 'text') {
      answer += block.text;
    }
  }

  return {
    thinking,
    answer,
    inputTokens: response.usage.input_tokens,
    outputTokens: response.usage.output_tokens,
  };
}

As documented in the MiniMax Anthropic-compatible API reference, passing output_config.effort works cleanly across all five tiers (low, medium, high, xhigh, max). Using a type cast on output_config keeps strict TypeScript builds green even if an older local @anthropic-ai/sdk definition lacks the newer xhigh union literal.

OpenAI-Compatible Endpoint and OpenRouter Routing

Teams standardized on the OpenAI SDK can hit the MiniMax M4 OpenAI compatible API at https://api.minimax.io/v1 using reasoning_effort (or reasoning.effort on /v1/responses). Multi-provider routers can alternatively target the MiniMax M4 OpenRouter model ID (minimax/minimax-m4) via OpenRouter with zero code changes to existing OpenAI clients.

import os
from openai import OpenAI

# Option A: Direct MiniMax OpenAI-compatible gateway
direct_client = OpenAI(
    base_url="https://api.minimax.io/v1",
    api_key=os.environ["MINIMAX_API_KEY"],
)

# Option B: OpenRouter unified multi-model gateway
openrouter_client = OpenAI(
    base_url="https://openrouter.ai/api/v1",
    api_key=os.environ["OPENROUTER_API_KEY"],
)

def run_via_openai_gateway(use_openrouter: bool = False) -> str:
    """Invoke MiniMax-M4 using standard OpenAI chat completions."""
    client = openrouter_client if use_openrouter else direct_client
    model_id = "minimax/minimax-m4" if use_openrouter else "MiniMax-M4"

    completion = client.chat.completions.create(
        model=model_id,
        max_tokens=8192,
        reasoning_effort="medium",
        messages=[
            {"role": "system", "content": "You are a systems architect."},
            {"role": "user", "content": "Design a Postgres read-replica failover checklist."},
        ],
    )
    return completion.choices[0].message.content or ""

Consult the MiniMax text generation developer guide and the OpenRouter MiniMax-M4 model specification to verify gateway-specific header options and current routing availability. Notice how OpenAI Chat Completions uses max_tokens or max_completion_tokens, while the /v1/responses endpoint maps thinking depth to reasoning.effort and max_output_tokens.

Pricing Economics, Effort Routing, and Access Channels

MiniMax M4 API pricing uses a flat rate card of $0.80 per million input tokens, $3.10 per million output tokens, and $0.05 per million cached tokens regardless of prompt length. Unlike legacy tiered rate cards that double prices past 200K tokens, engineers can saturate the entire 1M-token window at the exact same base rate.

Because MiniMax M4 prompt cache pricing drops input reads by 93.75% (from $0.80 down to $0.05 per million tokens), multi-turn coding agents see massive margin improvements once repository trees and tool schemas sit in cache. Pairing stable system prefixes with explicit cache alignment mirrors the optimization strategies covered in our prompt caching architecture guide.

Token Economics and Prompt Cache Savings Math

Consider an autonomous repository agent executing a 10-turn debugging loop with a 120,000-token codebase prefix and 3,000 new output tokens per turn (combining internal reasoning and code diffs). Comparing an uncached max effort run against a cached medium effort run illustrates why prefix stability and effort tuning govern real monthly bills.

Agent Workload Configuration (10 Turns) Uncached Input (1.2M tok) Cached Prefix Reads Output Tokens (Thinking + Text) Total 10-Turn Cost
Uncached + max Effort (4K out/turn) $0.96 $0.00 $0.124 (40K out) $1.084
90% Cached + max Effort (4K out/turn) $0.096 (turn 1) $0.054 (1.08M read) $0.124 (40K out) $0.274 (-74.7%)
90% Cached + medium Effort (2K out/turn) $0.096 (turn 1) $0.054 (1.08M read) $0.062 (20K out) $0.212 (-80.4%)

At scale (1,000 ten-turn agent runs per day), stabilizing the 120K codebase prefix and stepping down from max to medium effort cuts daily spend from $1,084 to $212. Remember that both internal thinking tokens and visible completion tokens bill at the $3.10/M output rate, up to the 524,288 completion tokens ceiling.

M Plan Subscriptions, MiniMax Code, and Adaptive Effort Tiers

Developers who prefer flat-rate interactive tooling over raw per-token metering can access M4 through M Plan subscriptions (Go, Explore, Build, and Scale tiers) and the MiniMax Code platform. Inside MiniMax Code, the model runs multi-step IDE refactors and web builds against weekly plan quotas instead of pay-as-you-go API credits.

For raw API consumers, tuning MiniMax M4 adaptive thinking effort dynamically per task class prevents latency bloat from always-on reasoning:

  • low / medium: Use for log triage, classification, schema extraction, and single-file edits where sub-second TTFT and low output token count matter most.
  • high: Default baseline for multi-file feature generation, SQL query synthesis, and interactive pair programming.
  • xhigh / max: Reserve for open-ended architecture design, financial modeling, and complex WebDev builds where deeper chain-of-thought verification justifies higher latency.

[!TIP] Never omit output_config.effort on latency-sensitive endpoints. Because the API defaults to max when effort is omitted, an unconfigured microservice will quietly generate maximum-depth thinking traces on simple classification prompts.

Production Troubleshooting: Adaptive Thinking Errors, Truncation, and Rate Limits

Reliable MiniMax M4 troubleshooting requires defensive guards against four predictable production traps: invalid thinking-disable payloads, silent thinking truncation, TPM quota saturation, and SSD cache latency variance. Building an automated retry and payload sanitizer before deploying keeps agent loops from crashing mid-workflow.

Fixing HTTP 400 Adaptive Thinking and Thinking Truncation Errors

Migrating existing Anthropic or OpenAI wrapper code to MiniMax-M4 frequently triggers two immediate failure modes at request validation or response parsing time.

Error Symptom Root Cause Immediate Remediation
400 Bad Request adaptive thinking Client sent thinking: {"type": "disabled"} or effort: "none" Remove thinking.type="disabled" and set output_config.effort="low"
max_tokens thinking truncation max_tokens too low (e.g., 1024); internal thinking exhausted cap before text emitted Raise max_tokens to at least 8192 (16384+ for xhigh/max effort)
429 rate limit (TPM) burst Concurrent 500K-1M context prompts exhausted shared input+output TPM budget Add jittered exponential backoff and stagger large-context batch jobs
SSD KV cache thrashing / latency spike Rapidly alternating uncached 500K+ prefixes bypass warm MFlashKV pages Pin static system prompts and repository context first to maximize cache hits

When max_tokens thinking truncation occurs, response.stop_reason returns "max_tokens" while the assistant’s text block is empty or cut mid-JSON. Always check stop_reason before parsing JSON, and step down effort or raise max_tokens automatically on retry.

import random
import time
from typing import Literal
import anthropic

def call_minimax_resilient(
    client: anthropic.Anthropic,
    prompt: str,
    effort: Literal["low", "medium", "high", "xhigh", "max"] = "high",
    max_tokens: int = 8192,
    max_retries: int = 4,
) -> str:
    """Execute MiniMax-M4 request with 429 backoff and truncation recovery."""
    current_max_tokens = max_tokens

    for attempt in range(max_retries):
        try:
            resp = client.messages.create(
                model="MiniMax-M4",
                max_tokens=current_max_tokens,
                output_config={"effort": effort},
                messages=[{"role": "user", "content": prompt}],
            )

            if resp.stop_reason == "max_tokens":
                # Thinking consumed the completion budget; double ceiling and retry
                current_max_tokens = min(current_max_tokens * 2, 65536)
                continue

            return "".join(
                block.text for block in resp.content if block.type == "text"
            )

        except anthropic.RateLimitError:
            if attempt == max_retries - 1:
                raise
            delay = (2 ** attempt) + random.uniform(0.1, 0.8)
            time.sleep(delay)
        except anthropic.BadRequestError as exc:
            # Guard against legacy callers injecting disabled thinking flags
            raise ValueError(
                f"MiniMax-M4 rejected request payload (verify effort != none): {exc}"
            ) from exc

    raise RuntimeError("Exceeded max retries due to repeated thinking truncation.")

This wrapper catches 429 rate limit TPM spikes with jittered exponential backoff and recovers automatically if max_tokens truncates mid-thought. For broader architectural context on how test-time compute models balance hidden reasoning loops against token budgets, review our reasoning models architecture breakdown.

Managing TPM Rate Limits, SSD Cache Thrashing, and Self-Hosting Gaps

MiniMax enforces combined TPM (input plus output tokens per minute) alongside RPM caps across developer tiers. Submitting five concurrent 800K-token codebase prompts instantaneously consumes 4 million input tokens against a single minute window, triggering HTTP 429 throttling even at low request counts.

To prevent SSD KV cache thrashing and TPM spikes simultaneously, serialize initial prefix-warming calls before fanning out parallel worker queries. Once turn 1 populates the cached prompt prefix, subsequent turns read cached states at $0.05/M while hitting hot MFlashKV blocks with far lower prefill latency.

Finally, teams blocked by a missing open weights deployment for air-gapped VPCs should avoid building custom vLLM or SGLang sharding scripts prematurely. Until MiniMax uploads the official checkpoints and license to GitHub or Hugging Face, route sensitive workloads to already-released open-weight models or isolate non-sensitive coding agents behind MiniMax’s API with strict secret-redaction middleware.

Frequently Asked Questions About MiniMax M4

What is MiniMax M4 and how many parameters does it have?

MiniMax M4 is a natively multimodal Mixture-of-Experts reasoning model released on December 3, 2026, with 2.74 trillion total parameters and 66 billion active parameters per token. It supports a 1-million-token input context window and up to 524,288 completion tokens.

Can you disable thinking or reasoning mode in MiniMax M4?

No, adaptive thinking is always enabled on MiniMax-M4 and sending thinking.type="disabled" or effort="none" returns an HTTP 400 Bad Request error. To lower latency and output token spend, set output_config.effort to "low" or "medium" instead.

How much does the MiniMax M4 API cost per million tokens?

MiniMax M4 uses a flat rate card of $0.80 per million input tokens and $3.10 per million output tokens across its full 1M context window. Prompt cache reads cost $0.05 per million tokens, representing a 93.75% discount on repeated context prefixes.

How does MFlashKV offload MiniMax M4 KV caches to SSDs?

MFlashKV partitions runtime key-value states into 16-token blocks aligned to 4 KiB NVMe SSD pages so historical context transfers asynchronously off High-Bandwidth Memory. Paired with MiniMax Sparse Attention 2 (MSA2) indexer lookahead, this prevents latency stalls on memory-constrained accelerators.

Are MiniMax M4 open weights available for local self-hosting?

MiniMax describes M4 as an open-weight flagship and published the technical report on GitHub under MiniMax-AI/MiniMax-M4, but downloadable model weights are marked as releasing soon rather than live at launch. Even after weight release, serving 2.74 trillion parameters requires multi-node cluster hardware rather than single workstation GPUs.

Which API endpoint should developers use for MiniMax M4?

MiniMax recommends the Anthropic-compatible endpoint at https://api.minimax.io/anthropic because it natively exposes interleaved thinking blocks and output_config.effort controls. Teams standardized on OpenAI clients can use https://api.minimax.io/v1 with reasoning_effort or route via OpenRouter using minimax/minimax-m4.

How does MiniMax M4 compare to Claude Opus 5.5 and Gemini 4 Neon on coding benchmarks?

MiniMax M4 leads open-weight models on Code Arena WebDev (1,731) and Agent Arena Index (1,194) while costing a fraction of proprietary API rates. However, it still trails top proprietary flagships on deep multi-file repository maintenance suites like SWE-Marathon (44.0) and Terminal-Bench 4.1 (56.6).

Production Adoption Verdict

Route interactive web builds, financial synthesis, and high-context agent loops to MiniMax M4 through the Anthropic-compatible endpoint (https://api.minimax.io/anthropic). That gateway preserves native thinking blocks while giving services granular latency control.

Teams should apply three configuration guardrails before promoting the model into production workflows:

  • Pin Effort Explicitly: Pass output_config.effort set to "medium" or "high" on routine endpoints instead of relying on the default "max" depth.
  • Anchor Static Prefixes: Keep repository trees and tool schemas identical at the top of the prompt to capture $0.05/M cached input reads.
  • Enforce Output Headroom: Set max_tokens to 8192 or higher so hidden reasoning never truncates final JSON responses, and keep Claude Opus 5.5 or Gemini 4 Neon for strict multi-file legacy code refactoring until open weights publish.
MiniMax M4 LLMs Open Source AI MoE Architecture AI Agents Python

Found this helpful? Share it with others.

Raj, Founder, AI Agents Kit at AI Agents Kit

Raj

Founder, AI Agents Kit

Raj is the founder of AI Agents Kit, where he writes hands-on guides on AI agents, agent frameworks, Model Context Protocol (MCP), prompt engineering and developer tooling. He builds and tests the tools he covers and focuses on practical, working examples for developers and teams adopting agentic AI.

AI Agents LLMs Prompt Engineering Python TypeScript