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

> - 使用 Anthropic Messages 协议调用 MiniMax 系列模型，通过 `model` 参数选择具体型号
- 最少只需 `model`、`max_tokens` 与 `messages` 三个参数（`max_tokens` 在 Anthropic 协议中必填）
- `MiniMax-M4`、`MiniMax-M3.1-Flash` 始终思考，响应 `content` 里会带 `type="thinking"` 块；`MiniMax-M3` 默认不思考；`MiniMax-M2.5` 会思考但不返回 thinking 块。思考 token 都计入 output token
- 需要流式输出、工具调用、图像与视频输入等能力，请查看「完整参数」页

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

> [!NOTE]
>
> **思考 token 计入 `max_tokens`**：`MiniMax-M4` 与 `MiniMax-M3.1-Flash` 始终思考，响应 `content` 数组里会带 `type="thinking"` 块；`MiniMax-M3` 需要传入 `thinking` 才会思考；`MiniMax-M2.5` 会思考但不返回 thinking 块。`max_tokens` 不宜设得过小，建议不低于 1024，否则可能思考还没结束就被截断、拿不到正文。


## OpenAPI

````yaml cn/api-manual/language-series/minimax/messages/messages-quickstart.json POST /v1/messages
openapi: 3.1.0
info:
  title: MiniMax 全模型接口 - Messages 快速开始
  description: >-
    通过 Anthropic Messages 协议调用 MiniMax 系列文本模型的快速开始示例。只需 `model`、`max_tokens` 与
    `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: Messages
    description: Anthropic Messages 协议接口
paths:
  /v1/messages:
    post:
      tags:
        - Messages
      summary: MiniMax 快速对话（全模型，Anthropic 兼容）
      description: >-
        - 使用 Anthropic Messages 协议调用 MiniMax 系列模型，通过 `model` 参数选择具体型号

        - 最少只需 `model`、`max_tokens` 与 `messages` 三个参数（`max_tokens` 在 Anthropic
        协议中必填）

        - `MiniMax-M4`、`MiniMax-M3.1-Flash` 始终思考，响应 `content` 里会带
        `type="thinking"` 块；`MiniMax-M3` 默认不思考；`MiniMax-M2.5` 会思考但不返回 thinking
        块。思考 token 都计入 output token

        - 需要流式输出、工具调用、图像与视频输入等能力，请查看「完整参数」页
      operationId: createMessageMiniMaxQuick
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMessageQuickRequest'
            examples:
              simple:
                summary: 最简调用
                value:
                  model: MiniMax-M4
                  max_tokens: 4096
                  messages:
                    - role: user
                      content: Please introduce yourself in one sentence.
              flash:
                summary: 调用 MiniMax-M3.1-Flash
                value:
                  model: MiniMax-M3.1-Flash
                  max_tokens: 4096
                  messages:
                    - role: user
                      content: Explain HTTP in one sentence.
              m3:
                summary: 调用 MiniMax-M3
                value:
                  model: MiniMax-M3
                  max_tokens: 4096
                  messages:
                    - role: user
                      content: Explain HTTP in one sentence.
              m25:
                summary: 调用 MiniMax-M2.5
                value:
                  model: MiniMax-M2.5
                  max_tokens: 4096
                  messages:
                    - role: user
                      content: Explain HTTP in one sentence.
      responses:
        '200':
          description: 消息对象
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
              examples:
                with_thinking:
                  summary: 包含思考内容（thinking block）
                  value:
                    id: example_a9e449
                    type: message
                    role: assistant
                    model: MiniMax-M3.1-Flash
                    content:
                      - thinking: Let the ball cost x. Then 2x + 1 = 1.10, so x = 0.05.
                        signature: EXAMPLE_THINKING_SIGNATURE
                        type: thinking
                      - text: '0.05'
                        type: text
                    usage:
                      input_tokens: 55
                      output_tokens: 66
                      cache_creation_input_tokens: 0
                      cache_read_input_tokens: 174
                      output_tokens_details:
                        thinking_tokens: 63
                    stop_reason: end_turn
                m25_answer:
                  summary: MiniMax-M2.5 返回（不含 thinking 块）
                  value:
                    id: chatcmpl-example
                    type: message
                    role: assistant
                    content:
                      - type: text
                        text: >-
                          Recursion is a technique in which a function calls
                          itself to solve smaller instances of a problem.
                    stop_reason: end_turn
                    model: MiniMax-M2.5
                    usage:
                      input_tokens: 44
                      cache_creation_input_tokens: 0
                      cache_read_input_tokens: 0
                      output_tokens: 101
        '400':
          description: 请求参数错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                request_id: req_xxx
                error:
                  type: invalid_request_error
                  message: Invalid request
        '401':
          description: 身份验证错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: authentication_error
                  message: Authentication error
        '402':
          description: 配额不足
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: billing_error
                  message: Insufficient quota
        '403':
          description: 权限错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: permission_error
                  message: Permission denied
        '404':
          description: 模型或资源不存在
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: not_found_error
                  message: Model not found
        '429':
          description: 速率限制
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: rate_limit_error
                  message: Rate limited
        '500':
          description: 内部服务器错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: 网关错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: 服务暂时不可用
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateMessageQuickRequest:
      type: object
      required:
        - model
        - max_tokens
        - 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
        max_tokens:
          type: integer
          minimum: 1
          example: 4096
          description: >-
            本次生成的最大 token 数，Anthropic 协议中为**必填**，包含思考和回答。


            思考也占用输出 token，该值不宜过小，建议不低于 1024。各模型最大值：`MiniMax-M4`
            262,144、`MiniMax-M3.1-Flash` 524,288、`MiniMax-M3`
            524,288、`MiniMax-M2.5` 32,768。
        messages:
          type: array
          description: 对话消息列表，按时间顺序排列。至少包含 1 条消息。
          minItems: 1
          items:
            type: object
            required:
              - role
              - content
            properties:
              role:
                type: string
                enum:
                  - user
                  - assistant
                description: 消息角色
              content:
                type: string
                description: 消息文本
    MessageResponse:
      type: object
      description: Anthropic 风格的消息响应
      properties:
        id:
          type: string
          description: 消息唯一 ID
        type:
          type: string
          enum:
            - message
          description: 响应对象类型
        role:
          type: string
          enum:
            - assistant
        model:
          type: string
          description: 实际使用的模型
          example: MiniMax-M4
        content:
          type: array
          description: |-
            响应内容块列表

            **可能包含的 block type**：
            - `thinking`：思考过程（简单问题可能不产生；`MiniMax-M2.5` 不返回）
            - `text`：最终回答文本
            - `tool_use`：模型发起的工具调用
          items:
            $ref: '#/components/schemas/OutputContentBlock'
        stop_reason:
          type: string
          description: |-
            停止原因

            - `end_turn`：自然结束
            - `max_tokens`：达到 max_tokens 上限
            - `tool_use`：模型触发工具调用
          enum:
            - end_turn
            - max_tokens
            - tool_use
        usage:
          $ref: '#/components/schemas/AnthropicUsage'
    ErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - error
        error:
          type: object
          properties:
            type:
              type: string
              description: >-
                错误类型（如 invalid_request_error / authentication_error /
                billing_error 等）
            message:
              type: string
              description: 错误描述
        request_id:
          type: string
          description: 请求追踪 ID
    OutputContentBlock:
      type: object
      description: 响应中的内容块
      properties:
        type:
          type: string
          enum:
            - text
            - thinking
            - tool_use
        text:
          type: string
          description: type=`text` 时的文本
        thinking:
          type: string
          description: type=`thinking` 时的推理过程文本
        signature:
          type: string
          description: >-
            type=`thinking` 时的完整性签名，用于多轮上下文校验。示例中的 `signature`
            是占位符。发送下一轮请求时，请使用上一次响应中该字段的完整值。
        id:
          type: string
          description: type=`tool_use` 时的工具调用 ID
        name:
          type: string
          description: type=`tool_use` 时的工具名
        input:
          type: object
          description: type=`tool_use` 时模型生成的 JSON 入参
    AnthropicUsage:
      type: object
      description: Token 使用统计（Anthropic 规范）
      properties:
        input_tokens:
          type: integer
          description: 未命中缓存的输入 token 数（不含 `cache_read_input_tokens`）
          example: 55
        output_tokens:
          type: integer
          description: 输出 token 数（含 thinking）
          example: 66
        cache_creation_input_tokens:
          type: integer
          description: 缓存创建的输入 token 数，自动缓存下为 0
          example: 0
        cache_read_input_tokens:
          type: integer
          description: >-
            命中缓存的输入 token 数，按缓存命中价计费。完整输入 = `input_tokens +
            cache_read_input_tokens`
          example: 174
        output_tokens_details:
          type: object
          description: 输出 token 详细分项
          properties:
            thinking_tokens:
              type: integer
              description: 思考产生的 token 数（已计入 `output_tokens`）
              example: 63
  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
        ```

        **备注**：EvoLink 对 `/v1/messages` 统一采用 Bearer Token 鉴权。

````

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