> ## 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-M3.1-Flash - Anthropic-Compatible API

> - Call MiniMax-M3.1-Flash using the Anthropic Messages protocol
- Request and response structures follow the Anthropic API
- **Multimodal conversations**: text, image, and video blocks in `content`
- **System prompts**: use the top-level `system` field
- **Reasoning**: always enabled; adjust depth with `output_config.effort`. Reasoning is returned in `content[type=thinking]` blocks
- **Streaming**: SSE events
- **Tool calling**: Anthropic `tool_use` / `tool_result` flow

**Streaming events**: `message_start` → `content_block_start` → `content_block_delta` (`thinking_delta` / `signature_delta` / `text_delta` / `input_json_delta`) → `content_block_stop` → `message_delta` → `message_stop`. `ping` events may appear between these events. Use the `usage` in the `message_delta` event for final token counts.

<Note>
  **BaseURL**: The default BaseURL is `https://direct.evolink.ai`, which has better support for text models and long-lived connections. `https://api.evolink.ai` is the primary endpoint for multimodal services and serves as a fallback address for text models.
</Note>


## OpenAPI

````yaml en/api-manual/language-series/minimax-m3.1-flash/minimax-m3.1-flash-messages.json POST /v1/messages
openapi: 3.1.0
info:
  title: MiniMax-M3.1-Flash Anthropic-Compatible API
  description: >-
    Complete API reference for MiniMax-M3.1-Flash using the Anthropic Messages
    protocol.


    **Compatibility**:

    - Endpoint: `/v1/messages`

    - Request and response structures follow the Anthropic Messages API

    - Supported fields: `model` and `messages` (required), `system`,
    `max_tokens`, `temperature`, `top_p`, `stream`, `thinking`, `output_config`,
    `tools`, `tool_choice`, and `metadata`


    **Model capabilities**:

    - Context window: **1,000,000 tokens** (1M)

    - Maximum output: **524,288 tokens** (512K); **131,072 tokens** (128K)
    recommended, including reasoning tokens

    - Reasoning: always enabled; adjust depth with `output_config.effort`, which
    defaults to `max`. Reasoning is returned in `content[type=thinking]` blocks

    - Multimodal input: text, image, and video blocks

    - Context caching: matching prefixes are cached automatically; cached tokens
    are reported in `usage.cache_read_input_tokens`


    For multi-turn conversations, preserve all assistant content blocks,
    including `thinking` (with `signature`) and `tool_use`.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: Production (Recommended)
  - url: https://api.evolink.ai
    description: Alternative URL
security:
  - bearerAuth: []
tags:
  - name: Messages
    description: Anthropic Messages protocol endpoints
paths:
  /v1/messages:
    post:
      tags:
        - Messages
      summary: MiniMax-M3.1-Flash Messages API (Anthropic Compatible)
      description: >-
        - Call MiniMax-M3.1-Flash using the Anthropic Messages protocol

        - Request and response structures follow the Anthropic API

        - **Multimodal conversations**: text, image, and video blocks in
        `content`

        - **System prompts**: use the top-level `system` field

        - **Reasoning**: always enabled; adjust depth with
        `output_config.effort`. Reasoning is returned in
        `content[type=thinking]` blocks

        - **Streaming**: SSE events

        - **Tool calling**: Anthropic `tool_use` / `tool_result` flow


        **Streaming events**: `message_start` → `content_block_start` →
        `content_block_delta` (`thinking_delta` / `signature_delta` /
        `text_delta` / `input_json_delta`) → `content_block_stop` →
        `message_delta` → `message_stop`. `ping` events may appear between these
        events. Use the `usage` in the `message_delta` event for final token
        counts.
      operationId: createMessageMiniMaxM31Flash
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMessageRequest'
            examples:
              simple:
                summary: Minimal runnable request
                value:
                  model: MiniMax-M3.1-Flash
                  max_tokens: 131072
                  messages:
                    - role: user
                      content: Hello! How can you help me?
              system_prompt:
                summary: Using system prompts
                value:
                  model: MiniMax-M3.1-Flash
                  max_tokens: 131072
                  system: >-
                    You are a technical editor. Keep your answers clear and
                    concise.
                  messages:
                    - role: user
                      content: >-
                        Describe the benefits of clear technical documentation
                        in three sentences.
              effort:
                summary: Adjust reasoning depth (output_config.effort)
                value:
                  model: MiniMax-M3.1-Flash
                  max_tokens: 131072
                  output_config:
                    effort: high
                  messages:
                    - role: user
                      content: >-
                        A bat and a ball cost 1.10 in total. The bat costs 1.00
                        more than the ball. How much does the ball cost?
              image_understanding:
                summary: Image understanding (multimodal content blocks)
                value:
                  model: MiniMax-M3.1-Flash
                  max_tokens: 131072
                  messages:
                    - role: user
                      content:
                        - type: text
                          text: What is shown in this image?
                        - type: image
                          source:
                            type: url
                            url: https://example.com/image.jpeg
              video_understanding:
                summary: Video understanding (multimodal content blocks)
                value:
                  model: MiniMax-M3.1-Flash
                  max_tokens: 131072
                  messages:
                    - role: user
                      content:
                        - type: text
                          text: Summarize this video.
                        - type: video
                          source:
                            type: url
                            url: https://example.com/video.mp4
                            fps: 1
              tool_use:
                summary: Tool calling (Anthropic tool_use style)
                value:
                  model: MiniMax-M3.1-Flash
                  max_tokens: 131072
                  messages:
                    - role: user
                      content: Check the stock for product demo-item-001.
                  tools:
                    - name: get_product_stock
                      description: Get the current stock level for a product.
                      input_schema:
                        type: object
                        properties:
                          product_id:
                            type: string
                            description: Product identifier.
                        required:
                          - product_id
                  tool_choice:
                    type: auto
              streaming:
                summary: Streaming output (SSE)
                value:
                  model: MiniMax-M3.1-Flash
                  max_tokens: 131072
                  stream: true
                  messages:
                    - role: user
                      content: Write a short poem about spring.
      responses:
        '200':
          description: Message object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
              examples:
                with_thinking:
                  summary: Response with reasoning (thinking block)
                  value:
                    id: 072514f09a86ce2abb0c5c3930f924fb
                    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: >-
                          84eddf556420e0cc237f8f50212216543e8add2ddd931c9a271d2a5a95689333
                        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
                    base_resp:
                      status_code: 0
                      status_msg: ''
                direct_answer:
                  summary: Direct answer without reasoning content
                  value:
                    id: 072514d15927960e42b730074205a1c6
                    type: message
                    role: assistant
                    model: MiniMax-M3.1-Flash
                    content:
                      - text: >-
                          Recursion is a technique in which a function calls
                          itself to solve smaller instances of a problem.
                        type: text
                    usage:
                      input_tokens: 23
                      output_tokens: 6
                      cache_creation_input_tokens: 0
                      cache_read_input_tokens: 184
                    stop_reason: end_turn
                    base_resp:
                      status_code: 0
                      status_msg: ''
                tool_use:
                  summary: Tool call triggered (stop_reason=tool_use)
                  value:
                    id: 072514d3fb0f7ce9f7c9fdd22755fffc
                    type: message
                    role: assistant
                    model: MiniMax-M3.1-Flash
                    content:
                      - type: tool_use
                        id: call_function_ih2iv0ggec0p_1
                        name: get_product_stock
                        input:
                          product_id: demo-item-001
                    usage:
                      input_tokens: 283
                      output_tokens: 31
                      cache_creation_input_tokens: 0
                      cache_read_input_tokens: 174
                    stop_reason: tool_use
                    base_resp:
                      status_code: 0
                      status_msg: ''
        '400':
          description: Invalid request parameters
          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: Authentication error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: authentication_error
                  message: Authentication error
        '402':
          description: Insufficient quota
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: billing_error
                  message: Insufficient quota
        '403':
          description: Permission error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: permission_error
                  message: Permission denied
        '404':
          description: Model or resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: not_found_error
                  message: Model not found
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: rate_limit_error
                  message: Rate limited
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: Bad gateway
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Service temporarily unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateMessageRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          description: Model to call
          enum:
            - MiniMax-M3.1-Flash
          example: MiniMax-M3.1-Flash
        max_tokens:
          type: integer
          description: >-
            Maximum number of generated tokens, **including reasoning and the
            final answer**.


            - Recommended: **131,072** (128K); maximum: **524,288** (512K)

            - A small budget may be exhausted during reasoning, resulting in
            `stop_reason=max_tokens` without text content
          minimum: 1
          maximum: 524288
          example: 131072
        messages:
          type: array
          description: |-
            List of conversation messages, alternating user / assistant turns

            **Notes**:
            - Must contain at least 1 message
            - The last message is typically `role=user`
          items:
            $ref: '#/components/schemas/InputMessage'
          minItems: 1
        system:
          description: >-
            System prompt used to set the assistant's role and behavior. Accepts
            a string or an array of text content blocks in the top-level
            `system` field.
          oneOf:
            - type: string
              example: You are a helpful assistant.
            - type: array
              description: System prompt as an array of content blocks.
              items:
                type: object
                required:
                  - type
                  - text
                properties:
                  type:
                    type: string
                    enum:
                      - text
                  text:
                    type: string
        temperature:
          type: number
          description: >-
            Sampling temperature.


            - Range: `[0, 2]`; default: 1

            - Higher values produce more varied output; lower values produce
            more deterministic output

            - Adjust either `temperature` or `top_p`, rather than both
          minimum: 0
          maximum: 2
          default: 1
          example: 1
        top_p:
          type: number
          description: |-
            Nucleus sampling threshold.

            - Range: `[0, 1]`; default: 0.95
            - Adjust either `temperature` or `top_p`, rather than both
          minimum: 0
          maximum: 1
          default: 0.95
          example: 0.95
        stream:
          type: boolean
          description: |-
            Whether to return via SSE streaming

            - `true`: Server-Sent Events streaming response
            - `false`: Wait for complete response before returning (default)
          default: false
          example: false
        thinking:
          type: object
          description: >-
            Reasoning mode. MiniMax-M3.1-Flash always uses reasoning. Only
            `adaptive` is supported; this field may be omitted. Reasoning is
            returned in `type="thinking"` blocks and billed as output tokens.
          required:
            - type
          properties:
            type:
              type: string
              enum:
                - adaptive
              default: adaptive
        output_config:
          type: object
          description: Output configuration.
          properties:
            effort:
              type: string
              description: >-
                Reasoning depth. Defaults to `max`. Higher levels typically
                increase reasoning token usage and response time.
              enum:
                - low
                - medium
                - high
                - xhigh
                - max
              default: max
              example: high
        tools:
          type: array
          description: |-
            Tool definition list

            **Notes**:
            - Follows the Anthropic tool definition specification
            - `input_schema` uses a JSON Schema object
          items:
            $ref: '#/components/schemas/Tool'
        tool_choice:
          type: object
          description: >-
            Tool selection strategy. Only `auto` is supported; the model decides
            whether to call a tool.
          required:
            - type
          properties:
            type:
              type: string
              enum:
                - auto
        metadata:
          type: object
          description: Request metadata
          properties:
            user_id:
              type: string
              description: >-
                Unique identifier representing the end user, can be used for
                per-user monitoring and abuse detection (using a hashed ID is
                recommended)
    MessageResponse:
      type: object
      description: Anthropic-style message response
      properties:
        id:
          type: string
          description: Unique message ID
        type:
          type: string
          enum:
            - message
          description: Response object type
        role:
          type: string
          enum:
            - assistant
        model:
          type: string
          description: Model actually used
          example: MiniMax-M3.1-Flash
        content:
          type: array
          description: >-
            Response content blocks.


            **Possible types**:

            - `thinking`: reasoning content, which may be absent for simple
            questions

            - `text`: final answer

            - `tool_use`: a tool call initiated by the model
          items:
            $ref: '#/components/schemas/OutputContentBlock'
        stop_reason:
          type: string
          description: |-
            Stop reason

            - `end_turn`: Natural completion
            - `max_tokens`: Reached max_tokens limit
            - `tool_use`: Model triggered a tool call
          enum:
            - end_turn
            - max_tokens
            - tool_use
        usage:
          $ref: '#/components/schemas/AnthropicUsage'
        base_resp:
          type: object
          description: Status code and error details
          properties:
            status_code:
              type: integer
              description: Status code. `0` indicates success.
            status_msg:
              type: string
              description: Error details
    ErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - error
        error:
          type: object
          properties:
            type:
              type: string
              description: >-
                Error type (e.g. invalid_request_error / authentication_error /
                billing_error, etc.)
            message:
              type: string
              description: Error description
        request_id:
          type: string
          description: Request tracking ID
    InputMessage:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
            - assistant
          description: >-
            Message role. Alternate between user and assistant messages.


            - `user`: user messages, including `tool_result` blocks

            - `assistant`: assistant history, including `text`, `thinking`, and
            `tool_use` blocks


            Provide system prompts in the top-level `system` field.
        content:
          description: >-
            Message content


            **Notes**:

            - For plain text, pass a string directly

            - For structured content, pass a content block array (`text` /
            `image` / `video` / `tool_use` / `tool_result` / `thinking`)
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/ContentBlock'
    Tool:
      type: object
      required:
        - name
        - input_schema
      properties:
        name:
          type: string
          description: |-
            Tool name

            **Notes**:
            - Only `a-zA-Z0-9_-` allowed
            - Maximum 64 characters
        description:
          type: string
          description: Tool description, helps the model determine when to call it
        input_schema:
          type: object
          description: |-
            JSON Schema object for tool input parameters

            **Notes**:
            - `type` must be `object`
            - Should declare `properties` and `required`
    OutputContentBlock:
      type: object
      description: Content block in the response
      properties:
        type:
          type: string
          enum:
            - text
            - thinking
            - tool_use
        text:
          type: string
          description: Text when type=`text`
        thinking:
          type: string
          description: Reasoning process text when type=`thinking`
        signature:
          type: string
          description: >-
            Integrity signature when type=`thinking`, used for multi-turn
            context verification
        id:
          type: string
          description: Tool call ID when type=`tool_use`
        name:
          type: string
          description: Tool name when type=`tool_use`
        input:
          type: object
          description: JSON input parameters generated by the model when type=`tool_use`
    AnthropicUsage:
      type: object
      description: Token usage statistics (Anthropic specification)
      properties:
        input_tokens:
          type: integer
          description: Uncached input tokens, excluding `cache_read_input_tokens`.
          example: 55
        output_tokens:
          type: integer
          description: Output token count (including thinking)
          example: 66
        cache_creation_input_tokens:
          type: integer
          description: >-
            Number of input tokens used to create the cache. This is 0 with
            automatic caching.
          example: 0
        cache_read_input_tokens:
          type: integer
          description: >-
            Cached input tokens, billed at the cache-hit rate. Total input
            tokens = `input_tokens + cache_read_input_tokens`.
          example: 174
        output_tokens_details:
          type: object
          description: Detailed breakdown of output tokens
          properties:
            thinking_tokens:
              type: integer
              description: Reasoning tokens, already included in `output_tokens`.
              example: 63
    ContentBlock:
      type: object
      description: >-
        Message content block.


        **Supported types**:

        - `text`: text content

        - `image`: image input (URL or base64; JPEG / PNG / GIF / WEBP)

        - `video`: video input (URL, base64, or `mm_file://{file_id}`; MP4 / AVI
        / MOV / MKV)

        - `tool_use`: tool call from the previous assistant turn

        - `tool_result`: tool execution result

        - `thinking`: reasoning from the previous assistant turn, including
        `signature`
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - text
            - image
            - video
            - tool_use
            - tool_result
            - thinking
        text:
          type: string
          description: Text content when type=`text`
        source:
          $ref: '#/components/schemas/MediaSource'
          description: Image or video source, used when `type=image` or `type=video`.
        id:
          type: string
          description: Tool call ID (required for tool_use)
        name:
          type: string
          description: Tool name (required for tool_use)
        input:
          type: object
          description: Tool input parameters (JSON object for tool_use)
        tool_use_id:
          type: string
          description: >-
            Corresponding tool call ID (required for tool_result, maps to
            tool_use.id)
        content:
          description: Tool execution result (tool_result), string or content block array
          oneOf:
            - type: string
            - type: array
              items:
                type: object
        thinking:
          type: string
          description: >-
            Reasoning from an assistant message in the conversation history,
            used when `type=thinking`.
        signature:
          type: string
          description: Reasoning signature. Preserve it when sending conversation history.
    MediaSource:
      type: object
      description: >-
        Media source for an image or video block.


        - Images: JPEG / PNG / GIF / WEBP, up to 10 MB each

        - Videos: MP4 / AVI / MOV / MKV, up to 50 MB for URL / Base64 input; use
        an `mm_file://{file_id}` reference for larger videos

        - Maximum request body size: 64 MB
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - base64
            - url
          description: Media source type
        media_type:
          type: string
          description: Required for base64 input, e.g. `image/png` or `video/mp4`
        data:
          type: string
          description: Base64-encoded media bytes
        url:
          type: string
          description: >-
            Public URL; videos may also use file references in the format
            `mm_file://{file_id}`
        detail:
          type: string
          enum:
            - low
            - default
            - high
          default: default
          description: >-
            Understanding precision, defaults to default. Higher resolution
            consumes more tokens
        fps:
          type: number
          minimum: 0.2
          maximum: 5
          default: 1
          description: >-
            Video frame sampling rate. Defaults to 1; range: [0.2, 5]. Higher
            rates help capture changes in the video and typically increase token
            usage.
        max_long_side_pixel:
          type: integer
          minimum: 1
          description: >-
            Maximum pixel constraint for the longest side of images or video
            frames
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        All APIs require Bearer Token authentication


        **Get API Key:**


        Visit [API Key Management Page](https://evolink.ai/dashboard/keys) to
        get your API Key


        **Add to request header:**

        ```

        Authorization: Bearer YOUR_API_KEY

        ```


        **Note**: EvoLink uses Bearer Token authentication uniformly for
        `/v1/messages`.

````

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