跳转至

Chat Completions

本节列出该能力下当前已实现的接口。

创建聊天对话

POST /v1/chat/completions

根据对话历史创建模型响应。支持流式和非流式响应。

兼容 OpenAI Chat Completions API。

鉴权

  • Bearer Token (Authorization: Bearer <token>)

请求体

  • Content-Type: application/json
  • Schema: ChatCompletionRequest
字段 类型 必填 说明
model string yes 模型 ID
messages array[Message] yes 对话消息列表
temperature number no 采样温度
top_p number no 核采样参数
n integer no 生成数量
stream boolean no 是否流式响应
stream_options object no -
stop - no 停止序列
max_tokens integer no 最大生成 Token 数
max_completion_tokens integer no 最大补全 Token 数
presence_penalty number no -
frequency_penalty number no -
logit_bias object no -
user string no -
tools array[Tool] no -
tool_choice - no -
response_format object (ResponseFormat) no -
seed integer no -
reasoning_effort string no 推理强度 (用于支持推理的模型)
modalities array[string] no -
audio object no -

返回

状态码 说明 Schema
200 成功创建响应 ChatCompletionResponse
400 请求参数错误 ErrorResponse
429 请求频率限制 ErrorResponse