文本生成
POST/api/v5/chat/completions
Request
Header Parameters
Authorization stringrequired
用户个人令牌
- application/json
Body
temperature温度 (number)
默认 0.7
top_ktop_k (integer)
默认 50
top_ptop_p (number)
默认 0.7
frequency_penaltynumber
默认 1.0
messagesstring[]required
model模型 (string)required
maxTokens最大Token数 (integer)
Responses
- 200
Response Headers
- application/json
- Schema
- Example (auto)
- Example
Schema
trace_id字符串 (string)required
请求的唯一标识
choicesstring[]required
extstringrequired
扩展字段,通常为null
usage objectrequired
prompt_tokens数字 (integer)required
提示词消耗的token数量
completion_tokens数字 (integer)required
补全内容消耗的token数量
total_tokens数字 (integer)required
总token数量
think_tokens数字 (integer)
思考过程消耗的token数量
{
"trace_id": "string",
"choices": [
"string"
],
"ext": "string",
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"think_tokens": 0
}
}
{
"trace_id": "045560649c7c483e80eb196e2bc95d38",
"choices": [
{
"index": 0,
"finish_reason": null,
"delta": {
"content": "这是流式返回的内容片段"
}
}
],
"ext": null,
"usage": {
"prompt_tokens": 11,
"completion_tokens": 146,
"total_tokens": 157,
"think_tokens": null
}
}