Skip to main content
POST

授权

Authorization
string
header
必填

所有接口均需要使用Bearer Token进行认证

使用时在请求头中添加:

Authorization: Bearer YOUR_API_KEY

请求体

application/json
model
string
必填

模型名称,如 gpt-5.4、deepseek-chat 等

示例:

"gpt-5.4"

messages
object[]
必填

对话消息列表

stream
boolean
默认值:false

是否流式返回响应

temperature
number

采样温度 (0-2)

必填范围: 0 <= x <= 2
max_tokens
integer

最大生成token数

top_p
number

核采样参数 (0-1)

必填范围: 0 <= x <= 1
frequency_penalty
number

频率惩罚 (-2 到 2)

必填范围: -2 <= x <= 2
presence_penalty
number

存在惩罚 (-2 到 2)

必填范围: -2 <= x <= 2
tools
object[]

可用工具列表

tool_choice

工具选择策略

可用选项:
none,
auto,
required
response_format
object

响应格式

stop

停止序列

n
integer

生成数量

响应

对话补全响应

id
string

唯一补全ID

示例:

"chatcmpl-abc123"

object
enum<string>

对象类型

可用选项:
chat.completion
created
integer

创建时间戳

示例:

1757165031

model
string

使用的模型

choices
object[]
usage
object