Skip to main content
POST
创建聊天对话

授权

Authorization
string
header
必填

使用 Bearer Token 认证。 格式: Authorization: Bearer sk-xxxxxx

请求体

application/json
model
string
必填

模型 ID

示例:

"gpt-4"

messages
object[]
必填

对话消息列表

temperature
number
默认值:1

采样温度

必填范围: 0 <= x <= 2
top_p
number
默认值:1

核采样参数

必填范围: 0 <= x <= 1
n
integer
默认值:1

生成数量

必填范围: x >= 1
stream
boolean
默认值:false

是否流式响应

stream_options
object
stop

停止序列

max_tokens
integer

最大生成 Token 数

max_completion_tokens
integer

最大补全 Token 数

presence_penalty
number
默认值:0
必填范围: -2 <= x <= 2
frequency_penalty
number
默认值:0
必填范围: -2 <= x <= 2
logit_bias
object
user
string
tools
object[]
tool_choice
可用选项:
none,
auto,
required
response_format
object
seed
integer
reasoning_effort
enum<string>

推理强度 (用于支持推理的模型)

可用选项:
low,
medium,
high
modalities
enum<string>[]
可用选项:
text,
audio
audio
object

响应

成功创建响应

id
string
object
string
示例:

"chat.completion"

created
integer
model
string
choices
object[]
usage
object
system_fingerprint
string