- 兼容 OpenAI Chat Completions API 格式
- 通过
model参数指定gpt-5.4模型 - 支持流式输出(SSE)
- 支持多轮对话、系统提示词、视觉输入
Authorizations
Authorizationstring必填
所有接口均需要使用 Bearer Token 进行认证
获取 API Key:访问 API Key 管理页面 获取您的 API Key
使用时在请求头中添加:
Authorization: Bearer YOUR_API_KEYBody
modelstring必填默认
gpt-5.4模型名称
示例:"gpt-5.4"
messagesobject[]必填
对话消息列表,按时间顺序排列
streamboolean默认
false是否启用流式输出(Server-Sent Events)
true:逐 token 流式返回false:等待完整响应后一次性返回
max_tokensinteger
生成内容的最大 token 数量
不设置时使用模型默认上限
temperaturenumber默认
1采样温度,控制输出随机性
- 范围:
0~2 - 值越低输出越稳定,值越高输出越随机
top_pnumber默认
1核采样概率阈值
范围:0 ~ 1,建议不要同时修改 temperature 和 top_p
stopstring | string[]
停止序列,遇到指定字符串时停止生成
最多 4 个停止序列
Response
idstring
本次请求的唯一标识符
objectstring
对象类型,固定为 chat.completion
createdinteger
请求创建时间(Unix 时间戳)
modelstring
实际使用的模型名称
choicesobject[]
生成结果列表
choices[].message.role:消息角色,固定为assistantchoices[].message.content:生成的文本内容choices[].finish_reason:结束原因,stop/length/content_filterchoices[].index:结果索引
usageobject
本次请求的 token 消耗统计
usage.prompt_tokens:输入 token 数usage.completion_tokens:输出 token 数usage.total_tokens:总 token 数
