Create more. Sell more this Black Friday.Explore

MiniMax M4 API

Give MiniMax M4 the source files, test logs and screenshots for a coding task in one 1M-token context window. Use your EvoLink API key to run it and estimate the cost from input, cache hits and output.

MiniMaxText GenerationAvailable
from $0.800 / 1M input tokens
API docs
Agentic codingLong-horizon agentsComputer useImage + video inputChat + Messages + Responses
Production routeLive
Context
1M context · 262K max output
Best For
Complex software engineering, long-horizon agents and professional knowledge work
Input
Text + images + video
Output
Text

Choose MiniMax M4

For cost estimates, enter uncached input and cache hits separately, then add output tokens.

MiniMax M4

MiniMax’s flagship open-weight model for complex coding and long-horizon agents

Selected
Model ID
MiniMax-M4
Best for

Hard multi-step engineering, agent workflows and knowledge work over a 1M-token context; replay the same tasks on a lower-cost model and compare cost per accepted result.

Input
$0.800 / 1M
54.4 cr / 1M
Cache hit
$0.050 / 1M
3.4 cr / 1M
Output
$3.100 / 1M
210.8 cr / 1M

All rates are per 1M tokens, shown in USD and credits, and reflect your account's current pricing.

MiniMax M4 pricing

Estimate what one MiniMax M4 request costs before you integrate. The calculator uses your account's current rates, with official pricing as a reference.

Request calculator

Enter the token mix for one request.

Estimated request cost

MiniMax M4
USD$0.0018
Credits0.1184
Input tokens0.0544 cr
Cache hit tokens0.0007 cr
Output tokens0.0633 cr

Minimum charge: 0.01 credits per request.

Budget guide

Approximate requests using the current token mix.
Add credits
$10
About 5489 requests

For quick testing

$50
About 28716 requests

For regular development

$100
About 57432 requests

For production evaluation

What is MiniMax M4?

MiniMax M4 is an open-weight multimodal reasoning model for software projects that take many edits and test runs to finish. Its 1M-token context window can hold source files, test output and visual references in the same request. It returns text or code that your tools can run.

MiniMax M4 is served on EvoLink under the model ID MiniMax-M4 through Chat Completions · Anthropic Messages · Responses, with the same API key and balance you use for every other model. It offers a 1M context window and up to 262K output tokens, plus coding, multi-step agents, image input.

Model documentationMiniMax model guide

MiniMax M4 specs and capabilities

Numbers come from the EvoLink route configuration; capabilities are what the API exposes today.

Context window
1M tokens
Max output
262K tokens
Input
Text + images + video
Output
Text
Reasoning
Configurable reasoning effort
Tool use
Function calling with multi-step tool sequences
Prompt caching
Automatic cache reads at a lower rate
Protocols
Chat Completions · Anthropic Messages · Responses
Model ID
MiniMax-M4
Parameters
2.74T

The API model ID is MiniMax-M4. Copy it into the model field of your request. MiniMax M3.1 Flash and MiniMax-M3 are separate models with their own rates.

How do I use MiniMax M4 on EvoLink?

Use the EvoLink API for product backends and batch jobs, or call MiniMax M4 from Codex, Claude, or Gemini for coding and analysis workflows. Both paths share the same EvoLink API key, balance, model ID, and request history.

Option 1

Integrate with the EvoLink API

Best for: product backends, batch jobs, automated pipelines

Send OpenAI-compatible Chat Completions (or Anthropic Messages) requests to EvoLink and control the model ID, system prompt, output budget, tools, and structured output.

  1. 1Create an EvoLink API key in the console
  2. 2Point your OpenAI or Anthropic SDK at the EvoLink base URL and select the model ID shown above
  3. 3Send one representative request and read the usage field for input, cached, and output tokens
  4. 4Set max_tokens and retries per task; keep tool-call IDs and results across turns
Option 2

Call it with an Agent

Best for: coding, review, and analysis tasks in Codex, Claude, and Gemini

Give the Agent the task, the inputs to include, and the acceptance criteria. It assembles the request, calls MiniMax M4 through EvoLink, and returns the answer with token usage.

  1. 1Set EVOLINK_API_KEY in your local environment; never put it in code or a prompt
  2. 2Describe the task, the inputs to include, and the expected output format
  3. 3Ask the Agent to call MiniMax M4 through EvoLink and show the request before sending
  4. 4Let the Agent report the answer, token usage, and any error body

MiniMax M4 use cases

Pick a task you can test end to end. Give the model the same inputs and tools that it would have in your application.

Fix a bug across files

A customer changes a product filter on page three and gets an empty list. Give the agent the filter component, pagination code and failing test. Check that the fix resets the page and that navigating back still restores the previous filters.

Run long-horizon autonomous tasks

Break a multi-hour objective into tool calls with clear checkpoints. Evaluate whether the agent keeps track of state, recovers from failed steps and stops at your success criteria rather than drifting.

Drive computer-use workflows

Pair the model with a computer-use or browser tool and screenshots of the interface. Measure task completion and the number of corrective steps; the clicks and keystrokes come from the tool your application connects.

Produce professional deliverables

Ask for financial models, presentations or research reports from source data and explicit assumptions. The files are produced by code and connected tools; review formulas, figures and sources before using the output.

Prototype an interactive product page

Give the model photos of a desk lamp and ask for a browser prototype with a rotatable 3D view and a finish selector. Run the code and check that touch rotation works and switching finishes preserves the viewing angle.

Understand images and video

Use image and video input to review designs, documents, screen recordings or footage, then request a structured text answer. Frame-accurate extraction, transcription and editing need the relevant tools in your application.

Compare MiniMax M4 with MiniMax M3.1 Flash and GLM-5.4

EvoLink

M4 and M3.1 Flash both have a 1M-token context window. Try M4 for a fix that spans several files and the lower-cost M3.1 Flash for classification or short edits. If the task involves screenshots, include GLM-5.4 in the same test. The table shows your account rates. Compare test results, revision rounds and total cost for the same task.

MiniMax M4
Input / output$0.8 / $3.1
Context1M
CachingAutomatic cache hits
Best forHard multi-step engineering, agent workflows and knowledge work over a 1M-token context; replay the same tasks on a lower-cost model and compare cost per accepted result.
MiniMax M3.1 Flash
Input / output$0.15 / $0.6
Context1M
CachingAutomatic cache hits
Best forAgentic coding, tool-calling loops and long-context tasks
GLM-5.4
Input / output$1.118 / $3.912
Context1M
CachingAutomatic cache hits
Best forCoding agents, screenshot-driven fixes, long task chains

How do you send your first MiniMax M4 request?

Four steps from an API key to production traffic.

01

Copy the exact model ID

Use MiniMax-M4 exactly as written. The copy button on the Models card gives the exact string; the page URL uses a different form.

Model configuration
02

Send a small text request

Start on the protocol your stack already speaks, set an explicit output limit, and confirm the answer, any reasoning field and usage on a small request.

First request
03

Add tools, images or video

Return earlier assistant turns unchanged in multi-turn tool conversations. For media, send image or video content in the format your protocol documents, then compare usage with the text-only task.

Tools and media
04

Stabilise the prefix, then scale up

Keep reusable context stable, measure cache hits instead of assuming them, and increase traffic once quality, latency and final charges pass your acceptance criteria.

Gradual rollout

How do you keep MiniMax M4 API cost predictable?

Use the request calculator with the token counts from a sample run. For a coding task, add up the charges for every turn through the first patch that passes review.

Count cache hits once

For a request with 10,000 input tokens including 8,000 cache hits, enter 2,000 uncached input tokens and 8,000 cached tokens. Enter the reported output separately.

Leave room in the output limit

Reasoning counts toward max_tokens. A limit that is too small can stop before the answer while the reasoning is still billed. Set limits per task and detect truncation through finish_reason.

Keep the prefix stable so it caches

Cached input is billed at a small fraction of fresh input. Put reusable instructions, tool definitions and long documents first, keep them identical across turns, and read the cached tokens in usage.

Measure images and video on your own content

Image tokens vary with size, and video tokens with length and frame rate. Run a representative sample and use the reported input tokens in the calculator.

MiniMax M4 API code example and error handling

This Chat Completions request asks MiniMax-M4 a JavaScript question. It uses medium reasoning effort and a 2,048-token output budget.

View complete API docs
cURL
curl -X POST https://direct.evolink.ai/v1/chat/completions \
  -H "Authorization: Bearer $EVOLINK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-M4",
    "messages": [
      { "role": "user", "content": "In one sentence, explain why Array.sort() sorts [2, 10] as [10, 2] in JavaScript." }
    ],
    "reasoning_effort": "medium",
    "max_tokens": 2048
  }'
Python
import json
import os
from urllib.request import Request, urlopen

payload = {
    "model": "MiniMax-M4",
    "messages": [{"role": "user", "content": "In one sentence, explain why Array.sort() sorts [2, 10] as [10, 2] in JavaScript."}],
    "reasoning_effort": "medium",
    "max_tokens": 2048,
}
request = Request(
    "https://direct.evolink.ai/v1/chat/completions",
    data=json.dumps(payload).encode(),
    headers={
        "Authorization": "Bearer " + os.environ["EVOLINK_API_KEY"],
        "Content-Type": "application/json",
    },
)
with urlopen(request, timeout=120) as response:
    print(json.load(response)["choices"][0]["message"]["content"])
JavaScript (Node.js)
// Run as a .mjs file with Node.js 18 or later.
const response = await fetch("https://direct.evolink.ai/v1/chat/completions", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.EVOLINK_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "MiniMax-M4",
    messages: [{ role: "user", content: "In one sentence, explain why Array.sort() sorts [2, 10] as [10, 2] in JavaScript." }],
    reasoning_effort: "medium",
    max_tokens: 2048,
  }),
})
if (!response.ok) throw new Error(await response.text())
const data = await response.json()
console.log(data.choices[0].message.content)

Invalid request or unsupported parameter

Check the model ID, the messages array, and parameter ranges against the API reference; remove fields this route does not support.

Authentication or balance issue

Check the Authorization bearer token and confirm the available balance in the console.

Context length exceeded

Prompt tokens exceed the MiniMax M4 context window. Trim or retrieve only the relevant evidence and reuse cached prefixes.

Rate limited (429)

Back off and retry with jitter; batch or queue requests instead of sending parallel bursts.

Content or tool call rejected

Review sensitive content, malformed tool-call arguments, and JSON schema mismatches before retrying.

What should you confirm before moving MiniMax M4 to production?

Verify output quality, supported controls and actual charges on representative traffic.

The model ID, protocol and limits are wired correctly

Confirm requests send MiniMax-M4 with an explicit output limit, and that usage reports input, cached and output tokens separately.

Reasoning and output settings fit M4

Do not send disabled thinking or an effort of none: M4 rejects both with a 400 error. Keep max_tokens at or below 262,144 and leave room for reasoning within it.

Quality holds on your existing prompts

Replay a fixed set of real tasks through your current model and M4, and compare instruction following, tool results and accepted output rather than assuming prompts carry over.

Latency and errors behave under load

Long reasoning and long agent runs mean longer responses. Watch time to first token and total latency on representative traffic, and prepare for rate limits and timeouts.

Start with representative tasks, explicit output limits and a small traffic share. Expand when quality, latency and cost per accepted result meet your bar, and keep a verified fallback model in configuration rather than in code.

MiniMax Model Family

Same API key and balance — switch tiers without changing your integration.

MiniMax M3.1 Flash

MiniMax M3.1 Flash

MiniMax’s M-series Flash model for agentic coding, with tunable thinking depth

View model
MiniMax-M3

MiniMax-M3

MiniMax’s 1M-context multimodal model, with thinking you can switch off

View model
MiniMax-M2.5

MiniMax-M2.5

MiniMax’s lower-cost M2.5 model for text workloads, with optional web search

View model

Other text models on EvoLink besides MiniMax M4

DeepSeek V4 Pro

DeepSeek V4 Pro

DeepSeek’s V4 Pro reasoning model — a close comparison when you weigh open models for coding agents on quality and price.

View model
Kimi K3.1 Pro

Kimi K3.1 Pro

Moonshot’s Kimi K3.1 Pro for long-context agent work, useful as a second open-model benchmark on the same tasks.

View model
Claude Sonnet 5.5

Claude Sonnet 5.5

Anthropic’s Sonnet for everyday coding and high-volume agents — a reference point for tool reliability and review quality.

View model
GPT-6.2 Sol

GPT-6.2 Sol

OpenAI’s GPT-6.2 Sol, useful as a premium quality ceiling when you want to know what the same task costs elsewhere.

View model

MiniMax M4 guides and related reading

MiniMax M3.1 Flash vs M3: When Should You Switch?

MiniMax M3.1 Flash vs M3: When Should You Switch?

How to compare MiniMax models on reasoning controls, response handling and cost per accepted result before moving a workload.

Read guide
MiniMax M3.1 Flash for Coding: Three Tasks and Checks

MiniMax M3.1 Flash for Coding: Three Tasks and Checks

Three coding evaluation tasks with prompts, evidence and patch acceptance checks you can reuse when testing a newer MiniMax model.

Read guide

MiniMax M4 API FAQ

What is the MiniMax M4 model ID?

Send MiniMax-M4 exactly as shown. The page URL /minimax-m4 is a web address, not the model ID.

Which protocols can I call it on?

The same model ID works on Chat Completions (/v1/chat/completions), Anthropic Messages (/v1/messages) and Responses (/v1/responses). Validate streaming, tool calls and usage on the protocol you choose before production.

What input does it accept?

Text, images and video. Image and video tokens are billed at the input rate; there is no separate media charge. Media token counts vary with size, length and resolution, so measure them on representative files.

Is MiniMax M4 open-weight, and can I self-host it?

MiniMax describes M4 as an open-weight model. Hosting a model with 2.74 trillion total parameters needs substantial infrastructure, so check the official release and license terms before planning it. Through EvoLink you call the hosted model with an API key and pay per token.

What do 2.74T total and 66B active parameters mean?

M4 has 2.74 trillion parameters in total, but only about 66 billion are active for each token, which is how MiniMax keeps inference efficient at this scale. Parameter counts alone do not predict quality, latency or cost on your workload.

Can MiniMax M4 generate images, videos or presentations?

Its model output is text. MiniMax highlights end-to-end deliverables such as financial models, presentations, interactive websites, 3D scenes, games and videos; these come from the code, files and tools the model works with in an agent environment, not from native media output by the language model.

How large is the context window?

MiniMax M4 has a 1,000,000-token context window and an output limit of 262,144 tokens per request. Reasoning and the final answer both count toward that output limit, so leave room in max_tokens. On EvoLink, long prompts are billed at the same rates; send only the material the task needs.

How does caching work?

Caching is automatic: repeated prompt prefixes can be served from cache and are billed at the lower cached-input rate when usage reports them. Keep reusable instructions first and unchanged; a cache hit is not guaranteed.

Can I control how much the model reasons?

You can set the depth but not turn reasoning off. Choose low, medium, high, xhigh or max; if you omit it, M4 uses max. Chat Completions takes reasoning_effort, Messages takes output_config.effort and Responses takes reasoning.effort. Requests that disable thinking or set the effort to none are rejected with a 400 error.

How are reasoning tokens billed?

Reasoning tokens count as output: they are billed at the output rate and count toward your max_tokens limit. Check usage to see how much reasoning adds on your tasks.

How is it different from MiniMax M3.1 Flash?

Both have a 1M-token context window, text, image and video input, the same three protocols and the same reasoning controls. M4 caps output at 262,144 tokens versus 524,288 on M3.1 Flash. M4 is MiniMax’s flagship for the hardest engineering and agent work and costs more per token; M3.1 Flash is the lower-cost option for high-volume calls. On EvoLink they have separate model IDs and rates, so compare both Pricing sections.

What are MiniMax Sparse Attention 2 and MFlashKV?

They are the attention and KV-cache techniques MiniMax describes for serving M4 with low latency and high throughput at trillion-parameter scale. They explain MiniMax’s efficiency claims; measure latency and throughput on your own traffic through the route you use.