文本到语音合成
⚠️ 测试中
▼
Authorization
在 Header 添加参数 Authorization,其值为 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
请求参数
Header 参数
Content-Type
string
可选
示例: application/json
Authorization
string
可选
示例: Bearer {{YOUR_API_KEY}}
Body 参数 application/json
model
string
必需
模型名称
messages
array [object]
必需
消息列表
stream
boolean
可选
是否启用流式响应
max_completion_tokens
integer
可选
最大生成令牌数
temperature
number
可选
采样温度
top_p
number
可选
核采样阈值
stream_options
object
可选
流式响应选项
示例
{
"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
}
}
请求示例代码
curl --location --request POST 'https://api.quickrouter.ai/v1/messages' --header 'Authorization: Bearer YOUR_API_KEY' --header 'Content-Type: application/json' --data-raw '{
"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
}
}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer YOUR_API_KEY");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"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
}
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.quickrouter.ai/v1/messages", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
import http.client
import json
conn = http.client.HTTPSConnection("api.quickrouter.ai")
payload = json.dumps({
"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
}
})
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
conn.request("POST", "/v1/messages", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
返回响应
响应参数 application/json
id
string
可选
对话ID
choices
array [object]
可选
回复选择
created
integer
可选
创建时间
model
string
可选
模型名称
object
string
可选
对象类型
usage
object
可选
用量统计
示例
{
"id": "04ecb5d9b1921ae0fb0e8da9017a5474",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"content": "您好!请问有什么可以帮您?",
"role": "assistant",
"name": "MiniMax AI"
}
}
],
"created": 1755153113,
"model": "MiniMax-M1",
"object": "chat.completion",
"usage": {
"total_tokens": 249,
"prompt_tokens": 26,
"completion_tokens": 223
}
}