Last verified: July 18, 2026. MiniMax exposes an OpenAI-compatible Chat Completions interface, so an application that already uses the OpenAI SDK can point a client at MiniMax with a different base URL, API key, and model ID. For MiniMax M3, the core values are https://api.minimax.io/v1, MiniMax-M3, and the /chat/completions route used by the SDK.
Independence and test notice: MiniMax-AI.chat is an independent website and is not affiliated with or endorsed by MiniMax. We checked these examples against MiniMax’s official OpenAI SDK guide and Chat Completions schema and reviewed the JavaScript and Python syntax. We did not send a live API request because no testing credential was available. Run the verification request in your own MiniMax account before deploying.
Use this page for compatibility, not the whole API
This is a focused implementation guide for the OpenAI-compatible text route. The broader MiniMax API guide maps text, speech, video, image, music, files, credentials, and billing. Read the MiniMax M3 model guide for model capabilities and context, and the MiniMax pricing guide before choosing token limits or a service tier.
| Setting | Value for this guide | Common mistake |
|---|---|---|
| Base URL | https://api.minimax.io/v1 | Keeping the OpenAI host or adding /chat/completions to the SDK base URL |
| Model ID | MiniMax-M3 | Changing capitalization or using a marketing page title as the ID |
| SDK method | chat.completions.create | Mixing Chat Completions fields with Responses API fields |
| Authentication | MiniMax key sent as a Bearer credential | Exposing the key in browser code, a mobile bundle, logs, or Git |
MiniMax’s official OpenAI SDK guide is the authority for the compatibility layer. The official Chat Completions reference is the authority for the request and response schema. Recheck both when upgrading an SDK or model.
Prerequisites and credential safety
- A MiniMax Open Platform account with a key that is valid for the intended billing arrangement.
- A server, command-line environment, or trusted back end. Do not call MiniMax directly from public browser JavaScript with a secret key.
- Node.js with npm for the JavaScript example, or Python with pip for the Python example.
- A spend ceiling, request timeout, retry policy, and log-redaction rule before production traffic.
The official API overview distinguishes pay-as-you-go API keys from Token Plan subscription keys. Do not silently substitute one for the other. Create or copy the credential from the billing path you intend to use, store it in a secret manager or server environment variable, and rotate it if it appears in a screenshot, repository, build artifact, support ticket, or log.
# macOS or Linux shell; replace the placeholder in your local shell only
export MINIMAX_API_KEY="replace-with-your-secret"
# Never commit the real value to source control.
Node.js quick start
Install the OpenAI package:
npm install openai
Save the following as minimax-chat.mjs. This first request explicitly disables M3 thinking so the printed content is a direct answer. A later section explains the default behavior and separated reasoning format.
import OpenAI from "openai";
const apiKey = process.env.MINIMAX_API_KEY;
if (!apiKey) {
throw new Error("MINIMAX_API_KEY is not set");
}
const client = new OpenAI({
apiKey,
baseURL: "https://api.minimax.io/v1",
});
const response = await client.chat.completions.create({
model: "MiniMax-M3",
messages: [
{
role: "system",
content: "Answer concisely. State uncertainty instead of guessing.",
},
{
role: "user",
content: "Give three checks for reviewing an API migration.",
},
],
thinking: { type: "disabled" },
max_completion_tokens: 800,
temperature: 0.3,
});
const answer = response.choices[0]?.message?.content;
if (!answer) {
throw new Error("MiniMax returned no text choice");
}
console.log(answer);
console.log({ responseId: response.id, usage: response.usage });
Run it with node minimax-chat.mjs. The MiniMax-only thinking field is sent as an extra request field by this plain JavaScript example. If TypeScript definitions in your installed OpenAI package reject that extension, add a narrow local request type or use the standard fields only; do not suppress type checking across the project.
Python quick start
python -m pip install openai
MiniMax-specific request fields belong in extra_body when using the Python OpenAI SDK:
import os
from openai import OpenAI
api_key = os.environ.get("MINIMAX_API_KEY")
if not api_key:
raise RuntimeError("MINIMAX_API_KEY is not set")
client = OpenAI(
api_key=api_key,
base_url="https://api.minimax.io/v1",
)
response = client.chat.completions.create(
model="MiniMax-M3",
messages=[
{
"role": "system",
"content": "Answer concisely. State uncertainty instead of guessing.",
},
{
"role": "user",
"content": "Give three checks for reviewing an API migration.",
},
],
max_completion_tokens=800,
temperature=0.3,
extra_body={"thinking": {"type": "disabled"}},
)
answer = response.choices[0].message.content
if not answer:
raise RuntimeError("MiniMax returned no text choice")
print(answer)
print({"response_id": response.id, "usage": response.usage})
Streaming in Node.js
Streaming reduces the delay before a user sees output; it does not reduce the total generated tokens by itself. A stream can end early, fail between chunks, or finish without usage data unless usage is requested. Build the final text on the server, persist it only after a successful completion, and show a clear partial-result state after interruption.
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.MINIMAX_API_KEY,
baseURL: "https://api.minimax.io/v1",
});
const stream = await client.chat.completions.create({
model: "MiniMax-M3",
messages: [{ role: "user", content: "Explain idempotency in five bullets." }],
thinking: { type: "disabled" },
max_completion_tokens: 900,
stream: true,
stream_options: { include_usage: true },
});
let assembled = "";
let usage;
for await (const chunk of stream) {
const part = chunk.choices[0]?.delta?.content ?? "";
// Handles either incremental chunks or a cumulative text field.
const addition = part.startsWith(assembled)
? part.slice(assembled.length)
: part;
process.stdout.write(addition);
assembled = part.startsWith(assembled) ? part : assembled + part;
if (chunk.usage) usage = chunk.usage;
}
process.stdout.write("\n");
console.log({ characters: assembled.length, usage });
Streaming in Python
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["MINIMAX_API_KEY"],
base_url="https://api.minimax.io/v1",
)
stream = client.chat.completions.create(
model="MiniMax-M3",
messages=[
{"role": "user", "content": "Explain idempotency in five bullets."}
],
max_completion_tokens=900,
stream=True,
stream_options={"include_usage": True},
extra_body={"thinking": {"type": "disabled"}},
)
assembled = ""
usage = None
for chunk in stream:
if chunk.choices:
part = chunk.choices[0].delta.content or ""
else:
part = ""
addition = part[len(assembled):] if part.startswith(assembled) else part
print(addition, end="", flush=True)
assembled = part if part.startswith(assembled) else assembled + part
if chunk.usage:
usage = chunk.usage
print()
print({"characters": len(assembled), "usage": usage})
Some usage-only chunks can have no choice, so the example checks the list before reading a delta. In production, wrap the loop in exception handling, emit an application-level completion event, and do not retry after showing output unless your interface clearly marks the replacement response. An automatic retry can create duplicated or conflicting text.
M3 thinking: two controls with different jobs
MiniMax M3 thinking is enabled by default in Chat Completions when the thinking field is omitted. Set {"type":"adaptive"} to keep it enabled explicitly, or {"type":"disabled"} to request a direct answer. MiniMax documents that thinking cannot be disabled for the listed M2.x models even if the disabled value is accepted.
reasoning_split does not turn thinking on or off. It only changes the response format. With the split enabled, MiniMax exposes thinking through reasoning fields; without it, the native Chat Completions response can place thinking inside <think>...</think> tags in content. Keep these concerns separate:
| Goal | Request choice | Handling rule |
|---|---|---|
| Direct answer without M3 thinking | thinking: {"type":"disabled"} | Still validate the answer; disabled thinking is not a factuality guarantee |
| M3 thinking in native content | Omit thinking and leave reasoning_split false | Do not render raw reasoning tags as normal answer text |
| M3 thinking in separate fields | reasoning_split: true | Preserve required reasoning fields in a multi-turn tool history, but do not expose them in user-facing logs |
For tool calls, MiniMax instructs developers to append the complete assistant message, including tool_calls, to conversation history. When separated reasoning is used, preserve its reasoning details as well. The full safe loop belongs in our MiniMax function-calling guide; this page intentionally stops at the compatibility boundary.
Supported parameters and compatibility gaps
| Parameter | M3 behavior documented by MiniMax | Implementation advice |
|---|---|---|
messages | Required conversation history; supports text and documented media/tool content forms | Validate roles and cap input size before sending |
max_completion_tokens | Generation limit; preferred over legacy max_tokens | Begin with a task-sized ceiling and measure stop reasons |
temperature | Range 0–2; default 1 | Use a lower value for constrained extraction, but test rather than assuming determinism |
top_p | Range 0–1; M3 default 0.95 | Change one sampling control at a time during evaluation |
stream | Returns chunks when true | Assemble, validate, and mark completion server-side |
stream_options.include_usage | Requests usage data in a stream | Do not assume every interrupted stream has final usage |
service_tier | standard or priority | Confirm eligibility and cost before selecting priority |
tools | Function tool definitions | Use an allowlist, validate arguments, and execute tools in your code |
reasoning_split | Separates reasoning output; does not control whether thinking runs | Preserve required history fields during tool loops |
Compatibility does not mean every OpenAI field has equivalent behavior. MiniMax says presence_penalty, frequency_penalty, logit_bias, and some other OpenAI parameters are ignored. The n field supports only 1. The deprecated function_call field is unsupported; use tools. Remove ignored fields during migration so configuration does not imply a control that the provider does not apply.
Multimodal input without duplicating the M3 guide
MiniMax documents image and video content parts for M3 through the OpenAI-compatible Chat Completions route, while audio input is unsupported there. Media requests add file-format, payload-size, token-use, URL-access, and privacy considerations. Do not paste a media example into a text endpoint and assume it is portable. Use the model page linked above for capability context and a dedicated multimodal implementation guide for upload and size rules.
Migration checklist from another OpenAI-compatible provider
- Change the base URL and secret source; do not change both in a shared global client if other providers still use it.
- Set the exact model ID
MiniMax-M3. - Remove unsupported or ignored parameters and set
nto one. - Choose M3 thinking behavior explicitly and decide how reasoning fields are stored and hidden.
- Replace legacy
function_callwithtoolsif the application uses functions. - Test plain text, long input, stop due to length, streaming interruption, rate limits, invalid authentication, safety rejection, and provider outage.
- Record quality, latency, prompt tokens, completion tokens, cache tokens where present, and total cost on a fixed evaluation set.
- Canary the provider change for a small traffic share and keep a reversible configuration switch.
If your application uses an Anthropic-style message loop, compare the MiniMax Anthropic-compatible API guide. If you need item-based response objects, read the separate MiniMax Responses API guide. MiniMax-hosted Server Tools are a separate beta capability documented for Anthropic Messages only, not for this OpenAI-compatible route. Reusing an SDK shape is helpful; it does not make the API families interchangeable.
Troubleshooting
| Symptom | First checks |
|---|---|
| Authentication error | Confirm the MiniMax key source, environment variable, billing path, and absence of spaces or quote characters copied into the value |
| Model error | Check exact capitalization: MiniMax-M3; verify the account can access that model |
| 404 or wrong host | Use https://api.minimax.io/v1 as the SDK base URL, without appending the endpoint path |
Unexpected <think> text | Thinking is enabled by default; disable it or deliberately parse the documented separated format |
| Parameter appears ineffective | Remove fields MiniMax lists as ignored; confirm ranges and spelling for supported fields |
| Only one choice is returned | This interface supports n=1 |
| Stream duplicates text | Check whether the received field is incremental or cumulative and use one assembly strategy consistently |
| Tool conversation degrades after a call | Preserve the complete assistant message, tool call, tool result, and separated reasoning details when used |
Capture the HTTP status, response body after redaction, response ID when supplied, model ID, endpoint, timestamp, and a minimal reproducible request. Never log the Authorization header or unredacted user material. Use our MiniMax API errors and retry guide for status-aware backoff and debugging.
Production acceptance test
- Security: the key exists only on trusted infrastructure and is redacted from logs.
- Correctness: a fixed prompt set has expected assertions, not subjective spot checks.
- Streaming: cancellation, disconnect, timeout, and partial output have defined UI states.
- Cost: usage fields are captured and reconciled against the account bill on a sample.
- Resilience: retries apply only to retryable failures, use backoff and jitter, and respect a total attempt budget.
- Safety: input handling, output review, tool permissions, and abuse controls match the use case.
- Change control: base URL, model, token ceiling, thinking mode, and tier are versioned configuration rather than scattered literals.
FAQ
Can I change only the base URL in an existing OpenAI integration?
Usually not. You must also supply a MiniMax credential and model ID, then audit parameters, thinking output, tool history, stream assembly, limits, errors, and quality. The transport shape is compatible; provider behavior is not identical.
Does reasoning_split=true enable M3 thinking?
No. It changes where reasoning appears. M3 thinking is enabled by default when thinking is omitted; the thinking object controls adaptive or disabled behavior.
Should I use Chat Completions or Responses?
Use Chat Completions when your application already has a stable message-based OpenAI SDK integration and the documented fields meet the design. Evaluate Responses separately when its item model or server-tool workflow fits better. Do not mix their request objects.
Does OpenAI compatibility make MiniMax an OpenAI service?
No. MiniMax operates the endpoint and models described here. “OpenAI-compatible” refers to an API and SDK format, not ownership, identical outputs, shared accounts, or shared billing.
Implementation conclusion: isolate the MiniMax client, use the exact base URL and model ID, choose thinking behavior deliberately, remove ignored fields, assemble streams defensively, and test against your own acceptance set before moving traffic.
