https://platform.minimaxi.com/docs/api-reference/text-post
POST
/v1/messages文本合成
API Key application/json
请求示例
curl -X POST https://top.qingyuntop.ai/v1/messages \
-H "Authorization: Bearer ${QINGYUN_TOP_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"model": "MiniMax-M2.1",
"messages": [
{
"role": "system",
"name": "AI助手",
"content": "你是一个专业、友好的AI助手。"
},
{
"role": "user",
"name": "张三",
"content": "帮我写一首关于秋天的诗。"
}
],
"stream": true,
"max_completion_tokens": 2048,
"temperature": 0.9,
"top_p": 0.95,
"stream_options": {
"include_usage": true
}
}'请求参数
| 参数 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
model | JSON body | string | 是 | - | - |
messages | JSON body | array<object> | 是 | - | - |
messages[].role | JSON body | string | 是 | - | - |
messages[].name | JSON body | string | 是 | - | - |
messages[].content | JSON body | string | 是 | - | - |
stream | JSON body | boolean | 否 | - | - |
max_completion_tokens | JSON body | integer | 否 | - | - |
temperature | JSON body | number | 否 | - | - |
top_p | JSON body | number | 否 | - | - |
stream_options | JSON body | object | 否 | - | - |
stream_options.include_usage | JSON body | boolean | 是 | - | - |
返回响应 (200)
| 参数 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
id | 响应 JSON | string | 是 | - | - |
choices | 响应 JSON | array<object> | 是 | - | - |
choices[].finish_reason | 响应 JSON | string | 否 | - | - |
choices[].index | 响应 JSON | integer | 否 | - | - |
choices[].message | 响应 JSON | object | 否 | - | - |
choices[].message.content | 响应 JSON | string | 是 | - | - |
choices[].message.role | 响应 JSON | string | 是 | - | - |
choices[].message.name | 响应 JSON | string | 是 | - | - |
choices[].message.audio_content | 响应 JSON | string | 是 | - | - |
choices[].message.reasoning_content | 响应 JSON | string | 是 | - | - |
created | 响应 JSON | integer | 是 | - | - |
model | 响应 JSON | string | 是 | - | - |
object | 响应 JSON | string | 是 | - | - |
usage | 响应 JSON | object | 是 | - | - |
usage.total_tokens | 响应 JSON | integer | 是 | - | - |
usage.total_characters | 响应 JSON | integer | 是 | - | - |
usage.prompt_tokens | 响应 JSON | integer | 是 | - | - |
usage.completion_tokens | 响应 JSON | integer | 是 | - | - |
usage.completion_tokens_details | 响应 JSON | object | 是 | - | - |
usage.completion_tokens_details.reasoning_tokens | 响应 JSON | integer | 是 | - | - |
input_sensitive | 响应 JSON | boolean | 是 | - | - |
output_sensitive | 响应 JSON | boolean | 是 | - | - |
input_sensitive_type | 响应 JSON | integer | 是 | - | - |
output_sensitive_type | 响应 JSON | integer | 是 | - | - |
output_sensitive_int | 响应 JSON | integer | 是 | - | - |
base_resp | 响应 JSON | object | 是 | - | - |
base_resp.status_code | 响应 JSON | integer | 是 | - | - |
base_resp.status_msg | 响应 JSON | string | 是 | - | - |
响应示例
{
"id": "04ecb5d9b1921ae0fb0e8da9017a5474",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"content": "您好!请问有什么可以帮您?",
"role": "assistant",
"name": "MiniMax AI",
"audio_content": "",
"reasoning_content": "...省略"
}
}
],
"created": 1755153113,
"model": "MiniMax-M1",
"object": "chat.completion",
"usage": {
"total_tokens": 249,
"total_characters": 0,
"prompt_tokens": 26,
"completion_tokens": 223,
"completion_tokens_details": {
"reasoning_tokens": 214
}
},
"input_sensitive": false,
"output_sensitive": false,
"input_sensitive_type": 0,
"output_sensitive_type": 0,
"output_sensitive_int": 0,
"base_resp": {
"status_code": 0,
"status_msg": ""
}
}来源原始接口定义(用于追溯)
以下内容来自 Apifox 快照,可能包含兼容层字段或旧示例;公开调用请以本页的协议说明和当前模型列表为准。
{
"id": 497676102,
"name": "文本合成",
"type": "http",
"serverId": "",
"preProcessors": [],
"postProcessors": [],
"inheritPreProcessors": {},
"inheritPostProcessors": {},
"description": "https://platform.minimaxi.com/docs/api-reference/text-post",
"operationId": "",
"sourceUrl": "",
"method": "post",
"path": "/v1/messages",
"tags": [],
"status": -2,
"requestBody": {
"type": "application/json",
"parameters": [],
"jsonSchema": {
"type": "object",
"properties": {
"model": {
"type": "string"
},
"messages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"role": {
"type": "string"
},
"name": {
"type": "string"
},
"content": {
"type": "string"
}
},
"required": [
"role",
"name",
"content"
],
"x-apifox-orders": [
"role",
"name",
"content"
]
}
},
"stream": {
"type": "boolean"
},
"max_completion_tokens": {
"type": "integer"
},
"temperature": {
"type": "number"
},
"top_p": {
"type": "number"
},
"stream_options": {
"type": "object",
"properties": {
"include_usage": {
"type": "boolean"
}
},
"required": [
"include_usage"
],
"x-apifox-orders": [
"include_usage"
]
}
},
"required": [
"model",
"messages"
],
"x-apifox-orders": [
"model",
"messages",
"stream",
"max_completion_tokens",
"temperature",
"top_p",
"stream_options"
]
},
"examples": [
{
"mediaType": "application/json",
"value": "{\r\n \"model\": \"MiniMax-M2.1\",\r\n \"messages\": [\r\n {\r\n \"role\": \"system\",\r\n \"name\": \"AI助手\",\r\n \"content\": \"你是一个专业、友好的AI助手。\"\r\n },\r\n {\r\n \"role\": \"user\",\r\n \"name\": \"张三\",\r\n \"content\": \"帮我写一首关于秋天的诗。\"\r\n }\r\n ],\r\n \"stream\": true,\r\n \"max_completion_tokens\": 2048,\r\n \"temperature\": 0.9,\r\n \"top_p\": 0.95,\r\n \"stream_options\": {\r\n \"include_usage\": true\r\n }\r\n}",
"name": "示例 1"
}
],
"mediaType": "",
"oasExtensions": "",
"required": true,
"additionalContentTypes": []
},
"parameters": {
"path": [],
"query": [],
"cookie": [],
"header": []
},
"commonParameters": {
"query": [],
"body": [],
"cookie": [],
"header": []
},
"auth": {},
"responses": [
{
"id": 160612286,
"name": "成功",
"code": 200,
"contentType": "json",
"jsonSchema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"choices": {
"type": "array",
"items": {
"type": "object",
"properties": {
"finish_reason": {
"type": "string"
},
"index": {
"type": "integer"
},
"message": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"role": {
"type": "string"
},
"name": {
"type": "string"
},
"audio_content": {
"type": "string"
},
"reasoning_content": {
"type": "string"
}
},
"required": [
"content",
"role",
"name",
"audio_content",
"reasoning_content"
],
"x-apifox-orders": [
"content",
"role",
"name",
"audio_content",
"reasoning_content"
]
}
},
"x-apifox-orders": [
"finish_reason",
"index",
"message"
]
}
},
"created": {
"type": "integer"
},
"model": {
"type": "string"
},
"object": {
"type": "string"
},
"usage": {
"type": "object",
"properties": {
"total_tokens": {
"type": "integer"
},
"total_characters": {
"type": "integer"
},
"prompt_tokens": {
"type": "integer"
},
"completion_tokens": {
"type": "integer"
},
"completion_tokens_details": {
"type": "object",
"properties": {
"reasoning_tokens": {
"type": "integer"
}
},
"required": [
"reasoning_tokens"
],
"x-apifox-orders": [
"reasoning_tokens"
]
}
},
"required": [
"total_tokens",
"total_characters",
"prompt_tokens",
"completion_tokens",
"completion_tokens_details"
],
"x-apifox-orders": [
"total_tokens",
"total_characters",
"prompt_tokens",
"completion_tokens",
"completion_tokens_details"
]
},
"input_sensitive": {
"type": "boolean"
},
"output_sensitive": {
"type": "boolean"
},
"input_sensitive_type": {
"type": "integer"
},
"output_sensitive_type": {
"type": "integer"
},
"output_sensitive_int": {
"type": "integer"
},
"base_resp": {
"type": "object",
"properties": {
"status_code": {
"type": "integer"
},
"status_msg": {
"type": "string"
}
},
"required": [
"status_code",
"status_msg"
],
"x-apifox-orders": [
"status_code",
"status_msg"
]
}
},
"required": [
"id",
"choices",
"created",
"model",
"object",
"usage",
"input_sensitive",
"output_sensitive",
"input_sensitive_type",
"output_sensitive_type",
"output_sensitive_int",
"base_resp"
],
"x-apifox-orders": [
"id",
"choices",
"created",
"model",
"object",
"usage",
"input_sensitive",
"output_sensitive",
"input_sensitive_type",
"output_sensitive_type",
"output_sensitive_int",
"base_resp"
]
},
"itemSchema": {},
"description": "",
"mediaType": "",
"headers": []
}
],
"responseExamples": [
{
"name": "成功示例",
"responseId": 160612286,
"data": "{\r\n \"id\": \"04ecb5d9b1921ae0fb0e8da9017a5474\",\r\n \"choices\": [\r\n {\r\n \"finish_reason\": \"stop\",\r\n \"index\": 0,\r\n \"message\": {\r\n \"content\": \"您好!请问有什么可以帮您?\",\r\n \"role\": \"assistant\",\r\n \"name\": \"MiniMax AI\",\r\n \"audio_content\": \"\",\r\n \"reasoning_content\": \"...省略\"\r\n }\r\n }\r\n ],\r\n \"created\": 1755153113,\r\n \"model\": \"MiniMax-M1\",\r\n \"object\": \"chat.completion\",\r\n \"usage\": {\r\n \"total_tokens\": 249,\r\n \"total_characters\": 0,\r\n \"prompt_tokens\": 26,\r\n \"completion_tokens\": 223,\r\n \"completion_tokens_details\": {\r\n \"reasoning_tokens\": 214\r\n }\r\n },\r\n \"input_sensitive\": false,\r\n \"output_sensitive\": false,\r\n \"input_sensitive_type\": 0,\r\n \"output_sensitive_type\": 0,\r\n \"output_sensitive_int\": 0,\r\n \"base_resp\": {\r\n \"status_code\": 0,\r\n \"status_msg\": \"\"\r\n }\r\n}",
"description": "",
"oasKey": "",
"oasExtensions": "",
"id": "019fd273-07ef-755a-b47e-e979976fcf69"
}
],
"codeSamples": [],
"projectId": 8662722,
"moduleId": 8310462,
"folderId": 92436087,
"ordering": 78,
"responsibleId": 0,
"commonResponseStatus": {},
"advancedSettings": {
"disabledSystemHeaders": {}
},
"customApiFields": {},
"oasExtensions": "",
"mockScript": {},
"createdAt": "2026-08-05T15:03:02.000Z",
"updatedAt": "2026-08-05T15:03:05.000Z",
"creatorId": 2863449,
"editorId": 2863449,
"creatorUserId": 2863449,
"editorUserId": 2863449,
"responseChildren": [],
"visibility": "INHERITED",
"securityScheme": {},
"callbacks": ""
}