流式接口
POST
/v1/stream/chat响应参数
流式接口的响应参数只有最后一条带有usage信息,其他与上面的非流式接口完全一致, 故不做特殊说明
请求参数
Header 参数
Content-Type
string
必需
示例值:
application/json
Authorization
string
必需
示例值:
Bearer ${api_key}
X-BC-Request-Id
string
必需
示例值:
${request_id}
X-BC-Timestamp
string
必需
示例值:
${timestamp}
X-BC-Signature
string
必需
示例值:
${signature}
X-BC-Sign-Algo
string
必需
示例值:
MD5
Body 参数application/json
model
string
必需
使用的模型 ID,当前默认 Baichuan2-53B
messages
array [object {2}]
必需
对话消息列表 (历史对话按从老到新顺序填入)
role
string
可选
user=用户, assistant=助手
content
string
内容
示例
{
"model": "Baichuan2-53B",
"messages": [
{
"role": "user",
"content": "世界第一高峰是"
}
]
}
示例代码
返回响应
成功(200)
HTTP 状态码: 200
内容格式: JSONapplication/json
数据结构
code
integer
必需
状态码,0 表示成功,非 0 表示失败
data
object
对话结果
messages
array [object {3}]
必需
对话消息列表(历史对话按从老到新顺序填入)
msg
string
提示信息
示例
{"code":0,"data":{"messages":[{"content":"世界第一高峰是珠穆","finish_reason":"","role":"assistant"}]},"msg":"success"}
{"code":0,"data":{"messages":[{"content":"朗玛峰,位于","finish_reason":"","role":"assistant"}]},"msg":"success"}
{"code":0,"data":{"messages":[{"content":"喜马拉雅山脉,海拔高度","finish_reason":"","role":"assistant"}]},"msg":"success"}
{"code":0,"data":{"messages":[{"content":"为8,84","finish_reason":"","role":"assistant"}]},"msg":"success"}
{"code":0,"data":{"messages":[{"content":"8米。","finish_reason":"stop","role":"assistant"}]},"msg":"success","usage":{"answer_tokens":24,"prompt_tokens":5,"total_tokens":29}}
最后修改时间: 1 年前