Skip to content

对话补全 · 高级参数

本文档供调参、联调、对字段使用。端点速览与可复制示例见 创建对话补全


请求体字段

字段类型必填说明
modelstring模型 ID,见 模型广场
messagesarray见下节 messages[]
streamboolean默认 false
stream_optionsobjectinclude_usagechunk_include_usage(仅 stream=true
temperaturenumber常用 0~2
top_pnumber常用 0~1
max_tokensintegermax_completion_tokens 互斥
max_completion_tokensinteger1~65536
thinking_enabledboolean深度思考;按模型能力
reasoning_effortstringnone / minimal / low / medium / high
stopstring | string[]停止词,最多 4 个
response_formatobject | stringtext / json_object / json_schema
frequency_penaltynumber按模型能力
presence_penaltynumber按模型能力
logprobsboolean按模型能力
top_logprobsintegerlogprobs=true
toolsarraytype: function + function.name
parallel_tool_callsboolean默认 true
tool_choicestring | objectnone / auto / required 或指定 function
modalitiesarray生文建议省略或 ["text"]

messages[]

字段类型必填说明
rolestringsystem / user / assistant / tool
contentstring | arraystring 或 Part 数组
tool_callsarrayrole=assistant
tool_call_idstringrole=tool 时必传

Part(content 为数组)

type说明
text{ "type": "text", "text": "..." }
image_urlURL 或 data:image/...;base64,...;详见 图片输入
input_audioinput_audio.data(Base64)+ formatmp3 / wav
filefile_url(≤70MB,可传视频);可选 file_name;详见 视频输入

INFO

Part 用于生文看图/听音/读文件。生图参考图用 image_config.reference_images,见 图像生成 · 高级参数


追踪与结算请求头

请求头说明
X-Request-Id追踪 ID;最长 128 字符
X-Idempotency-Key结算幂等;重试同一笔业务须不变
X-Conversation-Id会话分组

TIP

不传 X-Idempotency-Key 时每次 HTTP 调用独立计费。网络超时重放应固定结算键


思考模式(按模型)

模型示例约束摘要
gpt-5.1 / gpt-5.2 / gpt-4o不支持 thinking_enabled / reasoning_effort
gemini-3-pro-preview不允许 thinking_enabled=falsereasoning_effortlow / medium / high
gemini-3-flash-preview默认开启思考;reasoning_effortminimal

模型广场 与实际上线能力为准。


完整 JSON 示例

json
{
  "model": "doubao-seed-1-6-thinking-agent-preview",
  "messages": [
    { "role": "system", "content": "你是一个专业助手。" },
    { "role": "user", "content": "你好" }
  ],
  "stream": false,
  "temperature": 0.7,
  "max_tokens": 1024,
  "thinking_enabled": true,
  "reasoning_effort": "medium",
  "tools": [],
  "tool_choice": "auto"
}

相关

© Trinity AI