> ## Documentation Index
> Fetch the complete documentation index at: https://evolink.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# MiniMax 全模型接口 - Chat Completions 快速开始

> - 使用 OpenAI Chat Completions 协议调用 MiniMax 系列模型，通过 `model` 参数选择具体型号
- 最少只需 `model` 与 `messages` 两个参数
- 全系列默认思考，思考 token 计入输出并按输出价计费
- 需要流式输出、工具调用、思考深度调节、图像与视频输入等能力，请查看「完整参数」页

> [!NOTE]
>
> **BaseURL 说明**：默认 BaseURL 为 `https://direct.evolink.ai`，对文本模型支持更好，支持长连接；`https://api.evolink.ai` 是多模态主力地址，对文本模型作为备用地址使用。

> [!NOTE]
>
> **MiniMax 系列默认思考**，思考内容通过 `reasoning_content` 返回，思考 token 计入输出并按输出价计费。`MiniMax-M3` 默认把思考内容以 `<think>...</think>` 放在 `content` 开头，需要分开时请设置 `reasoning_split: true`，详见[完整参数](https://evolink.ai/docs/cn/api-manual/language-series/minimax/chat-completions/chat-completions-reference.md)。


## OpenAPI

````yaml cn/api-manual/language-series/minimax/chat-completions/chat-completions-quickstart.json POST /v1/chat/completions
openapi: 3.1.0
info:
  title: MiniMax 全模型接口 - Chat Completions 快速开始
  description: >-
    通过 OpenAI 兼容的 Chat Completions 接口调用 MiniMax 系列文本模型的快速开始示例。只需 `model` 与
    `messages` 两个参数即可发起对话；完整参数请查看「完整参数」页。
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: 生产环境（推荐）
  - url: https://api.evolink.ai
    description: 备用地址
security:
  - bearerAuth: []
tags:
  - name: 对话生成
    description: AI 对话生成相关接口
paths:
  /v1/chat/completions:
    post:
      tags:
        - 对话生成
      summary: MiniMax 快速对话（全模型）
      description: |-
        - 使用 OpenAI Chat Completions 协议调用 MiniMax 系列模型，通过 `model` 参数选择具体型号
        - 最少只需 `model` 与 `messages` 两个参数
        - 全系列默认思考，思考 token 计入输出并按输出价计费
        - 需要流式输出、工具调用、思考深度调节、图像与视频输入等能力，请查看「完整参数」页
      operationId: createChatCompletionMiniMaxQuick
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionQuickRequest'
            examples:
              simple:
                summary: 最简调用
                value:
                  model: MiniMax-M4
                  messages:
                    - role: user
                      content: Please introduce yourself in one sentence.
              flash:
                summary: 调用 MiniMax-M3.1-Flash
                value:
                  model: MiniMax-M3.1-Flash
                  messages:
                    - role: user
                      content: Explain HTTP in one sentence.
              m3:
                summary: 调用 MiniMax-M3
                value:
                  model: MiniMax-M3
                  messages:
                    - role: user
                      content: Explain HTTP in one sentence.
              m25:
                summary: 调用 MiniMax-M2.5
                value:
                  model: MiniMax-M2.5
                  messages:
                    - role: user
                      content: Explain HTTP in one sentence.
              multi_turn:
                summary: 多轮对话
                value:
                  model: MiniMax-M4
                  messages:
                    - role: user
                      content: Recommend a programming language for beginners.
                    - role: assistant
                      content: >-
                        Python is a good choice: simple syntax and a large
                        ecosystem.
                    - role: user
                      content: How long does it take to learn?
      responses:
        '200':
          description: 对话生成成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
              examples:
                with_thinking:
                  summary: 包含思考内容
                  value:
                    id: example_c425f5
                    choices:
                      - finish_reason: stop
                        index: 0
                        message:
                          content: '0.05'
                          role: assistant
                          name: MiniMax AI
                          reasoning_content: >-
                            Let the ball cost x. Then 2x + 1 = 1.10, so x =
                            0.05.
                    created: 1792401901
                    model: MiniMax-M3.1-Flash
                    object: chat.completion
                    usage:
                      total_tokens: 281
                      total_characters: 0
                      prompt_tokens: 229
                      completion_tokens: 52
                      completion_tokens_details:
                        reasoning_tokens: 49
                      prompt_tokens_details:
                        cached_tokens: 187
                direct_answer:
                  summary: 直接回答（无思考内容）
                  value:
                    id: example_c7cb0e
                    choices:
                      - finish_reason: stop
                        index: 0
                        message:
                          content: >-
                            Recursion is a technique in which a function calls
                            itself to solve smaller instances of a problem.
                          role: assistant
                          name: MiniMax AI
                    created: 1792401868
                    model: MiniMax-M3.1-Flash
                    object: chat.completion
                    usage:
                      total_tokens: 219
                      total_characters: 0
                      prompt_tokens: 208
                      completion_tokens: 11
                      prompt_tokens_details:
                        cached_tokens: 58
                tool_calls:
                  summary: 触发工具调用（finish_reason=tool_calls）
                  value:
                    id: example_2d249e
                    choices:
                      - finish_reason: tool_calls
                        index: 0
                        message:
                          content: I'll check the stock for product demo-item-001.
                          role: assistant
                          name: MiniMax AI
                          tool_calls:
                            - id: call_example_1
                              type: function
                              function:
                                name: get_product_stock
                                arguments: '{"product_id": "demo-item-001"}'
                              index: 0
                    created: 1792401870
                    model: MiniMax-M3.1-Flash
                    object: chat.completion
                    usage:
                      total_tokens: 483
                      total_characters: 0
                      prompt_tokens: 446
                      completion_tokens: 37
                      prompt_tokens_details:
                        cached_tokens: 227
                length:
                  summary: 达到输出上限（finish_reason=length）
                  value:
                    id: example_a5ad57
                    choices:
                      - finish_reason: length
                        index: 0
                        message:
                          content: ''
                          role: assistant
                          name: MiniMax AI
                          reasoning_content: I need to explain the process step by step.
                    created: 1792401615
                    model: MiniMax-M3.1-Flash
                    object: chat.completion
                    usage:
                      total_tokens: 219
                      total_characters: 0
                      prompt_tokens: 211
                      completion_tokens: 8
                      completion_tokens_details:
                        reasoning_tokens: 8
                      prompt_tokens_details:
                        cached_tokens: 184
                m3_inline_thinking:
                  summary: MiniMax-M3 默认返回（思考内容在 content 开头）
                  value:
                    id: example_818ad0
                    choices:
                      - finish_reason: stop
                        index: 0
                        message:
                          content: >-
                            <think>Let the ball cost x. Then 2x + 1 = 1.10, so x
                            = 0.05.</think>


                            0.05
                          role: assistant
                    created: 1796307610
                    model: MiniMax-M3
                    object: chat.completion
                    usage:
                      total_tokens: 308
                      total_characters: 0
                      prompt_tokens: 224
                      completion_tokens: 84
                      completion_tokens_details:
                        reasoning_tokens: 78
                      prompt_tokens_details:
                        cached_tokens: 193
                m25_answer:
                  summary: MiniMax-M2.5 返回
                  value:
                    id: chatcmpl-example
                    choices:
                      - finish_reason: stop
                        index: 0
                        message:
                          content: >-
                            Recursion is a technique in which a function calls
                            itself to solve smaller instances of a problem.
                          reasoning_content: >-
                            The user wants a one-sentence definition of
                            recursion.
                          role: assistant
                    created: 1796307389
                    model: MiniMax-M2.5
                    object: chat.completion
                    usage:
                      prompt_tokens: 44
                      completion_tokens: 90
                      total_tokens: 134
                      completion_tokens_details:
                        reasoning_tokens: 84
                      prompt_tokens_details:
                        cached_tokens: 0
        '400':
          description: 请求参数错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  message: Invalid request parameters
                  type: invalid_request_error
                  param: ''
                  code: null
        '401':
          description: 未认证、Token 无效或过期
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 401
                  message: Invalid or expired token
                  type: authentication_error
        '402':
          description: 配额不足、需要充值
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 402
                  message: Insufficient quota
                  type: insufficient_quota_error
        '403':
          description: 无权限访问该模型
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 403
                  message: Access denied for this model
                  type: permission_error
                  param: model
        '404':
          description: 资源不存在
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 404
                  message: Specified model not found
                  type: not_found_error
                  param: model
        '413':
          description: 请求体过大
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 413
                  message: Request body too large
                  type: request_too_large_error
                  param: messages
        '429':
          description: 请求频率超限
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 429
                  message: Rate limit exceeded
                  type: rate_limit_error
        '500':
          description: 服务器内部错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 500
                  message: Internal server error
                  type: internal_server_error
        '502':
          description: 网关错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 502
                  message: Bad gateway
                  type: bad_gateway_error
        '503':
          description: 服务暂时不可用
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 503
                  message: Service temporarily unavailable
                  type: service_unavailable_error
components:
  schemas:
    ChatCompletionQuickRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          description: |-
            要调用的模型：

            | 模型 ID | 说明 |
            |---|---|
            | `MiniMax-M4` | 最新一代模型，支持图像与视频输入；1M 上下文，最大输出 262,144 tokens |
            | `MiniMax-M3.1-Flash` | 支持图像与视频输入；1M 上下文，最大输出 524,288 tokens |
            | `MiniMax-M3` | 支持图像与视频输入；1M 上下文，最大输出 524,288 tokens |
            | `MiniMax-M2.5` | 仅文本；204,800 上下文，最大输出 32,768 tokens |
          enum:
            - MiniMax-M4
            - MiniMax-M3.1-Flash
            - MiniMax-M3
            - MiniMax-M2.5
          example: MiniMax-M4
        messages:
          type: array
          description: 对话消息列表，按时间顺序排列。至少包含 1 条消息。
          minItems: 1
          items:
            type: object
            required:
              - role
              - content
            properties:
              role:
                type: string
                enum:
                  - system
                  - user
                  - assistant
                description: 消息角色
              content:
                type: string
                description: 消息文本
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
          description: 对话完成的唯一标识符
          example: chatcmpl-example
        model:
          type: string
          description: 实际使用的模型名称
          example: MiniMax-M4
        object:
          type: string
          enum:
            - chat.completion
          description: 响应类型
          example: chat.completion
        created:
          type: integer
          description: 创建时间戳（Unix 秒）
          example: 1777026807
        choices:
          type: array
          description: 对话生成的选择列表
          items:
            $ref: '#/components/schemas/Choice'
        usage:
          $ref: '#/components/schemas/Usage'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type:
                - integer
                - string
                - 'null'
              description: HTTP 状态错误代码
            message:
              type: string
              description: 错误描述信息
            type:
              type: string
              description: 错误类型
            param:
              type: string
              description: 相关参数名称
    Choice:
      type: object
      properties:
        index:
          type: integer
          description: 选择的索引
          example: 0
        message:
          $ref: '#/components/schemas/AssistantMessage'
        finish_reason:
          type: string
          description: |-
            完成原因

            - `stop`：自然结束或触发停止序列
            - `length`：达到最大 token 限制
            - `content_filter`：内容被安全策略过滤
            - `tool_calls`：模型调用了工具
          enum:
            - stop
            - length
            - content_filter
            - tool_calls
          example: stop
    Usage:
      type: object
      description: Token 使用统计信息
      properties:
        total_tokens:
          type: integer
          description: 消耗的总 token 数
          example: 1604
        total_characters:
          type: integer
          description: 消耗的总字符数
          example: 0
        prompt_tokens:
          type: integer
          description: 输入 token 总数（含缓存命中部分）
          example: 1365
        completion_tokens:
          type: integer
          description: 输出 token 数量（含思考部分）
          example: 239
        completion_tokens_details:
          type: object
          description: 输出 token 详细分项
          properties:
            reasoning_tokens:
              type: integer
              description: 思考产生的 token 数
              example: 49
        prompt_tokens_details:
          type: object
          description: 输入 token 详细分项
          properties:
            cached_tokens:
              type: integer
              description: |-
                命中缓存的输入 token 数

                命中部分按缓存命中价计费；未命中部分 = `prompt_tokens - cached_tokens`，按标准输入价计费
              example: 114
    AssistantMessage:
      type: object
      properties:
        role:
          type: string
          description: 消息发送者的角色
          enum:
            - assistant
          example: assistant
        content:
          type:
            - string
            - 'null'
          description: >-
            最终回答内容（触发工具调用时可为 `null`）。`MiniMax-M3` 未设置 `reasoning_split: true`
            时，开头带 `<think>...</think>` 包裹的思考内容
          example: '0.05'
        reasoning_content:
          type: string
          description: >-
            思考内容。`MiniMax-M3` 需设置 `reasoning_split: true`
            才会通过该字段返回；简单问题可能不产生思考内容，此时不返回该字段
          example: Let the ball cost x. Then 2x + 1 = 1.10, so x = 0.05.
        name:
          type: string
          description: 发送者名称
        tool_calls:
          type: array
          description: 工具调用列表（当模型决定调用工具时返回）
          items:
            type: object
            properties:
              id:
                type: string
                description: 工具调用的唯一标识符
              type:
                type: string
                enum:
                  - function
              function:
                type: object
                properties:
                  name:
                    type: string
                    description: 调用的函数名称
                  arguments:
                    type: string
                    description: 函数参数（JSON 字符串）
              index:
                type: integer
                description: 工具调用索引
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |-
        所有接口均需要使用 Bearer Token 进行认证

        **获取 API Key**：

        访问 [API Key 管理页面](https://evolink.ai/dashboard/keys) 获取您的 API Key

        **使用时在请求头中添加**：
        ```
        Authorization: Bearer YOUR_API_KEY
        ```

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.