MiniMax M4 Lands on AI Gateway: A 3T-Parameter Open-Weight Multimodal Reasoning Model

MiniMax M4 arrives on AI Gateway with 3T parameters and 1M context, targeting coding and computer-use agents.
MiniMax's new flagship model M4 is now available through AI Gateway under the name minimax/minimax-m4. It is an open-weight multimodal reasoning model with 3T total parameters, aimed at coding and computer-use agents, and shows clear improvement on long-horizon coding tasks. For efficiency it uses sparse activation, activating only a small fraction of parameters per token, and it incorporates image token compression and low-memory attention to support a 1M-token context. Reasoning is always on, with effort levels to balance latency and token consumption. Developers can access it via AI SDK, Chat Completions, or coding agents such as Claude Code, Codex, and Cursor. AI Gateway charges provider prices without markup, and Zero Data Retention will be rolled out as more providers support the model—a compliance variable to watch.
Flagship Model Now Available: MiniMax M4 Lands on AI Gateway
MiniMax's new flagship model, M4, is now available through AI Gateway. It is an open-weight multimodal reasoning model aimed primarily at coding and computer-use agents. Compared with MiniMax's previously released models, M4 is dramatically larger, with 3T parameters, and shows clear improvements on long-horizon coding tasks.
For developers, the most immediate change is how to access it: use the model name minimax/minimax-m4 in AI Gateway to make calls. AI Gateway itself provides a unified API for calling models, tracking usage and cost, and supports retries, failover, and performance optimization configurations to improve availability beyond that of a single provider.
Balancing 3T Parameters with Efficiency Design
A 3T-parameter scale means significantly expanded model capacity, but MiniMax has made targeted design choices for inference efficiency. M4 activates only a small fraction of its total parameters per token, so inference remains efficient even with such a massive model.
This "large capacity, sparse activation" approach is a common path for current large models seeking a balance between scale and cost. For users, the key point is this: a larger model does not necessarily mean every call is more expensive—actual cost depends on the proportion of activated parameters and the shape of the request.
Sparse activation and MoE: The phrase "activates only a small fraction of its total parameters per token" describes a Mixture of Experts (MoE) architecture. MoE splits the feed-forward layers into multiple "expert" subnetworks, and a routing network selects only a few experts for each token to participate in computation. This allows the total parameter count to be very large (used to store knowledge capacity), while the computation per forward pass depends only on the number of activated experts. This is also why 3T total parameters does not equal 3T worth of computation—actual FLOPs are usually far below those of a dense model of equivalent scale. Note that MoE still has high VRAM requirements, because all expert weights must reside in memory or be efficiently scheduled, so "cheap" mainly refers to compute rather than memory.
Engineering Optimizations for Multimodality and Long Context
M4 supports text and image input, with a context window of 1M tokens. To make such long context practical, MiniMax made improvements in two areas:
- Image encoding: The new image encoding method converts each image into fewer visual tokens, thereby reducing the number of input tokens for requests that include images.
- Attention design: The new attention mechanism reduces memory usage per token, making a 1M-token context more feasible at the VRAM level.
Both optimizations point to the same goal—controlling the actual cost of long-context and multimodal requests, rather than merely making the window number look big.
Visual tokens and attention memory: When multimodal models process images, they typically first split the image into patches, and each patch is encoded as a visual token and fed into the language model. The higher the image resolution and the finer the splitting, the more tokens there are, and the memory and compute overhead of standard attention grows approximately quadratically with sequence length, so long context becomes a VRAM bottleneck. Compressing visual tokens directly reduces input length; low-memory attention (such as chunked computation and KV cache compression) alleviates VRAM usage under long sequences. Only the combination of the two turns ultra-large windows like 1M tokens from "good-looking numbers" into "requests that can run with acceptable cost."
Always-On Reasoning and Agent Capabilities
M4's reasoning is always on. The model offers different effort levels; lower effort can reduce latency and reasoning token consumption, making it suitable for scenarios more sensitive to response speed.
In terms of capabilities, M4 supports tool calling and accepts text and image input. Combined with a 1M-token context, it is suitable for tasks requiring multi-turn tool interaction, long-document processing, and repository-level understanding. It is officially positioned for coding and computer-use agents, which aligns with the combination of tool calling and long context.
Reasoning effort levels: Before generating an answer, reasoning models first output a chain-of-thought-style set of reasoning tokens, which can improve accuracy on complex tasks but significantly increases latency and billable tokens. Effort levels essentially control how much computation the model invests in the reasoning stage—lower levels compress or skip some reasoning steps and are suitable for simple Q&A and low-latency interaction; higher levels allow longer thinking processes and are suitable for complex coding and multi-step tool calls. For agent scenarios, dynamically selecting the level based on task difficulty is a key means of controlling overall cost.
How to Use It in Coding Agents
In addition to calling it directly through AI SDK or Chat Completions, M4 can also be used in coding agents such as Claude Code, Codex, and Cursor. To do so, install the latest version of Vercel CLI and run the initialization command:
npx vercel ai-gateway setup
Then select minimax/minimax-m4 in the agent. Developers can also try it first in the model playground.
Example call (AI SDK):
import { streamText } from 'ai';
const result = streamText({
model: 'minimax/minimax-m4',
prompt: 'Write a TypeScript function that debounces another function.',
});
for await (const text of result.textStream) {
process.stdout.write(text);
}
Pricing and Data Retention
AI Gateway's pricing strategy reflects provider prices without markup and does not charge a platform fee for inference; this also applies to bring-your-own-key (BYOK) requests. For teams that need to control costs, this reduces the extra overhead introduced by an intermediary layer.
On data retention, Zero Data Retention for M4 on Gateway will be rolled out gradually as more providers support the model. In other words, at the current stage this feature is not yet fully covered, and teams with data compliance requirements need to watch for further progress.
Zero Data Retention (ZDR) and BYOK: Zero Data Retention means the model provider commits not to persistently store request and response content on its side, usually using it only for immediate inference and discarding it afterward. It is a hard threshold when selecting models in compliance-sensitive industries such as finance and healthcare. It requires cooperation at the provider's infrastructure level, so it often cannot be provided by the gateway alone—which is why the article mentions it will be "rolled out gradually as more providers support it." BYOK (Bring Your Own Key) means developers use keys they have applied for with the provider and route requests through the gateway, thereby continuing to use their existing contracts and quotas; AI Gateway also does not add markup for this, meaning the gateway mainly serves as a unified access and observability layer rather than a markup-reselling intermediary.
A Few Observations
M4's release sends two signals. First, open-weight models are advancing toward larger scale and stronger agent capabilities, and the combination of 3T parameters and 1M context has entered a usable engineering range. Second, inference efficiency has become a competitive focus—sparse activation, image token compression, and low-memory attention determine whether a model is affordable in real business use.
For developers, what is worth watching is the model's actual performance on long-horizon coding tasks and when Zero Data Retention will be completed. The former determines whether it can replace the main model in existing coding agents; the latter determines whether it can enter data-sensitive industry scenarios.
Related articles

AI Full-Stack in Practice: Building a Commercial Project with Multi-Agent + React + Elysia
Breaking down Bilibili's AI full-stack course: React+Elysia+PostgreSQL stack, LangGraph multi-agent and MCP protocols, AG-UI components, five stages to build a commercial AI project, and how programmers can master AI with architectural thinking rather than be replaced.

DeepSeek Super Agent Architecture in Practice: Building a Fully Automated AI Workflow from Scratch
A deep dive into DeepSeek's Super Agent architecture: how the Lead-Worker model takes scheduling authority away from the model, with measured speedup data, message routing, Chain of Recall, comparisons with Claude Code and Cursor, and a minimum viable path.

Pineapple Cake-Flavored Financiers: The Hidden Trick of Parmesan Cheese
At NYT Cooking's Cookie Week, baker Sue Li fuses Taiwanese pineapple cake flavor into French financiers, using Parmesan cheese to recreate the sweet-tart layers. Minimal effort, no mixer needed, with full step-by-step instructions.