跳转到主要内容
POST
创建 Chat Completion

授权

Authorization
string
header
必填

在控制台 API Key 页面创建的 key,通过请求头 Authorization: Bearer <key> 传入。

请求体

application/json
model
string
必填

模型 ID,例如 deepseek-ai/DeepSeek-V4.1-Flash。

示例:

"deepseek-ai/DeepSeek-V4.1-Flash"

messages
object[]
必填
Minimum array length: 1
max_tokens
integer | null
必填范围: x >= 1
max_completion_tokens
integer | null
必填范围: x >= 1
temperature
number | null
默认值:1
必填范围: 0 <= x <= 2
top_p
number | null
默认值:1
必填范围: x <= 1
top_k
integer | null

非 OpenAI 标准参数,LithosAI 支持。

n
integer | null
默认值:1

只能为 1。其他值返回 400,错误码为 unsupported_n。

stop
stream
boolean | null
默认值:false
stream_options
object | null
presence_penalty
number | null
默认值:0
必填范围: -2 <= x <= 2
frequency_penalty
number | null
默认值:0
必填范围: -2 <= x <= 2
seed
integer | null
response_format
object | null
reasoning_effort
string | null
tools
object[]
tool_choice
user
string

响应

返回生成结果;stream 为 true 时返回 SSE 流。

id
string
必填
object
string
必填
Allowed value: "chat.completion"
created
integer<unixtime>
必填
model
string
必填
choices
object[]
必填
usage
object