---
title: "Text Generation OpenAI"
method: POST
path: "/v1/chat/completions"
tags: ["Text Generation"]
---

# Text Generation OpenAI

`POST /v1/chat/completions`

## Request

- Base URL: `https://api.minimax.io`
- URL: `https://api.minimax.io/v1/chat/completions`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/minimax/apis/minimax-text-api-openai/docs/v1/chat/completions/post.ts> (a function with typed inputs; its response is checked against the schema)

## Headers

- `Content-Type` 'application/json', required

## Request body

- ChatCompletionReq
  - `model` 'MiniMax-M3.1-Flash' | 'MiniMax-M3', required: Model ID. Supports `MiniMax-M3.1-Flash` and `MiniMax-M3`.
  - `service_tier` 'standard' | 'priority': Service tier for request admission. Supported values are `standard` and `priority`. If omitted, the request uses the `standard` tier. The `priority` [price](https://platform.minimax.io/docs/pricing/overview#models/text) is 1.5 times the `standard` price and ensures priority admission so the request is processed ahead of other requests, leading to faster responses and fewer failures. `MiniMax-M3.1-Flash` does not support this field.
  - `messages` Message[], required: A list of messages containing the conversation history. Supports text, image, video, and tool call content.
    - `role` 'system' | 'user' | 'assistant' | 'tool', required: Role of the message sender.
    - `name` string: Name of the sender. If there are multiple roles of the same type, a specific name must be provided to distinguish them
    - `content` union: Message content. `MiniMax-M3.1-Flash` and `MiniMax-M3` support text, image, and video content parts.
      - string: Text message content
      - MessageContentPart[]: Multimodal message content parts. `MiniMax-M3.1-Flash` and `MiniMax-M3` support text, image, and video input. **File size and request limits** - URL or Base64 input: video file ≤ 50 MB, image file ≤ 10 MB, request body ≤ 64 MB. - Files API upload: referenced in `content` as `mm_file://{file_id}`, with a single video up to 512 MB.
        - `type` 'text' | 'image_url' | 'video_url', required: Content part type: - `text`: Text part - `image_url`: Image input - `video_url`: Video input
        - `text` string: Text content (when `type` is `text`).
        - `image_url` object: Image input (when `type` is `image_url`). Each image can be up to 10 MB. **Supported image formats** | Format | Common extensions | MIME Type | | :-- | :-- | :-- | | JPEG | .jpg, .jpeg | image/jpeg | | PNG | .png | image/png | | GIF | .gif | image/gif | | WEBP | .webp | image/webp |
          - `url` string, required: Image URL or Base64 data URL.
          - `detail` 'low' | 'default' | 'high': Controls image resolution. Defaults to default. Rough single-image token usage heuristic: | detail | Rough token usage | | :-- | :-- | | low | Usually a few hundred tokens, up to ~600 | | default | Often ~1k-3k tokens, up to ~5k | | high | Often several thousand tokens, up to ~15k+ | Actual usage depends on image size and content; check response usage or token counting where available.
          - `max_long_side_pixel` integer: Longest-side pixel limit for the image.
        - `video_url` object: Video input (when `type` is `video_url`). **Supported video formats** | Format | Common extensions | MIME Type | | :-- | :-- | :-- | | MP4 | .mp4 | video/mp4 | | AVI | .avi | video/avi or video/x-msvideo | | MOV | .mov | URL input: set the object storage Content-Type to video/quicktime; base64 input: use video/mov, i.e. data:video/mov;base64,<BASE64_ENCODING> | | MKV | .mkv | video/x-matroska |
          - `url` string, required: Video URL, Base64 data URL, or Files API reference in the form `mm_file://{file_id}`. To obtain a `file_id`, first upload the video via the [Upload File](/api-reference/file-management-upload) API. URL or Base64 videos can be up to 50 MB; Files API videos can be up to 512 MB.
          - `detail` 'low' | 'default' | 'high': Controls per-frame video resolution. Defaults to default.
          - `fps` number: Video frame sampling rate. Defaults to 1. Range [0.2, 5]. - Higher values: more sensitive to scene changes, but higher token cost and slower response. - Lower values: lower token cost and faster response, but less sensitive to scene changes.
          - `max_long_side_pixel` integer: Longest-side pixel limit for video frames.
    - `tool_calls` ToolCall[]: Tool call list in an assistant message.
      - `id` string, required: Tool call ID, generated by the model.
      - `type` 'function', required: Tool call type. Currently only `function` is supported.
      - `function` object, required
        - `name` string, required: Name of the function to call.
        - `arguments` string, required: Function arguments as a JSON-formatted string.
    - `tool_call_id` string: Tool call ID. Required when `role` is `tool`. Set this to the `id` of the corresponding entry in the assistant message's `tool_calls` so the model can match the tool result with the originating call. Ignored for other roles.
  - `thinking` object: Controls thinking behavior. The `adaptive` default applies to every model here; only the effect of `disabled` differs. - `MiniMax-M3.1-Flash`: always thinks. `disabled` returns HTTP 400. Use `reasoning_effort` to tune thinking depth. - `MiniMax-M3`: adaptive thinking is on by default; `disabled` skips thinking and answers directly.
    - `type` 'disabled' | 'adaptive': Thinking control type. - `disabled`: Skip thinking for `MiniMax-M3` and answer directly. Not supported by `MiniMax-M3.1-Flash`, which returns HTTP 400. - `adaptive`: Enable adaptive thinking. This is the default when `thinking` is omitted, and the only accepted value for `MiniMax-M3.1-Flash`.
  - `reasoning_effort` 'low' | 'medium' | 'high' | 'xhigh' | 'max': Tunes thinking depth. Only `MiniMax-M3.1-Flash` supports real thinking-depth tuning; other models ignore this field. When omitted, its default thinking depth is `max`. `none` is not accepted and returns HTTP 400 because `MiniMax-M3.1-Flash` always thinks.
  - `reasoning_split` boolean: Output-format switch. When `true`, thinking content is separated into the `reasoning_content` field; when `false`, thinking is kept inside `content` wrapped in `<think>` tags. `MiniMax-M3.1-Flash` does not support setting this parameter to `false`. This parameter does not enable or disable thinking.
  - `stream` boolean: Whether to use streaming output, defaults to `false`. When set to `true`, the response will be returned in chunks.
  - `stream_options` object: Streaming response options.
    - `include_usage` boolean: Whether to include token usage in the streaming response.
  - `max_completion_tokens` integer: Specifies the upper limit for generated content length, in tokens. For MiniMax-M3.1-Flash and MiniMax-M3 the recommended value is 131072 (128K) and the maximum is 524288 (512K). If generation stops due to `length`, try increasing this value.
  - `temperature` number, double: Not supported yet; any value passed has no effect. `MiniMax-M3.1-Flash` and `MiniMax-M3` always use 1.
  - `top_p` number, double: Not supported yet; any value passed has no effect. `MiniMax-M3.1-Flash` and `MiniMax-M3` always use 0.95. If passed, the value must be within (0, 1].
  - `tools` object[]: Tool definition list. Function tools are supported.
    - `type` 'function', required: Tool type, always function.
    - `function` object, required
      - `name` string, required: Function name.
      - `description` string: Function description.
      - `parameters` object, required: Function parameters JSON Schema.
  - `max_tokens` integer: Legacy generation length limit parameter. Deprecated; use `max_completion_tokens` instead.

## Response `200`

- ChatCompletionResp
  - `id` string: Unique ID of this response
  - `choices` object[]: List of response choices
    - `finish_reason` 'stop' | 'length' | 'content_filter' | 'tool_calls': Reason for stopping generation: `stop`, `length`, `content_filter`, or `tool_calls`.
    - `index` integer: Index of the choice, starting from 0
    - `message` object: Complete reply generated by the model
      - `content` string, required: Text reply content
      - `reasoning_content` string: Thinking content. Thinking is adaptive, so on a simple turn the model may not think and the field is then absent from the response - check for it before reading it.
      - `role` 'assistant', required: Role, fixed as `assistant`
      - `tool_calls` ToolCall[]: Tool calls generated by the model. Returned only when `finish_reason` is `tool_calls`. Echo each entry back as part of the next-turn assistant message and pair it with a `role: tool` message whose `tool_call_id` equals the entry's `id`.
        - `id` string, required: Tool call ID, generated by the model.
        - `type` 'function', required: Tool call type. Currently only `function` is supported.
        - `function` object, required
          - `name` string, required: Name of the function to call.
          - `arguments` string, required: Function arguments as a JSON-formatted string.
  - `created` integer: Unix timestamp (seconds) when the response was created
  - `model` string: Model ID used for this request
  - `object` 'chat.completion' | 'chat.completion.chunk': Object type. `chat.completion` for non-streaming, `chat.completion.chunk` for streaming
  - `usage` Usage: Token usage statistics for this request
    - `total_tokens` integer: Total number of tokens consumed
  - `input_sensitive` boolean: Whether the input content triggered sensitive word detection. If the input content is severely inappropriate, the API will return a content violation error message with empty reply content
  - `input_sensitive_type` integer: Type of sensitive word triggered by input, returned when input_sensitive is true. Values: 1 Severe violation; 2 Pornography; 3 Advertising; 4 Prohibited; 5 Abuse; 6 Violence/Terrorism; 7 Other
  - `output_sensitive` boolean: Whether the output content triggered sensitive word detection. If the output content is severely inappropriate, the API will return a content violation error message with empty reply content
  - `output_sensitive_type` integer: Type of sensitive word triggered by output
  - `base_resp` object: Error status code and details
    - `status_code` integer: Status code - `1000`: Unknown error - `1001`: Request timeout - `1002`: Rate limit triggered - `1004`: Authentication failed - `1008`: Insufficient balance - `1013`: Internal server error - `1027`: Output content error - `1039`: Token limit exceeded - `2013`: Parameter error For more details, see [Error Code Reference](/api-reference/errorcode)
    - `status_msg` string: Error details

## Changes

- **2026-11-07** `7eae52ebadf1`: 1 warning
  - the `top_p` request property's exclusiveMinimum was set to `0.00`
- **2026-11-06** `0a51cdac775b`: 7 breaking, 1 warning, 4 info
  - removed the enum value `MiniMax-M2` of the request property `model`
  - removed the enum value `MiniMax-M2.1` of the request property `model`
  - removed the enum value `MiniMax-M2.1-highspeed` of the request property `model`
  - removed the enum value `MiniMax-M2.5` of the request property `model`
  - …8 more

[Operation history](https://skmtc.dev/minimax/apis/minimax-text-api-openai/changes/v1/chat/completions/post.md)

---

[API](https://skmtc.dev/minimax/apis/minimax-text-api-openai.md) - [All operations](https://skmtc.dev/minimax/apis/minimax-text-api-openai/llms.txt) - [OpenAPI document](https://skmtc.dev/minimax/apis/minimax-text-api-openai/revisions/7eae52ebadf1?raw)
