> ## 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 全模型接口 - Responses 快速开始

> 使用 `model` 与 `input` 调用 MiniMax，支持 `MiniMax-M4` 与 `MiniMax-M3.1-Flash`。建议设置 `max_output_tokens` 为 1024 或更高，为思考和正文预留空间。

更多示例见[完整参数文档](/cn/api-manual/language-series/minimax/responses/responses-reference)。

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

使用 `POST /v1/responses`，通过 `model` 选择 `MiniMax-M4` 或 `MiniMax-M3.1-Flash`。最少需要 `model` 和 `input`；示例额外设置输出上限，便于直接开始。

> [!WARNING]
>
> **只支持 `MiniMax-M4` 与 `MiniMax-M3.1-Flash`**：`MiniMax-M3`、`MiniMax-M2.5` 请使用 [Chat Completions](https://evolink.ai/docs/cn/api-manual/language-series/minimax/chat-completions/chat-completions-quickstart.md) 或 [Messages](https://evolink.ai/docs/cn/api-manual/language-series/minimax/messages/messages-quickstart.md) 接口。
>
> **参数名称与 Chat Completions 不同**：输入使用 `input`，输出上限使用 `max_output_tokens`，思考深度使用 `reasoning.effort`（`low` / `medium` / `high` / `xhigh` / `max`，默认 `max`）。两个模型都始终思考，传入 `reasoning.effort: "none"` 会返回 400 错误。

## 读取正文

响应的 `output` 可能同时包含思考、正文和工具调用。遍历 `type="message"` 中的 `output_text` 内容块，不要假设第一项就是正文。

假设已将响应 JSON 解析为 `response`，可以这样提取文本：

```python theme={null}
text = "".join(
    part["text"]
    for item in response.get("output", [])
    if item.get("type") == "message"
    for part in item.get("content", [])
    if part.get("type") == "output_text"
)
print(text)
```

> [!NOTE]
>
> **为思考预留输出预算**：`max_output_tokens` 包含思考与正文，建议从 `1024` 起按任务调整，最大值 `MiniMax-M4` 为 262,144、`MiniMax-M3.1-Flash` 为 524,288。若 `status="incomplete"` 且 `incomplete_details.reason="max_output_tokens"`，请调高上限；预算耗尽时可能只有思考项，没有正文。

工具调用、图像与视频输入、流式输出与多轮对话，请查看[完整参数文档](https://evolink.ai/docs/cn/api-manual/language-series/minimax/responses/responses-reference.md)。


## OpenAPI

````yaml cn/api-manual/language-series/minimax/responses/responses-quickstart.json POST /v1/responses
openapi: 3.1.0
info:
  title: MiniMax 全模型接口 - Responses 快速开始
  description: >-
    通过 OpenAI Responses 协议调用 MiniMax 文本模型的快速开始示例，支持 `MiniMax-M4` 与
    `MiniMax-M3.1-Flash`。
  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/responses:
    post:
      tags:
        - 对话生成
      summary: MiniMax Responses 快速调用
      description: >-
        使用 `model` 与 `input` 调用 MiniMax，支持 `MiniMax-M4` 与
        `MiniMax-M3.1-Flash`。建议设置 `max_output_tokens` 为 1024 或更高，为思考和正文预留空间。


        更多示例见[完整参数文档](/cn/api-manual/language-series/minimax/responses/responses-reference)。
      operationId: createResponseMiniMaxQuick
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponsesQuickRequest'
            examples:
              simple:
                summary: 最简调用
                value:
                  model: MiniMax-M4
                  input: Please introduce yourself in one sentence.
                  max_output_tokens: 4096
              flash:
                summary: 调用 MiniMax-M3.1-Flash
                value:
                  model: MiniMax-M3.1-Flash
                  input: Explain HTTP in one sentence.
                  max_output_tokens: 4096
      responses:
        '200':
          description: 生成成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponsesResponse'
              examples:
                with_reasoning:
                  summary: 包含思考内容
                  value:
                    id: example_ae5b7d
                    object: response
                    created_at: 1792405562
                    model: MiniMax-M3.1-Flash
                    status: completed
                    output:
                      - id: example_ae5b7d_rs
                        type: reasoning
                        status: completed
                        summary: []
                        content:
                          - type: reasoning_text
                            text: >-
                              We need solve CRT. Need only n. Compute. n=3 mod7,
                              5 mod11,7 mod13. Product 1001. Let's solve.


                              Use n=3+7a. mod11: 3+7a=5 =>7a=2 mod11. inverse7=8
                              (56=1), a=16=5 mod11. a=5+11b. n=38+77b. mod13:
                              38+77b = 12+12b mod13 (77=12,38=12) equals7
                              =>12b=-5=8 mod13. inverse12=12, b=96 mod13 =5? 91
                              remainder5. n=38+385=423. Check 423 mod7 3 (420),
                              mod11 5 (418), mod13 7 (416). Smallest positive
                              423. Only n.
                        encrypted_content: EXAMPLE_ENCRYPTED_CONTENT
                      - id: example_ae5b7d_msg
                        type: message
                        status: completed
                        role: assistant
                        content:
                          - type: output_text
                            text: '423'
                            annotations: []
                    output_text: '423'
                    usage:
                      input_tokens: 239
                      output_tokens: 190
                      total_tokens: 429
                      input_tokens_details:
                        cached_tokens: 174
                      output_tokens_details:
                        reasoning_tokens: 189
                    error: null
                    incomplete_details: null
                function_call:
                  summary: 触发工具调用
                  value:
                    id: example_2ab00b
                    object: response
                    created_at: 1792405566
                    model: MiniMax-M3.1-Flash
                    status: completed
                    output:
                      - id: example_2ab00b_msg
                        type: message
                        status: completed
                        role: assistant
                        content:
                          - type: output_text
                            text: I'll check the stock level for that product now.
                            annotations: []
                      - id: example_2ab00b_fc_0
                        type: function_call
                        status: completed
                        call_id: call_example_1
                        name: get_product_stock
                        arguments: '{"product_id": "demo-item-001"}'
                    output_text: I'll check the stock level for that product now.
                    usage:
                      input_tokens: 479
                      output_tokens: 43
                      total_tokens: 522
                      input_tokens_details:
                        cached_tokens: 174
                    error: null
                    incomplete_details: null
                incomplete:
                  summary: 达到输出上限（status=incomplete）
                  value:
                    id: example_de610c
                    object: response
                    created_at: 1792401719
                    model: MiniMax-M3.1-Flash
                    status: incomplete
                    output:
                      - id: example_de610c_rs
                        type: reasoning
                        status: completed
                        summary: []
                        content:
                          - type: reasoning_text
                            text: I need to explain the process step by step.
                        encrypted_content: EXAMPLE_ENCRYPTED_CONTENT
                    output_text: null
                    usage:
                      input_tokens: 211
                      output_tokens: 8
                      total_tokens: 219
                      input_tokens_details:
                        cached_tokens: 195
                      output_tokens_details:
                        reasoning_tokens: 8
                    error: null
                    incomplete_details:
                      reason: max_output_tokens
        '400':
          description: 请求参数错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: invalid_prompt
                  message: Invalid request parameters
                  type: invalid_request_error
        '401':
          description: 未认证、Token 无效或过期
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 401
                  message: Invalid authentication credentials
                  type: authentication_error
        '402':
          description: 配额不足、需要充值
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 402
                  message: Insufficient quota
                  type: insufficient_quota
        '403':
          description: 无权限访问该模型
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 403
                  message: Model access denied
                  type: permission_error
        '404':
          description: 资源不存在
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 404
                  message: Model not found
                  type: not_found_error
        '413':
          description: 请求体过大
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 413
                  message: Request entity too large
                  type: invalid_request_error
        '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: server_error
        '502':
          description: 网关错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 502
                  message: Bad gateway
                  type: server_error
        '503':
          description: 服务暂时不可用
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 503
                  message: Service temporarily unavailable
                  type: server_error
components:
  schemas:
    ResponsesQuickRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          enum:
            - MiniMax-M4
            - MiniMax-M3.1-Flash
          example: MiniMax-M4
          description: >-
            要调用的模型：


            | 模型 ID | 说明 |

            |---|---|

            | `MiniMax-M4` | 最新一代模型；1M 上下文，最大输出 262,144 tokens |

            | `MiniMax-M3.1-Flash` | 1M 上下文，最大输出 524,288 tokens |


            `MiniMax-M3`、`MiniMax-M2.5` 不支持本接口，请使用 Chat Completions 或 Messages
            接口。
        input:
          type: string
          example: Explain recursion in one sentence.
          description: >-
            必填。纯文本字符串按一条 user
            消息处理。多轮对话、图像与视频输入、工具调用请使用输入项数组，见[完整参数文档](/cn/api-manual/language-series/minimax/responses/responses-reference)。
        max_output_tokens:
          type: integer
          minimum: 1
          example: 4096
          description: >-
            本次生成的输出 token 上限，包含思考 token。建议从 1024 起按任务调整；过小可能在思考阶段耗尽预算，只返回
            reasoning 项而没有正文。最大值：`MiniMax-M4` 262,144，`MiniMax-M3.1-Flash`
            524,288。
    ResponsesResponse:
      type: object
      description: >-
        Responses
        接口的响应对象。除下列字段外，响应还会回显本次请求的配置（`tools`、`tool_choice`、`temperature`、`top_p`、`text`、`reasoning`、`max_output_tokens`
        等）。
      properties:
        id:
          type: string
          description: 本次响应的唯一标识
          example: resp_example
        object:
          type: string
          description: 对象类型，固定为 `response`
          example: response
        created_at:
          type: integer
          description: 创建时间，Unix 时间戳（秒）
          example: 1792401878
        status:
          type: string
          description: |-
            响应状态

            - `completed`：正常完成
            - `incomplete`：被截断，原因见 `incomplete_details`
            - `failed`：生成失败，原因见 `error`
          enum:
            - completed
            - incomplete
            - failed
          example: completed
        model:
          type: string
          description: 实际生成本次响应的模型 ID
          example: MiniMax-M4
        output:
          type: array
          description: >-
            输出项列表，按生成顺序排列：


            - `reasoning`：思考过程，id 形如 `<id>_rs`，含 `content`（`reasoning_text`
            块列表）、`summary`（空数组）、`encrypted_content`

            - `message`：最终回答，id 形如 `<id>_msg`，含 `content`（`output_text` 块列表）

            - `function_call`：模型发起的函数调用，id 形如 `<id>_fc_<序号>`，含
            `call_id`、`name`、`arguments`，需客户端执行后以 `function_call_output` 回传
          items:
            type: object
        output_text:
          type:
            - string
            - 'null'
          description: 便捷字段：所有 `output_text` 文本拼接后的结果；没有文本输出时为 `null`
        error:
          type:
            - object
            - 'null'
          description: 失败原因，成功时为 `null`
        incomplete_details:
          type:
            - object
            - 'null'
          description: >-
            截断原因，未截断时为 `null`。`reason` 为 `max_output_tokens`（输出达到上限）或
            `content_filter`（内容安全）
        usage:
          $ref: '#/components/schemas/Usage'
    ErrorResponse:
      type: object
      description: 错误响应
      properties:
        error:
          type: object
          properties:
            code:
              type:
                - integer
                - string
                - 'null'
              description: 错误代码
              example: invalid_prompt
            message:
              type: string
              description: 错误描述
              example: Invalid request parameters
            type:
              type: string
              description: 错误类型
              example: invalid_request_error
    Usage:
      type: object
      description: Token 使用统计信息（含缓存与思考分项）
      properties:
        input_tokens:
          type: integer
          description: 输入 token 总数（含缓存命中部分）
          example: 207
        input_tokens_details:
          type: object
          description: 输入 token 详细分项
          properties:
            cached_tokens:
              type: integer
              description: |-
                命中缓存的输入 token 数

                命中部分按缓存命中价计费；未命中部分 = `input_tokens - cached_tokens`，按标准输入价计费
              example: 174
        output_tokens:
          type: integer
          description: 输出 token 数量（含思考部分）
          example: 32
        output_tokens_details:
          type: object
          description: 输出 token 详细分项
          properties:
            reasoning_tokens:
              type: integer
              description: 思考产生的 token 数（已计入 `output_tokens`）
              example: 9
        total_tokens:
          type: integer
          description: 总 token 数量 = input_tokens + output_tokens
          example: 239
  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.