Skip to main content
POST
对话补全

授权

Authorization
string
header
必填

使用 Bearer 令牌进行身份验证。在 Starrise AI 控制台创建 API Key 后,以 Bearer YOUR_API_KEY 格式传入 Authorization 请求头。

请求体

application/json
model
enum<string>
必填

模型 ID

可用选项:
deepseek-v4-flash
示例:

"deepseek-v4-flash"

messages
object[]
必填

对话消息列表。

Minimum array length: 1
示例:
thinking
object | null

启用或禁用思考模式。

max_tokens
integer

最大生成 Token 数。

必填范围: x >= 1
response_format
object

设为 {"type": "json_object"} 启用 JSON 模式。

stop

触发停止生成的序列,最多 16 个。

stream
boolean
默认值:false

为 true 时通过 SSE 流式返回结果。

stream_options
object

流式选项,仅当 stream 为 true 时有效。

temperature
number
默认值:1

采样温度,值越高输出越随机。

必填范围: 0 <= x <= 2
示例:

1

top_p
number
默认值:1

核采样阈值。

必填范围: 0 <= x <= 1
tools
object[]

模型可调用的工具列表,当前仅支持函数调用。

tool_choice

控制工具调用行为:noneautorequired 或指定函数。

可用选项:
none,
auto,
required
frequency_penalty
number
默认值:0

DeepSeek 已弃用,传入无效。

必填范围: -2 <= x <= 2
presence_penalty
number
默认值:0

DeepSeek 已弃用,传入无效。

必填范围: -2 <= x <= 2
user_id
string

自定义用户 ID,用于内容安全处理和 KVCache 缓存隔离。

Maximum string length: 512
Pattern: ^[a-zA-Z0-9\-_]+$

响应

成功生成响应

id
string
示例:

"chatcmpl-abc123"

object
string
示例:

"chat.completion"

created
integer

Unix 时间戳

model
string
示例:

"deepseek-v4-flash"

choices
object[]
usage
object
system_fingerprint
string | null

后端配置指纹。