Skip to main content
POST
创建对话补全

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

请求体

application/json
model
string
必填
示例:

"gpt-5.4"

messages
object[]
必填
temperature
number

采样温度。

必填范围: 0 <= x <= 2
top_p
number

核采样累计概率。

必填范围: 0 <= x <= 1
max_tokens
integer
已弃用

max_completion_tokens 的已弃用兼容别名。Kimi K3 接受两种写法,并使用 max_completion_tokens。

必填范围: x >= 1
max_completion_tokens
integer

思考与最终答案共用的最大 token 数。上限因模型而异;预算耗尽时答案可能不完整。 Kimi K3 省略时默认为 131072,最高支持 1048576。

必填范围: 1 <= x <= 1048576
reasoning_effort
enum<string>

思考强度。此枚举仅表示语法允许值,不代表每个模型均支持。模型不支持的值返回 400。Kimi K3 支持 low、high、max(默认 max);GPT-5.4/5.5 支持 none、low、medium、high、xhigh。Claude 与 Gemini 限制见 /zh/models/chat-models。省略时保持模型默认行为。模型级可用档位、默认档位与能否关闭思考都发布在 GET /v1/models 的 capability_metadata.reasoning 中。

可用选项:
none,
minimal,
low,
medium,
high,
xhigh,
max
stop

最多 4 个停止序列。

n
integer

生成候选条数。

必填范围: x >= 1
frequency_penalty
number
必填范围: -2 <= x <= 2
presence_penalty
number
必填范围: -2 <= x <= 2
seed
integer

尽量可复现的采样种子。

response_format
object

强制 JSON 对象或 JSON Schema 输出,如 { "type": "json_object" }。

tools
object[]

模型可调用的工具/函数声明。

tool_choice

工具选择:'auto' | 'none' | 'required' | { type: 'function', function: { name } }。

logprobs
boolean
top_logprobs
integer
必填范围: 0 <= x <= 20
logit_bias
object
user
string

终端用户标识,用于风险审计。

stream
boolean

为 true 时通过 SSE 流式返回增量(OpenAI chat.completion.chunk),以 'data: [DONE]' 结束。

reasoning
object

reasoning_effort 的兼容别名。同时提供两种 effort 写法时,值必须一致;冲突返回 400。

响应

OpenAI 兼容的对话补全响应。

id
string
必填
object
string
必填
示例:

"chat.completion"

created
integer
必填
model
string
必填
choices
object[]
必填
usage
object