Dev.to AI πŸ€– Ai πŸ‘ 2 πŸ“– 4 min read

How to call the MiniMax M4 API (model ID, pricing, code)

MiniMax M4 shipped on 3 December 2026. The useful part for anyone wiring a client is small: the platform model ID is MiniMax-M4, the list price is $0.80 per 1M input tokens and $3.10 per 1M output tokens, and the context

MiniMax M4 shipped on 3 December 2026. The useful part for anyone wiring a client is small: the platform model ID is MiniMax-M4, the list price is $0.80 per 1M input tokens and $3.10 per 1M output tokens, and the context window is 1,000,000 tokens. This is an independent setup note, not an official MiniMax page. I am not publishing a benchmark here.

If you want the longer endpoint and pricing write-up, use the independent MiniMax M4 API guide.

Model ID: which string to send

On the MiniMax platform itself, the ID string is MiniMax-M4. OpenRouter lists minimax/minimax-m4 and names MiniMax as the only provider. Vercel AI Gateway uses the same gateway string. Send the bare MiniMax-M4 ID when your base URL is the platform. Send the slashed gateway string only on that gateway.

Vendor materials describe a natively multimodal Mixture-of-Experts with 2.74 trillion total parameters and 66 billion active parameters per token. OpenRouter's listing adds native image and video understanding; Vercel lists tool calling and text plus image input. Those are input features stated by the gateways, not a second price.

The release is described as open-weight, but the weights are not downloadable today. The official MiniMax-AI/MiniMax-M4 repository says the weights will be released soon, after safety review. You cannot self-host this model yet. Call it through an API.

List prices

Rates below are per 1M tokens, from MiniMax's official blog and the platform pricing overview. M4 sits on the current table next to M3.1-Flash. M3 is on the Legacy table. The cache label differs by row because the sources use different wording.

Model Input / 1M Output / 1M Cache / 1M
M4 $0.80 $3.10 $0.05 cached input
M3.1-Flash $0.15 $0.60 $0.015 cache read
M3 $0.60, listed permanent 50% off to $0.30 $2.40, listed permanent 50% off to $1.20 β€” (not verified in this set)

A quick arithmetic check, not a measured job: 100,000 input tokens plus 5,000 output tokens at the M4 list price is $0.80 Γ— 0.1 + $3.10 Γ— 0.005 = $0.0955, before any cache hit.

Reasoning stays on

Press notes and the OpenRouter model page say thinking cannot be turned off. Official platform docs expose the depth as reasoning_effort on the OpenAI-compatible path and as output_config.effort on the Anthropic-compatible path. The documented levels are low, medium, high, xhigh, and max. The default is max. Vercel describes the intensity as adjustable, which matches picking a level, not an off switch.

Call the MiniMax API

Official model-invocation docs live on platform.minimax.io. The OpenAI-compatible base URL is https://api.minimax.io/v1. The Anthropic-compatible base URL, which those docs call the recommended path, is https://api.minimax.io/anthropic. Export your platform key as MINIMAX_API_KEY and do not put it in a repo.

curl https://api.minimax.io/v1/chat/completions \
  -H "Authorization: Bearer $MINIMAX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-M4",
    "reasoning_effort": "max",
    "messages": [
      {"role": "user", "content": "List three risks in this diff."}
    ]
  }'
# pip install openai
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["MINIMAX_API_KEY"],
    base_url="https://api.minimax.io/v1",
)

resp = client.chat.completions.create(
    model="MiniMax-M4",
    reasoning_effort="max",
    messages=[{"role": "user", "content": "List three risks in this diff."}],
)
print(resp.choices[0].message.content)

The same docs show an Anthropic-compatible POST to https://api.minimax.io/anthropic/v1/messages, with output_config: {"effort": "max"} and a required max_tokens field.

Call it through OpenRouter

If you already have an OpenRouter key, change the base URL and the model string. Keep reasoning_effort out of this sample unless you have confirmed the field on that gateway; OpenRouter's listing only states that reasoning stays on.

curl https://openrouter.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax/minimax-m4",
    "messages": [
      {"role": "user", "content": "List three risks in this diff."}
    ]
  }'
# pip install openai
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["OPENROUTER_API_KEY"],
    base_url="https://openrouter.ai/api/v1",
)

resp = client.chat.completions.create(
    model="minimax/minimax-m4",
    messages=[{"role": "user", "content": "List three risks in this diff."}],
)
print(resp.choices[0].message.content)

What to watch for

The 1,000,000-token context is the figure given by the platform, OpenRouter (as 1.0M), and Vercel AI Gateway. A long context is not free: output is billed at $3.10 per 1M tokens, and the default effort is max.

M3.1-Flash and M3 remain available if you want a cheaper or legacy ID. They are different rows on the price table, not aliases for MiniMax-M4.

I am not repeating vendor leaderboard claims here. MiniMax's own blog says the model sits at the intelligence frontier among Chinese and open-source models on several task families, and also says a substantial gap remains compared with the very best overseas models. Those sentences belong to the vendor, not to this post.

For the compact ID, pricing, and sample set in one place, see the MiniMax M4 API guide.

Sources: MiniMax official blog ("MiniMax M4: The Intelligence Frontier Under Compute Constraints"); MiniMax platform docs (model invocation and pricing overview); MiniMax-AI/MiniMax-M4 GitHub technical report; OpenRouter and Vercel AI Gateway model pages for minimax/minimax-m4.

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.