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