openapi: 3.1.0 info: title: MiniMax Files Text Generation API description: MiniMax text generation API with support for chat completion and streaming output license: name: MIT version: 1.0.0 servers: - url: https://api.minimax.io security: - bearerAuth: [] tags: - name: Text Generation paths: /v1/text/chatcompletion_v2: post: summary: Text Generation V2 description: Generate text using MiniMax models with support for single-turn and multi-turn conversations operationId: chatCompletionV2 tags: - Text Generation requestBody: description: Chat completion request parameters content: application/json: schema: $ref: '#/components/schemas/ChatCompletionReq' required: true responses: '200': description: Successful response content: application/json: schema: $ref: '#/components/schemas/ChatCompletionResp' '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/Error' '401': description: Authentication failed content: application/json: schema: $ref: '#/components/schemas/Error' '500': description: Internal server error content: application/json: schema: $ref: '#/components/schemas/Error' components: schemas: Usage: type: object properties: prompt_tokens: type: integer description: Number of tokens in the prompt completion_tokens: type: integer description: Number of tokens in the completion total_tokens: type: integer description: Total number of tokens used Error: type: object required: - error - message properties: error: type: integer format: int32 description: Error code message: type: string description: Error message ChatCompletionReq: type: object required: - model - messages properties: model: type: string description: Model ID for text generation enum: - MiniMax-M1 - MiniMax-Text-01 messages: type: array description: List of messages in the conversation items: $ref: '#/components/schemas/Message' temperature: type: number format: double description: Sampling temperature (0.0 to 1.0) minimum: 0.0 maximum: 1.0 default: 0.7 max_tokens: type: integer description: Maximum number of tokens to generate minimum: 1 maximum: 4096 stream: type: boolean description: Whether to stream the response default: false top_p: type: number format: double description: Nucleus sampling parameter minimum: 0.0 maximum: 1.0 default: 0.9 Choice: type: object properties: index: type: integer description: Index of the choice message: $ref: '#/components/schemas/Message' finish_reason: type: string enum: - stop - length - content_filter description: Reason for completion ChatCompletionResp: type: object properties: id: type: string description: Unique identifier for the completion object: type: string description: Object type enum: - chat.completion created: type: integer format: int64 description: Unix timestamp of creation model: type: string description: Model used for completion choices: type: array description: List of completion choices items: $ref: '#/components/schemas/Choice' usage: $ref: '#/components/schemas/Usage' Message: type: object required: - role - content properties: role: type: string enum: - system - user - assistant description: Role of the message sender content: type: string description: Content of the message securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT