Skip to main content
To meet developers’ needs for the OpenAI API ecosystem, our API now supports the OpenAI API format. With simple configuration, you can integrate MiniMax capabilities into the OpenAI API ecosystem.
MiniMax-M3.1-Flash-Preview is available only through M Plan and MiniMax Code for now.

Quick Start

1. Install OpenAI SDK

2. Configure Environment Variables

3. Call API

Python

4. Important Note

In multi-turn function call conversations, the complete model response (i.e., the assistant message) must be append to the conversation history to maintain the continuity of the reasoning chain.
  • Append the full response_message object (including the tool_calls field) to the message history
    • For native OpenAI API with MiniMax-M3.1-Flash-Preview MiniMax-M3 MiniMax-M2.7 MiniMax-M2.7-highspeed MiniMax-M2.5 MiniMax-M2.5-highspeed MiniMax-M2.1 MiniMax-M2.1-highspeed MiniMax-M2 models, the content field will contain <think> tag content, which must be preserved completely
    • MiniMax-M3.1-Flash-Preview provides the model’s thinking content separately through the reasoning_content field, which must also be preserved completely

Supported Models

When using the OpenAI SDK, the following MiniMax models are supported:
For details on how tps (Tokens Per Second) is calculated, please refer to FAQ > About APIs.
For more model information, please refer to the standard MiniMax API documentation.

Multimodal Input

OpenAI-compatible Chat Completions support text, image, and video input for MiniMax-M3.1-Flash-Preview and MiniMax-M3. Use image_url content parts for images and video_url content parts for videos. The detail field accepts low, default, or high and defaults to default; max_long_side_pixel can be used to control the longest side. Images support JPEG, PNG, GIF, and WEBP. Videos support MP4, AVI, MOV, and MKV; fps defaults to 1 and accepts values from 0.2 to 5. URL or base64 videos can be up to 50 MB, images can be up to 10 MB, and the request body can be up to 64 MB. For larger videos, upload through the Files API and pass mm_file://{file_id}; Files API videos can be up to 512 MB. Image token usage depends on image size and content. Use this as a rough single-image heuristic; check response usage or token counting where available for exact usage:
Python

MiniMax-M3.1-Flash-Preview / MiniMax-M3 Request Parameters

MiniMax-M3.1-Flash-Preview and MiniMax-M3 support these additional Chat Completions parameters through the OpenAI-compatible API:

Thinking Control

The thinking parameter controls whether the model can emit thinking content. Behavior differs per model:
The error returned for thinking: {"type": "disabled"} or reasoning_effort: "none":
Python

Thinking Depth Control (MiniMax-M3.1-Flash-Preview only)

MiniMax-M3.1-Flash-Preview supports tuning thinking depth with reasoning_effort, from low through medium, high, xhigh, to max. Higher levels make the model think more thoroughly, producing more thinking tokens at higher latency. When omitted, reasoning_effort defaults to max. none is not supported and returns 400.
Python

Examples

Streaming Response

Python

Tool Use & Interleaved Thinking

Learn how to use M3.1-Flash-Preview Tool Use and Interleaved Thinking capabilities with OpenAI SDK, please refer to the following documentation.

Tool Use & Interleaved Thinking

Learn how to leverage MiniMax-M3.1-Flash-Preview tool calling and interleaved thinking capabilities to enhance performance in complex tasks.

Important Notes

  1. The temperature parameter range is [0, 2], recommended value: 1.0, values outside this range will return an error
  2. Some OpenAI parameters (such as presence_penalty, frequency_penalty, logit_bias, etc.) will be ignored
  3. Image and video inputs are supported by MiniMax-M3.1-Flash-Preview and MiniMax-M3 through OpenAI-compatible message content parts; audio input is not currently supported
  4. The n parameter only supports value 1
  5. The deprecated function_call is not supported, please use the tools parameter