MiniMax M4 API

Reason through large codebases, tool calls and long documents with text, image or video input

Modalities
Image, Text, VideoText
In / Out price
$0.8/$3.1per 1M
Context window
1M tokens
Released
Dec 3, 2026

MiniMax M4 overview

The pelican test: one prompt, every text model, unedited SVG output from Dec 3, 2026.

SVG of a pelican riding a bicycle, written by MiniMax M4 through AI/ML API

MiniMax M4 by MiniMax

MiniMax M4 is MiniMax's open-weight flagship model. It has 2.74 trillion total parameters, 66 billion active parameters per token and a 1M-token context window.

MiniMax M4 specs

Model ID
minimax/minimax-m4
Developer
MiniMax
Context window
1,000,000 tokens
Max output
262,144 tokens
Input
Image, Text, Video
Output
Text
API
OpenAI-compatible, base URL https://api.aimlapi.com/v1

Reasoning and attention built for long inputs

MiniMax says M4 reasons before answering by breaking complex problems into steps. A single response can run up to 262,144 tokens.

To make the long window practical, M4 uses the MSA2 sparse-attention mechanism in all 68 attention layers. MiniMax reports that, compared with the previous version, MSA2 cuts per-token key-value cache needs by 4×. It also raises prefilling throughput by 4.48× and decoding throughput by 8×. Before relying on the long window, test it with a full-size document or repository from your own work.

Set the reasoning effort

The reasoning effort option controls how much the model reasons before it answers. Lower values give faster responses and use fewer tokens on reasoning. The default is max.

Start with the default and read the answers on your hardest prompts. Then try low or medium on short, simple prompts. Compare answer quality and response time against the default before you switch.

Where M4 fits next to M3.1 Flash

MiniMax recommends M4 for coding, domain knowledge, reinforcement-learning-system work, chip design, finance and business, and computer use. It also recommends it for design tasks involving 3D modeling, games and video production. MiniMax reports a score of 38.2 for M4 on Posttrain Bench v1.2.

MiniMax M3.1 Flash is the related model to compare. It accepts text, image and video input and is built for coding, multi-step agent workflows and visual understanding. Run both on the same set of prompts from your own project before choosing one.

Use cases

Refactor or debug a large codebase by sending many files in one request and asking for a plan before the edits.

Run an agent that calls tools across many steps and reasons about each result before the next call.

Analyze a long report, contract or transcript in a single prompt and return structured output.

Review screenshots, design mockups or video clips as input to a coding or design task.

Capabilities

  • Reasoning
  • Streaming
  • Structured outputs
  • Function calling
  • Vision

MiniMax M4 API pricing

MiniMax M4 pricing in US dollars
UsagePriceUnit
Input$0.81M tokens
Output$3.11M tokens
Cached input$0.051M tokens

Prices from the AI/ML API price list, checked on Dec 3, 2026.

MiniMax M4 vs other models: token prices

AI/ML API input and output rates for 5 models, per million tokens.

AI/ML API model prices in USD per million tokens
ModelInputOutput
MiniMax M4$0.8$3.1
MiniMax M3.1 Flash$0.15$0.6
MiniMax M3$0.3$1.2
MiniMax M2-her$0.3$1.2
MiniMax M2.7 Highspeed$0.6$2.4

How to use the MiniMax M4 API

View docs

Build with your agent

Give your agent the model details, code and documentation.

1Get your API key

Create API key
export AIMLAPI_KEY="8f2b4c7d9a1e6b3f…"

2Make your first request

curl 'https://api.aimlapi.com/v1/chat/completions' \
  -H "Authorization: Bearer $AIMLAPI_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "minimax/minimax-m4",
  "messages": [
    {
      "role": "user",
      "content": "Write a haiku about the ocean."
    }
  ]
}'

Related articles

All posts

MiniMax M4 FAQ

How much does MiniMax M4 cost?

MiniMax M4 costs $0.8 / 1M tokens for input and $3.1 / 1M tokens for output on AI/ML API. Cached input is billed at $0.05 / 1M tokens.

What inputs does MiniMax M4 accept?

It accepts text, image and video input and returns text. Streaming, structured output and tool calling are supported.

How do I control how much the model reasons?

Use the reasoning effort option. The default is max, and lower values give faster responses with fewer tokens spent on reasoning.

How long can a response be?

The maximum output is 262,144 tokens.

What changed against the previous version?

MiniMax says the MSA2 attention mechanism lowers key-value cache needs per token by 4×. It reports prefilling throughput 4.48× higher and decoding throughput 8× higher than the previous version.

What is the MiniMax M4 model ID?

Use minimax/minimax-m4 as the model parameter. Requests go to the OpenAI-compatible endpoint with your AI/ML API key.

What is the context window of MiniMax M4?

MiniMax M4 accepts up to 1,000,000 tokens of context and returns up to 262,144 output tokens.

Start building with MiniMax M4

MiniMax M4 API

minimax/minimax-m4

Build with your agent

Give your agent the model details, code and documentation.

1Get your API key

Create API key
export AIMLAPI_KEY="8f2b4c7d9a1e6b3f…"

2Make your first request

curl 'https://api.aimlapi.com/v1/chat/completions' \
  -H "Authorization: Bearer $AIMLAPI_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "minimax/minimax-m4",
  "messages": [
    {
      "role": "user",
      "content": "Write a haiku about the ocean."
    }
  ]
}'