{
  "openapi": "3.1.0",
  "info": {
    "title": "MiniMax Text API Anthropic",
    "description": "MiniMax text generation API with support for chat completion and streaming output.\n\n> ⚡ **`MiniMax-M3.1-Flash` highlights** — **1M long context**, **multimodal**, and **tunable thinking depth**.\n",
    "license": {
      "name": "MIT"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.minimax.io"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "apiKeyAuth": []
    }
  ],
  "paths": {
    "/anthropic/v1/messages": {
      "post": {
        "summary": "Text Generation Anthropic",
        "operationId": "chatCompletionAnthropic",
        "tags": [
          "Text Generation"
        ],
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "required": true,
            "description": "Media type of the request body, should be set to `application/json` to ensure JSON format",
            "schema": {
              "type": "string",
              "enum": [
                "application/json"
              ],
              "default": "application/json"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMessageReq"
              },
              "examples": {
                "Deep Thinking": {
                  "value": {
                    "model": "MiniMax-M3.1-Flash",
                    "thinking": {
                      "type": "adaptive"
                    },
                    "messages": [
                      {
                        "role": "user",
                        "content": "Which is bigger, 9.11 or 9.9?"
                      }
                    ],
                    "max_tokens": 4096,
                    "output_config": {
                      "effort": "max"
                    }
                  }
                },
                "Image Understanding": {
                  "value": {
                    "model": "MiniMax-M3.1-Flash",
                    "thinking": {
                      "type": "adaptive"
                    },
                    "messages": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "text",
                            "text": "What does this image show?"
                          },
                          {
                            "type": "image",
                            "source": {
                              "type": "url",
                              "url": "https://filecdn.minimax.chat/public/fe9d04da-f60e-444d-a2e0-18ae743add33.jpeg"
                            }
                          }
                        ]
                      }
                    ],
                    "max_tokens": 4096,
                    "output_config": {
                      "effort": "max"
                    }
                  }
                },
                "Video Understanding": {
                  "value": {
                    "model": "MiniMax-M3.1-Flash",
                    "thinking": {
                      "type": "adaptive"
                    },
                    "messages": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "text",
                            "text": "What is happening in this video?"
                          },
                          {
                            "type": "video",
                            "source": {
                              "type": "url",
                              "url": "https://filecdn.minimax.chat/public/ee8c1648-21f1-41b7-8397-65022d22ffe5.mp4"
                            }
                          }
                        ]
                      }
                    ],
                    "max_tokens": 4096,
                    "output_config": {
                      "effort": "max"
                    }
                  }
                },
                "Stream": {
                  "value": {
                    "model": "MiniMax-M3.1-Flash",
                    "thinking": {
                      "type": "adaptive"
                    },
                    "messages": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "text",
                            "text": "What does this image show?"
                          },
                          {
                            "type": "image",
                            "source": {
                              "type": "url",
                              "url": "https://filecdn.minimax.chat/public/fe9d04da-f60e-444d-a2e0-18ae743add33.jpeg"
                            }
                          }
                        ]
                      }
                    ],
                    "stream": true,
                    "max_tokens": 4096,
                    "output_config": {
                      "effort": "max"
                    }
                  }
                },
                "Tool Use": {
                  "value": {
                    "model": "MiniMax-M3.1-Flash",
                    "messages": [
                      {
                        "role": "user",
                        "content": "How's the weather in San Francisco?"
                      }
                    ],
                    "max_tokens": 4096,
                    "tools": [
                      {
                        "name": "get_weather",
                        "description": "Get the current weather for a given location.",
                        "input_schema": {
                          "type": "object",
                          "properties": {
                            "location": {
                              "type": "string",
                              "description": "The city and state/country, e.g. San Francisco, US"
                            }
                          },
                          "required": [
                            "location"
                          ]
                        }
                      }
                    ],
                    "tool_choice": {
                      "type": "auto"
                    },
                    "output_config": {
                      "effort": "max"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateMessageResp"
                },
                "examples": {
                  "Deep Thinking": {
                    "value": {
                      "id": "066b367ba949a58a9d6829b4bf8cbcd4",
                      "type": "message",
                      "role": "assistant",
                      "model": "MiniMax-M3.1-Flash",
                      "content": [
                        {
                          "thinking": "The user is asking which is bigger, 9.11 or 9.9.\n\n9.11 vs 9.9\n\n9.9 is greater than 9.11.\n\nTo compare: 9.11 = 9.11 and 9.9 = 9.90\n\n9.90 > 9.11, so 9.9 is bigger.",
                          "signature": "6d0315c818f9664ff185dabaa22cd89f2bf28a3a52122095bce23d905471ec5f",
                          "type": "thinking"
                        },
                        {
                          "text": "**9.9 is bigger than 9.11.**\n\nTo compare decimals, it helps to write them with the same number of decimal places:\n- 9.11 = 9.11\n- 9.9 = 9.90\n\nSince 9.90 > 9.11, **9.9 is larger**.",
                          "type": "text"
                        }
                      ],
                      "usage": {
                        "input_tokens": 13,
                        "output_tokens": 149,
                        "cache_creation_input_tokens": 0,
                        "cache_read_input_tokens": 159
                      },
                      "stop_reason": "end_turn"
                    }
                  },
                  "Image Understanding": {
                    "value": {
                      "id": "066a3730f92943410551c4b4978ddad1",
                      "type": "message",
                      "role": "assistant",
                      "model": "MiniMax-M3.1-Flash",
                      "content": [
                        {
                          "thinking": "The user is asking what the image shows. I can describe this image of a young child.",
                          "signature": "db8ecae1e5a63cabebd69d2625983499bb498bfd329dde5c3cede76f12896336",
                          "type": "thinking"
                        },
                        {
                          "text": "This image shows a young girl, probably around 4-5 years old, photographed in a close-up portrait style. She has:\n\n- **Wavy, tousled light brown hair** with bangs that fall across her forehead, with some strands appearing slightly messy or windblown\n- **Large, expressive hazel-green eyes** that are looking directly at the camera\n- **A soft, subtle smile** giving her a warm, gentle expression\n- **Fair skin** with rosy cheeks, illuminated by warm, soft lighting\n\nShe's wearing what appears to be a **cream or off-white dress** with delicate lace or ruffled detailing around the neckline and shoulders.\n\nThe photograph has a **professional portrait quality**, with a softly blurred, neutral grayish-beige background and warm directional lighting that creates a classic, painterly aesthetic. The composition and styling suggest this could be a formal portrait or an AI-generated image with a vintage/realistic photographic style.",
                          "type": "text"
                        }
                      ],
                      "usage": {
                        "input_tokens": 1209,
                        "output_tokens": 214,
                        "cache_creation_input_tokens": 0,
                        "cache_read_input_tokens": 157
                      },
                      "stop_reason": "end_turn"
                    }
                  },
                  "Video Understanding": {
                    "value": {
                      "id": "066b458956dd2902de31eae19cf15c6e",
                      "type": "message",
                      "role": "assistant",
                      "model": "MiniMax-M3.1-Flash",
                      "content": [
                        {
                          "thinking": "The user wants to know what is happening in the video.\n\n1.  **Analyze the video:**\n    *   The video is a meme/edited clip.\n    *   It starts with a cat (specifically a Bengal cat, looks like a Savannah cat or similar breed) walking on a diving board at the Olympics (London 2012).\n    *   The cat is edited into the scene, replacing a human diver.\n    *   The cat walks to the end of the board.\n    *   The cat then jumps off the diving board into the pool.\n    *   The people in the background are real, reacting (or rather, just sitting there, as it's a static crowd image or very slow movement).\n    *   The text \"MINIMAX | Hailuo AI\" is visible, indicating it's an AI-generated video.\n\n2.  **Describe the action:**\n    *   A cat walks on a diving board.\n    *   The cat jumps off the diving board.\n    *   The setting is an Olympic-sized pool.\n\n3.  **Synthesize the description:**\n    *   Start with the main subject: a cat.\n    *   Describe the location: a diving board at a swimming pool.\n    *   Describe the action: walking, then jumping off.\n    *   Combine into a concise sentence: \"A cat is seen walking on a diving board and then jumping off into a swimming pool.\"\n\n4.  **Review against the video:**\n    *   Does the video show a cat? Yes.\n    *   Does it show a diving board? Yes.\n    *   Does the cat jump off? Yes.\n    *   Is there a swimming pool below? Yes.\n    *   The description is accurate and covers the key events in the short clip.\n\n5.  **Final Output Generation:** Present the synthesized description clearly.",
                          "signature": "4849e0d596e25f03504dbb4eee7316fc48714dc86b93c9b7dd63adef7f4aa9b2",
                          "type": "thinking"
                        },
                        {
                          "text": "A cat is seen walking on a diving board and then jumping off into a swimming pool.",
                          "type": "text"
                        }
                      ],
                      "usage": {
                        "input_tokens": 349,
                        "output_tokens": 393,
                        "cache_creation_input_tokens": 0,
                        "cache_read_input_tokens": 1896
                      },
                      "stop_reason": "end_turn"
                    }
                  },
                  "Stream": {
                    "value": [
                      {
                        "type": "message_start",
                        "message": {
                          "id": "066a3766d21ce23c8afc5e85a427036c",
                          "type": "message",
                          "role": "assistant",
                          "content": [],
                          "model": "MiniMax-M3.1-Flash",
                          "stop_reason": null,
                          "stop_sequence": null,
                          "usage": {
                            "input_tokens": 0,
                            "output_tokens": 0,
                            "cache_creation_input_tokens": 0,
                            "cache_read_input_tokens": 1366
                          },
                          "service_tier": "standard"
                        }
                      },
                      {
                        "type": "ping"
                      },
                      {
                        "type": "content_block_start",
                        "index": 0,
                        "content_block": {
                          "type": "thinking",
                          "thinking": ""
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 0,
                        "delta": {
                          "type": "thinking_delta",
                          "thinking": "The user"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 0,
                        "delta": {
                          "type": "thinking_delta",
                          "thinking": " is asking me to describe what an image shows. I should describe the image objectively, focusing on"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 0,
                        "delta": {
                          "type": "thinking_delta",
                          "thinking": " visible features without identifying the person."
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 0,
                        "delta": {
                          "type": "signature_delta",
                          "signature": "69b031ac42358c4e99f8f80f5ea48ff9cec06ca68500428ee1145e16a8020843"
                        }
                      },
                      {
                        "type": "content_block_stop",
                        "index": 0
                      },
                      {
                        "type": "content_block_start",
                        "index": 1,
                        "content_block": {
                          "type": "text",
                          "text": ""
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": "The image shows a close-up portrait of a young girl"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": ", probably around 3-5 years old. She has the following features:\n\n- **Hair"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": "**: Wavy, light brown/auburn hair with bangs across her forehead, with some"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": " strands appearing to be pulled up\n- **Eyes**: Large, expressive brown/amber eyes looking"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": " directly at the camera\n- **Expression**: A subtle, closed-mouth smile that gives her a gentle"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": ", slightly mischievous look\n- **Clothing**: She's wearing a white or cream-colored top with delicate"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": " lace or ruffled trim around the neckline and sleeves\n- **Lighting**: The photo uses"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": " warm, soft lighting that creates a gentle glow on her face\n- **Background**: A muted, neutral"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": " brownish-gray backdrop that keeps the focus entirely on her\n\nThe overall aesthetic has"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": " a professional, portrait-photography quality with a warm, vintage feel to the color tones"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": "."
                        }
                      },
                      {
                        "type": "content_block_stop",
                        "index": 1
                      },
                      {
                        "type": "message_delta",
                        "delta": {
                          "stop_reason": "end_turn"
                        },
                        "usage": {
                          "input_tokens": 1252,
                          "output_tokens": 213,
                          "cache_creation_input_tokens": 0,
                          "cache_read_input_tokens": 114
                        }
                      },
                      {
                        "type": "message_stop"
                      }
                    ]
                  },
                  "Tool Use": {
                    "value": {
                      "id": "066b133406cd8cfd88eb3b2b893a5daa",
                      "type": "message",
                      "role": "assistant",
                      "model": "MiniMax-M3.1-Flash",
                      "content": [
                        {
                          "thinking": "The user is asking about the weather in San Francisco. I have access to a get_weather tool that can provide this information. I need to format the location parameter appropriately - the example shows \"San Francisco, US\" as the format.",
                          "signature": "fa86efec7c27d4aa23eac60ba7a1f4e5f0f37a18d6ec4944fe495aebb6bd0930",
                          "type": "thinking"
                        },
                        {
                          "text": "I'll check the current weather in San Francisco for you.",
                          "type": "text"
                        },
                        {
                          "type": "tool_use",
                          "id": "call_function_9pjh8jjdebck_1",
                          "name": "get_weather",
                          "input": {
                            "location": "San Francisco, US"
                          }
                        }
                      ],
                      "usage": {
                        "input_tokens": 14,
                        "output_tokens": 91,
                        "cache_creation_input_tokens": 0,
                        "cache_read_input_tokens": 404
                      },
                      "stop_reason": "tool_use"
                    }
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/StreamEvent"
                },
                "examples": {
                  "Stream": {
                    "value": [
                      {
                        "type": "message_start",
                        "message": {
                          "id": "066a3766d21ce23c8afc5e85a427036c",
                          "type": "message",
                          "role": "assistant",
                          "content": [],
                          "model": "MiniMax-M3.1-Flash",
                          "stop_reason": null,
                          "stop_sequence": null,
                          "usage": {
                            "input_tokens": 0,
                            "output_tokens": 0,
                            "cache_creation_input_tokens": 0,
                            "cache_read_input_tokens": 1366
                          },
                          "service_tier": "standard"
                        }
                      },
                      {
                        "type": "ping"
                      },
                      {
                        "type": "content_block_start",
                        "index": 0,
                        "content_block": {
                          "type": "thinking",
                          "thinking": ""
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 0,
                        "delta": {
                          "type": "thinking_delta",
                          "thinking": "The user"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 0,
                        "delta": {
                          "type": "thinking_delta",
                          "thinking": " is asking me to describe what an image shows. I should describe the image objectively, focusing on"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 0,
                        "delta": {
                          "type": "thinking_delta",
                          "thinking": " visible features without identifying the person."
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 0,
                        "delta": {
                          "type": "signature_delta",
                          "signature": "69b031ac42358c4e99f8f80f5ea48ff9cec06ca68500428ee1145e16a8020843"
                        }
                      },
                      {
                        "type": "content_block_stop",
                        "index": 0
                      },
                      {
                        "type": "content_block_start",
                        "index": 1,
                        "content_block": {
                          "type": "text",
                          "text": ""
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": "The image shows a close-up portrait of a young girl"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": ", probably around 3-5 years old. She has the following features:\n\n- **Hair"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": "**: Wavy, light brown/auburn hair with bangs across her forehead, with some"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": " strands appearing to be pulled up\n- **Eyes**: Large, expressive brown/amber eyes looking"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": " directly at the camera\n- **Expression**: A subtle, closed-mouth smile that gives her a gentle"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": ", slightly mischievous look\n- **Clothing**: She's wearing a white or cream-colored top with delicate"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": " lace or ruffled trim around the neckline and sleeves\n- **Lighting**: The photo uses"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": " warm, soft lighting that creates a gentle glow on her face\n- **Background**: A muted, neutral"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": " brownish-gray backdrop that keeps the focus entirely on her\n\nThe overall aesthetic has"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": " a professional, portrait-photography quality with a warm, vintage feel to the color tones"
                        }
                      },
                      {
                        "type": "content_block_delta",
                        "index": 1,
                        "delta": {
                          "type": "text_delta",
                          "text": "."
                        }
                      },
                      {
                        "type": "content_block_stop",
                        "index": 1
                      },
                      {
                        "type": "message_delta",
                        "delta": {
                          "stop_reason": "end_turn"
                        },
                        "usage": {
                          "input_tokens": 1252,
                          "output_tokens": 213,
                          "cache_creation_input_tokens": 0,
                          "cache_read_input_tokens": 114
                        }
                      },
                      {
                        "type": "message_stop"
                      }
                    ]
                  }
                }
              }
            }
          },
              "400": {
                "description": "Invalid request parameters (missing required fields, type not in the whitelist, tool_use.input not a JSON object, etc.).",
                "content": {
                  "application/json": {
                    "schema": {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    "example": {
                      "type": "error",
                      "request_id": "req_xxxxxxxx",
                      "error": {
                        "type": "invalid_request_error",
                        "message": "messages.0.content.1: unsupported content type 'foo'"
                      }
                    }
                  }
                }
              },
              "401": {
                "description": "API key missing or invalid.",
                "content": {
                  "application/json": {
                    "schema": {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    "example": {
                      "type": "error",
                      "request_id": "req_xxxxxxxx",
                      "error": {
                        "type": "authentication_error",
                        "message": "API key missing or invalid."
                      }
                    }
                  }
                }
              },
              "403": {
                "description": "No permission to access this model or path.",
                "content": {
                  "application/json": {
                    "schema": {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    "example": {
                      "type": "error",
                      "request_id": "req_xxxxxxxx",
                      "error": {
                        "type": "permission_error",
                        "message": "No permission to access this model or path."
                      }
                    }
                  }
                }
              },
              "404": {
                "description": "Model does not exist.",
                "content": {
                  "application/json": {
                    "schema": {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    "example": {
                      "type": "error",
                      "request_id": "req_xxxxxxxx",
                      "error": {
                        "type": "not_found_error",
                        "message": "Model does not exist."
                      }
                    }
                  }
                }
              },
              "413": {
                "description": "Request body exceeds 64 MB, or a multimodal file exceeds the size limit.",
                "content": {
                  "application/json": {
                    "schema": {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    "example": {
                      "type": "error",
                      "request_id": "req_xxxxxxxx",
                      "error": {
                        "type": "request_too_large",
                        "message": "Request body exceeds 64 MB, or a multimodal file exceeds the size limit."
                      }
                    }
                  }
                }
              },
              "429": {
                "description": "RPM / TPM / connection-count or other rate limit triggered.",
                "content": {
                  "application/json": {
                    "schema": {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    "example": {
                      "type": "error",
                      "request_id": "req_xxxxxxxx",
                      "error": {
                        "type": "rate_limit_error",
                        "message": "RPM / TPM / connection-count or other rate limit triggered."
                      }
                    }
                  }
                }
              },
              "500": {
                "description": "Internal server error.",
                "content": {
                  "application/json": {
                    "schema": {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    "example": {
                      "type": "error",
                      "request_id": "req_xxxxxxxx",
                      "error": {
                        "type": "api_error",
                        "message": "Internal server error."
                      }
                    }
                  }
                }
              },
              "529": {
                "description": "Upstream model overloaded; retryable.",
                "content": {
                  "application/json": {
                    "schema": {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    "example": {
                      "type": "error",
                      "request_id": "req_xxxxxxxx",
                      "error": {
                        "type": "overloaded_error",
                        "message": "Upstream model overloaded; retryable."
                      }
                    }
                  }
                }
              }
        }
      }
    },
    "/anthropic/v1/messages/count_tokens": {
      "post": {
        "summary": "Count Tokens Anthropic",
        "operationId": "countTokensAnthropic",
        "tags": [
          "Text Generation"
        ],
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "required": true,
            "description": "Media type of the request body, should be set to `application/json` to ensure JSON format",
            "schema": {
              "type": "string",
              "enum": [
                "application/json"
              ],
              "default": "application/json"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMessageReq"
              },
              "examples": {
                "Request": {
                  "value": {
                    "model": "MiniMax-M3.1-Flash",
                    "messages": [
                      {
                        "role": "user",
                        "content": "Hello"
                      }
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Returns input token usage for the request without generating model output.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CountTokensResp"
                },
                "examples": {
                  "Request": {
                    "value": {
                      "usage": {
                        "input_tokens": 3,
                        "cache_creation_input_tokens": 0,
                        "cache_read_input_tokens": 0
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CreateMessageReq": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "Model ID. `MiniMax-M3.1-Flash` and `MiniMax-M3` are multimodal models with native support for text, image, and video input, alongside tool use and thinking content blocks. `MiniMax-M3.1-Flash` additionally always thinks and supports tunable thinking depth via `output_config.effort`.",
            "enum": [
              "MiniMax-M3.1-Flash",
              "MiniMax-M3"
            ]
          },
          "service_tier": {
            "type": "string",
            "description": "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.",
            "enum": [
              "standard",
              "priority"
            ],
            "default": "standard"
          },
          "system": {
            "description": "Set the role and behavior of the model.",
            "oneOf": [
              {
                "type": "string",
                "description": "Plain text system prompt"
              },
              {
                "type": "array",
                "description": "System prompt in content block array format. Text blocks can include cache_control (not supported by MiniMax-M3 or MiniMax-M3.1-Flash).",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "text"
                      ],
                      "description": "Content block type"
                    },
                    "text": {
                      "type": "string",
                      "description": "Text content"
                    },
                    "cache_control": {
                      "$ref": "#/components/schemas/CacheControl"
                    }
                  },
                  "required": [
                    "type",
                    "text"
                  ]
                }
              }
            ]
          },
          "messages": {
            "type": "array",
            "description": "Conversation history. `MiniMax-M3.1-Flash` and `MiniMax-M3` support text, image, video, tool use, tool result, and thinking content blocks. The M2.7, M2.5, M2.1, and M2 series support text and tool-call content blocks only; they do not support image or video input.",
            "items": {
              "$ref": "#/components/schemas/Message"
            }
          },
          "stream": {
            "type": "boolean",
            "description": "Whether to use streaming output, defaults to `false`. When set to `true`, the response will be returned in chunks",
            "default": false
          },
          "max_tokens": {
            "type": "integer",
            "format": "int64",
            "description": "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); for other models the recommended value is 65536 (64K) and the maximum is 204800 (200K). Content exceeding the limit will be truncated. If generation stops due to `length`, try increasing this value",
            "minimum": 1
          },
          "temperature": {
            "type": "number",
            "format": "double",
            "description": "Temperature coefficient, affects output randomness. Range [0, 2], default 1. Higher values produce more random output; lower values produce more deterministic output.",
            "minimum": 0,
            "maximum": 2,
            "default": 1
          },
          "top_p": {
            "type": "number",
            "format": "double",
            "description": "Nucleus sampling parameter. Range [0, 1]. Default is 0.95 for MiniMax-M3.1-Flash and MiniMax-M3, and 0.9 for M2.x models.",
            "minimum": 0,
            "maximum": 1,
            "default": 0.95
          },
          "tools": {
            "type": "array",
            "description": "Tool definitions for Anthropic-compatible tool use.",
            "items": {
              "$ref": "#/components/schemas/Tool"
            }
          },
          "tool_choice": {
            "$ref": "#/components/schemas/ToolChoice"
          },
          "thinking": {
            "type": "object",
            "description": "Controls thinking behavior. The default depends on the model, so no schema-level default is declared.\n- `MiniMax-M3.1-Flash`: always thinks. If `type` is sent it must be `adaptive`; `disabled` returns HTTP 400. Use `output_config.effort` to tune thinking depth.\n- `MiniMax-M3`: thinking is off when `thinking` is omitted; send `adaptive` to enable it and return thinking blocks.\n- M2.x models: thinking cannot be disabled; `disabled` is accepted but ignored.",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "disabled",
                  "adaptive"
                ],
                "description": "Thinking control type.\n- `disabled`: turns off thinking output for `MiniMax-M3`. Rejected with HTTP 400 by `MiniMax-M3.1-Flash`; accepted but ignored by M2.x models.\n- `adaptive`: enables thinking output and returns thinking blocks. The only value accepted by `MiniMax-M3.1-Flash`."
              }
            },
            "required": []
          },
          "output_config": {
            "type": "object",
            "description": "Output configuration. Use `effort` to tune thinking depth for `MiniMax-M3.1-Flash`.",
            "properties": {
              "effort": {
                "type": "string",
                "description": "Thinking depth for `MiniMax-M3.1-Flash`. Accepts `low`, `medium`, `high`, `xhigh`, or `max`; defaults to `max` when omitted. Other models ignore this field. `none` is not supported for `MiniMax-M3.1-Flash` and returns HTTP 400.",
                "enum": [
                  "low",
                  "medium",
                  "high",
                  "xhigh",
                  "max"
                ]
              }
            },
            "required": []
          },
          "metadata": {
            "type": "object",
            "description": "Request metadata. user_id is recommended for end-user-level aggregation, rate limiting, and billing analysis.",
            "properties": {
              "user_id": {
                "type": "string",
                "description": "End-user ID."
              }
            }
          }
        }
      },
      "CreateMessageResp": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique ID of this response"
          },
          "type": {
            "type": "string",
            "description": "Object type, fixed as `message`",
            "enum": [
              "message"
            ]
          },
          "role": {
            "type": "string",
            "description": "Role, fixed as `assistant`",
            "enum": [
              "assistant"
            ]
          },
          "model": {
            "type": "string",
            "description": "Model ID used for this request"
          },
          "content": {
            "type": "array",
            "description": "List of response content blocks",
            "items": {
              "$ref": "#/components/schemas/ResponseContentBlock"
            }
          },
          "stop_reason": {
            "type": "string",
            "description": "Reason for stopping generation:\n- end_turn: Model ended naturally\n- max_tokens: Reached max_tokens limit\n- tool_use: Model requested tool use",
            "enum": [
              "end_turn",
              "max_tokens",
              "tool_use"
            ]
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          }
        }
      },
      "Message": {
        "type": "object",
        "required": [
          "role",
          "content"
        ],
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "user",
              "assistant",
              "user_system",
              "group",
              "sample_message_user",
              "sample_message_ai"
            ],
            "description": "Role of the message sender. `MiniMax-M3.1-Flash` and `MiniMax-M3` use alternating user / assistant messages."
          },
          "content": {
            "description": "Message content. `MiniMax-M3.1-Flash` and `MiniMax-M3` support text, image, video, tool use, tool result, and thinking content blocks.",
            "oneOf": [
              {
                "type": "string",
                "description": "Plain text message"
              },
              {
                "type": "array",
                "description": "Message content. `MiniMax-M3.1-Flash` and `MiniMax-M3` support text, image, video, tool use, tool result, and thinking content blocks.",
                "items": {
                  "$ref": "#/components/schemas/RequestContentBlock"
                }
              }
            ]
          }
        }
      },
      "RequestContentBlock": {
        "type": "object",
        "description": "Content block accepted in request messages. text and tool blocks are supported by all models; image and video blocks are supported by `MiniMax-M3.1-Flash` and `MiniMax-M3` only. thinking is only used when echoing a prior assistant turn back to the model.",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "Content block type:\n- text: Text content\n- image: Image input, `MiniMax-M3.1-Flash` and `MiniMax-M3` only\n- video: Video input, `MiniMax-M3.1-Flash` and `MiniMax-M3` only\n- tool_use: Echoed assistant tool call from a previous turn\n- tool_result: Tool execution result\n- thinking: Echoed assistant thinking from a previous turn\n- mid_conv_system: System instructions inserted mid-conversation",
            "enum": [
              "text",
              "image",
              "video",
              "tool_use",
              "tool_result",
              "thinking",
              "mid_conv_system"
            ]
          },
          "text": {
            "type": "string",
            "description": "Text content when type=text."
          },
          "source": {
            "$ref": "#/components/schemas/MediaSource",
            "description": "Image or video source when type=image or type=video. `MiniMax-M3.1-Flash` and `MiniMax-M3` only."
          },
          "id": {
            "type": "string",
            "description": "Tool call ID when echoing type=tool_use."
          },
          "name": {
            "type": "string",
            "description": "Tool name when echoing type=tool_use."
          },
          "input": {
            "type": "object",
            "description": "Tool input when echoing type=tool_use."
          },
          "tool_use_id": {
            "type": "string",
            "description": "ID of the matching tool_use block when type=tool_result."
          },
          "content": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/RequestContentBlock"
                }
              }
            ],
            "description": "Tool execution result, either a string or an array of text/image content blocks."
          },
          "thinking": {
            "type": "string",
            "description": "Echoed assistant thinking content when type=thinking."
          },
          "signature": {
            "type": "string",
            "description": "Signature for echoed thinking content. Return unchanged in later turns."
          },
          "cache_control": {
            "$ref": "#/components/schemas/CacheControl"
          }
        }
      },
      "ResponseContentBlock": {
        "type": "object",
        "description": "Content block returned in response messages. The model emits text, tool_use (when calling tools), and thinking (when extended thinking is active). Responses never contain image, video, tool_result, or mid_conv_system blocks.",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "Content block type:\n- text: Text content\n- tool_use: Model tool call\n- thinking: Model thinking content",
            "enum": [
              "text",
              "tool_use",
              "thinking"
            ]
          },
          "text": {
            "type": "string",
            "description": "Text content when type=text."
          },
          "id": {
            "type": "string",
            "description": "Tool call ID returned when type=tool_use."
          },
          "name": {
            "type": "string",
            "description": "Tool name returned when type=tool_use."
          },
          "input": {
            "type": "object",
            "description": "Tool input returned when type=tool_use."
          },
          "thinking": {
            "type": "string",
            "description": "Model thinking content when type=thinking."
          },
          "signature": {
            "type": "string",
            "description": "Signature for thinking content. Return unchanged in later turns."
          }
        }
      },
      "Usage": {
        "type": "object",
        "description": "Token usage for this request, including prompt cache usage when applicable.",
        "properties": {
          "input_tokens": {
            "type": "integer",
            "description": "Number of tokens consumed by input"
          },
          "output_tokens": {
            "type": "integer",
            "description": "Number of tokens consumed by output"
          },
          "cache_creation_input_tokens": {
            "type": "integer",
            "description": "Number of input tokens used to create prompt cache entries."
          },
          "cache_read_input_tokens": {
            "type": "integer",
            "description": "Number of input tokens read from prompt cache."
          }
        }
      },
      "StreamEvent": {
        "type": "object",
        "description": "",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "Event type:\n- `message_start`: Message start, contains complete message metadata\n- `ping`: Heartbeat event\n- `content_block_start`: Content block start\n- `content_block_delta`: Content block incremental update\n- `content_block_stop`: Content block end\n- `message_delta`: Message-level incremental update (e.g., stop_reason)\n- `message_stop`: Message end",
            "enum": [
              "message_start",
              "ping",
              "content_block_start",
              "content_block_delta",
              "content_block_stop",
              "message_delta",
              "message_stop"
            ]
          },
          "message": {
            "type": "object",
            "description": "Message object (returned when `type` is `message_start`)",
            "properties": {
              "id": {
                "type": "string",
                "description": "Unique ID of the message"
              },
              "type": {
                "type": "string",
                "enum": [
                  "message"
                ]
              },
              "role": {
                "type": "string",
                "enum": [
                  "assistant"
                ]
              },
              "content": {
                "type": "array",
                "description": "Content block list, initially an empty array",
                "items": {
                  "$ref": "#/components/schemas/ResponseContentBlock"
                }
              },
              "model": {
                "type": "string",
                "description": "Model ID"
              },
              "stop_reason": {
                "type": "string",
                "nullable": true,
                "description": "Stop reason, null at the start of streaming"
              },
              "stop_sequence": {
                "type": "string",
                "nullable": true,
                "description": "Stop sequence, null at the start of streaming"
              },
              "usage": {
                "$ref": "#/components/schemas/Usage"
              }
            }
          },
          "index": {
            "type": "integer",
            "description": "Index of the content block (returned for `content_block_start`, `content_block_delta`, `content_block_stop`)"
          },
          "content_block": {
            "$ref": "#/components/schemas/ResponseContentBlock",
            "description": "Content block object (returned when `type` is `content_block_start`)"
          },
          "delta": {
            "type": "object",
            "description": "Incremental update content (returned for `content_block_delta` or `message_delta`)",
            "properties": {
              "type": {
                "type": "string",
                "description": "Delta type, for example text_delta, thinking_delta, or signature_delta.",
                "enum": [
                  "text_delta",
                  "thinking_delta",
                  "signature_delta"
                ]
              },
              "text": {
                "type": "string",
                "description": "Incremental text content"
              },
              "stop_reason": {
                "type": "string",
                "description": "Reason for stopping generation.",
                "enum": [
                  "end_turn",
                  "max_tokens",
                  "tool_use"
                ]
              }
            }
          },
          "usage": {
            "$ref": "#/components/schemas/Usage",
            "description": "Token usage (returned for `message_delta`)"
          }
        }
      },
      "CacheControl": {
        "type": "object",
        "description": "Prompt cache marker. Not supported by MiniMax-M3 or MiniMax-M3.1-Flash.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "ephemeral"
            ],
            "description": "Prompt cache marker."
          }
        },
        "required": [
          "type"
        ]
      },
      "MediaSource": {
        "type": "object",
        "description": "Media source for image or video blocks.\n\n**Supported image formats**\n\n| Format | Common extensions | MIME Type |\n| :-- | :-- | :-- |\n| JPEG | .jpg, .jpeg | image/jpeg |\n| PNG | .png | image/png |\n| GIF | .gif | image/gif |\n| WEBP | .webp | image/webp |\n\n**Supported video formats**\n\n| Format | Common extensions | MIME Type |\n| :-- | :-- | :-- |\n| MP4 | .mp4 | video/mp4 |\n| AVI | .avi | video/avi or video/x-msvideo |\n| 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> |\n| MKV | .mkv | video/x-matroska |\n\n**File size and request limits**\n- URL or Base64 input: video file ≤ 50 MB, image file ≤ 10 MB, request body ≤ 64 MB.\n- Files API upload: referenced as `mm_file://{file_id}`, with a single video up to 512 MB.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "base64",
              "url"
            ],
            "description": "Media source type."
          },
          "media_type": {
            "type": "string",
            "description": "Required for base64 input, for example image/png or video/mp4."
          },
          "data": {
            "type": "string",
            "description": "Base64-encoded media bytes."
          },
          "url": {
            "type": "string",
            "description": "Public URL. Videos can also use a 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."
          },
          "detail": {
            "type": "string",
            "enum": [
              "low",
              "default",
              "high"
            ],
            "default": "default",
            "description": "Understanding detail level. Defaults to default.\n\nFor image input, rough single-image token usage heuristic:\n\n| detail | Rough token usage |\n| :-- | :-- |\n| low | Usually a few hundred tokens, up to ~600 |\n| default | Often ~1k-3k tokens, up to ~5k |\n| high | Often several thousand tokens, up to ~15k+ |\n\nActual usage depends on image size and content; use `POST /anthropic/v1/messages/count_tokens` or response usage for exact usage."
          },
          "fps": {
            "type": "number",
            "minimum": 0.2,
            "maximum": 5,
            "default": 1,
            "description": "Video frame sampling rate. Defaults to 1. Range [0.2, 5].\n- Higher values: more sensitive to scene changes, but higher token cost and slower response.\n- Lower values: lower token cost and faster response, but less sensitive to scene changes."
          },
          "max_long_side_pixel": {
            "type": "integer",
            "minimum": 1,
            "description": "Longest-side pixel limit for the image or video frames."
          }
        },
        "required": [
          "type"
        ]
      },
      "Tool": {
        "type": "object",
        "description": "Tool definitions for Anthropic-compatible tool use.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Tool name."
          },
          "description": {
            "type": "string",
            "description": "Tool description."
          },
          "input_schema": {
            "type": "object",
            "description": "Tool input parameters JSON Schema."
          },
          "cache_control": {
            "$ref": "#/components/schemas/CacheControl"
          }
        },
        "required": [
          "name",
          "input_schema"
        ]
      },
      "ToolChoice": {
        "type": "object",
        "description": "Tool selection strategy. Only `auto` is supported; the model decides whether to call tools.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "auto"
            ],
            "description": "Tool choice type."
          }
        },
        "required": [
          "type"
        ]
      },
      "CountTokensResp": {
        "type": "object",
        "description": "Returns input token usage for the request without generating model output.",
        "properties": {
          "usage": {
            "$ref": "#/components/schemas/Usage"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "description": "Error response. Uses an HTTP status code plus a JSON body. When an error occurs during streaming, it is delivered as an `event: error` SSE event with the same body structure; clients should stop reading and clean up the session state after receiving an error.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "error"
            ],
            "description": "Always `error`."
          },
          "request_id": {
            "type": "string",
            "description": "Unique identifier of the request, useful for troubleshooting."
          },
          "error": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "description": "Error type.",
                "enum": [
                  "invalid_request_error",
                  "authentication_error",
                  "permission_error",
                  "not_found_error",
                  "request_too_large",
                  "rate_limit_error",
                  "api_error",
                  "overloaded_error"
                ]
              },
              "message": {
                "type": "string",
                "description": "Error details."
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bearer API Key auth. Send Authorization: Bearer <API_KEY>. If Authorization and x-api-key are both present, Authorization takes precedence."
      },
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Anthropic-compatible API Key auth. Send x-api-key: <API_KEY>. Authorization: Bearer <API_KEY> is recommended."
      }
    }
  }
}
