跳到主要内容
Unicomp AI
产品与能力
产品与能力模型中转 API智能算力智能体
创作
聊天对话与文本模型交流,完成问答与内容创作图片生成用图像模型生成与编辑图片视频生成用视频模型生成动态画面
模型广场学院API 文档帮助中心
进入控制台
Unicomp AI

让模型能力,走进每一次创造。

产品

创作工作台模型中转 API模型广场控制台智能算力智能体

使用与服务

余额与账单学院解决方案学院空间

开始使用

API 快速开始常见问题
© 2026 Unicomp AI
重庆云之骥 渝ICP备2026005193号-1
← 全部文档

文本对话 · API

doubao-seed-2-1-pro-260915

本平台 OpenAI 风格 JSON(重排为平台扩展)

调用示例字段与限制价格响应与结果

调用示例

正式 Base URL 为 https://www.unicompapi.com/v1;设置 UNICOMP_BASE_URL 与 UNICOMP_API_KEY 后替换素材与 Base64 占位内容。新请求使用 REQUEST_KEY,响应 X-Unicomp-Request-Id 保存为 REQUEST_ID;两者用于查询同一原单。

POST /v1/chat/completions

Shell / curl
# 仅用于新请求;未知结果时查询原单,不重新执行本段
# 需要 Python 3;保存打印的 REQUEST_KEY
REQUEST_KEY="$(python3 -c 'import uuid; print(uuid.uuid4())')"
[ -n "$REQUEST_KEY" ] || exit 1 # UUID生成失败时停止
printf 'REQUEST_KEY=%s\n' "$REQUEST_KEY"
curl "$UNICOMP_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $UNICOMP_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $REQUEST_KEY" \
  --data '{
  "model": "doubao-seed-2-1-pro-260915",
  "messages": [
    {
      "role": "user",
      "content": "你好,请用一句话介绍自己。"
    }
  ],
  "max_completion_tokens": 4096
}'

字段与限制

字段类型范围 / 默认值
modelstring精确使用 doubao-seed-2-1-pro-260915
messagesarrayrole/content消息数组;图片输入按本页示例
max_completion_tokensnumber正整数,当前最大 524288
  • Seed21:max_tokens为回答预算(1–262144),max_completion_tokens为完成总预算(1–524288,含思考),二选一并保留原请求值;思考最多262144 Token,未指定时采用max_completion_tokens=4096。声明上限不等于当前渠道边界已实测。
  • 支持stream:true时返回SSE,须收到完整finish及[DONE];usage是否输出按stream_options.include_usage设置,省略时遵循本型号默认。客户端不输出usage不影响平台按内部完整用量结算。中断或未知结果应核查原请求,不能自动重新POST。
  • 当前上下文 1048576 Token;输入与输出须符合本型号Token容量;请求大小限制见容量说明。响应最多32MiB,最长等待30分钟。连接中断时查询原请求,不重复提交。
  • 本型号默认回复预算 4096 Token;这是平台默认值,不是模型的最大输出能力。
  • Chat原生reasoning_effort:none、minimal、low、medium、high、xhigh、max;按原值发送,none/minimal与xhigh/max的行为映射不改写请求。service_tier:auto、default,省略跟随模型默认。
  • 原assistant.encrypted_content为不透明字符串;存在时完整原样回传,包括空串,同时保留原content的null或空字符串、reasoning_content及tool_calls。不得解密、拼接为正文、放入提示词或日志;工具结果用匹配tool_call_id显式续轮,每轮独立计费。

流式文字

选择已开放的纯文字组合,再添加stream:true,图片输入不使用此示例;SDK关闭自动重试,逐个消费SSE。以下为格式示意,不是实际调用结果。

JSON
{
  "model": "doubao-seed-2-1-pro-260915",
  "messages": [
    {
      "role": "user",
      "content": "你好,请用一句话介绍自己。"
    }
  ],
  "max_completion_tokens": 4096,
  "stream": true
}
SSE
data: {"choices":[{"index":0,"delta":{"content":"你好"},"finish_reason":null}]}

data: {"choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":{"prompt_tokens":8,"completion_tokens":2,"total_tokens":10}}

data: [DONE]

请求组合示例

示例随当前型号配置生成;请替换素材与历史消息占位内容。选择相应组合展开查看,不要混用不同组合参数。

Seed原生多图理解:URL / Base64
JSON
{
  "model": "doubao-seed-2-1-pro-260915",
  "max_completion_tokens": 512,
  "stream": false,
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "比较图片内容"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/replace-with-your-image.png",
            "detail": "xhigh"
          }
        }
      ]
    }
  ]
}
  • 将示例URL替换为本人可访问的真实图片地址;也可换为完整dataURI。
  • 图片数量受请求体与上下文约束;支持公开HTTP(S)、完整dataURI或同Key有效file_id,不填写私有证明字段。媒体可与已声明工具、思考及完整历史组合。
  • Files先用同一Bearer向POST /v1/files上传multipart file与purpose=user_data,引用原响应文件ID;所需供应商active状态须实际确认。未确认时保留原操作查询,不伪造file_id或重复上传。
Seed原生视频理解:嵌套fps
JSON
{
  "model": "doubao-seed-2-1-pro-260915",
  "max_completion_tokens": 512,
  "stream": false,
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "描述视频内容"
        },
        {
          "type": "video_url",
          "video_url": {
            "url": "https://example.com/replace-with-your-video.mp4",
            "fps": 0.2
          }
        }
      ]
    }
  ]
}
  • 将URL替换为真实视频地址或完整dataURI;fps位于video_url内,范围0.2–5,省略默认1,不传顶层fps。视频格式video/mp4、video/x-msvideo、video/quicktime。
  • 图片数量受请求体与上下文约束;支持公开HTTP(S)、完整dataURI或同Key有效file_id,不填写私有证明字段。媒体可与已声明工具、思考及完整历史组合。
  • Files先用同一Bearer向POST /v1/files上传multipart file与purpose=user_data,引用原响应文件ID;所需供应商active状态须实际确认。未确认时保留原操作查询,不伪造file_id或重复上传。
Seed Files图片引用:file_id
JSON
{
  "model": "doubao-seed-2-1-pro-260915",
  "max_completion_tokens": 512,
  "stream": false,
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "描述文件中的图片"
        },
        {
          "type": "image_url",
          "image_url": {
            "file_id": "<同Key上传返回的文件ID>",
            "detail": "high"
          }
        }
      ]
    }
  ]
}
  • file_id与url二选一;将占位内容替换为同Key原Files响应ID。图片和视频分别使用image_url.file_id、video_url.file_id。
  • 图片数量受请求体与上下文约束;支持公开HTTP(S)、完整dataURI或同Key有效file_id,不填写私有证明字段。媒体可与已声明工具、思考及完整历史组合。

当前价格

接口金额使用整数微元:1元 = 1,000,000微元。按报价和实际用量结算。

规格计价项人民币单价
基础档位百万输入 token¥13.2/百万输入 token
基础档位百万缓存输入 token¥2.64/百万缓存输入 token
基础档位百万输出 token¥66/百万输出 token

响应与结果

非流式响应choices[].message.content和usage;文字stream:true返回text/event-stream delta、finish与[DONE]。OCR只支持非流式。

保存Idempotency-Key和X-Unicomp-Request-Id。使用请求号查询状态与费用,客户端禁自动重试未知请求;401核Key,400核字段,402核余额,409核幂等或报价变化,503检查型号或服务状态。

查看模型详情及价格

  • Files先用同一Bearer向POST /v1/files上传multipart file与purpose=user_data,引用原响应文件ID;所需供应商active状态须实际确认。未确认时保留原操作查询,不伪造file_id或重复上传。
  • Seed图片完整历史续轮
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "max_completion_tokens": 512,
      "stream": true,
      "messages": [
        {
          "role": "user",
          "content": [
            {
              "type": "text",
              "text": "描述这张图片"
            },
            {
              "type": "image_url",
              "image_url": {
                "url": "https://example.com/replace-with-your-image.png"
              }
            }
          ]
        },
        {
          "role": "assistant",
          "content": "<原assistant正文>",
          "reasoning_content": "<仅原响应存在时原样保留,否则省略>",
          "encrypted_content": "<仅原响应存在时完整原样保留,否则省略>"
        },
        {
          "role": "user",
          "content": "请继续解释图片内容"
        }
      ]
    }
    • 使用原Key和原图片,所有assistant字段均替换为原响应;未返回的字段直接省略,不拼接密文、不伪造正文。流式usage按stream_options.include_usage设置输出。
    参数组合:thinking · 非流式 · 思考:关闭
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "stream": false
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    参数组合:tools + thinking · 非流式 · 思考:关闭 · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "tool_choice": "auto",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + thinking · 非流式 · 思考:关闭 · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "tool_choice": "auto",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + thinking · 非流式 · 思考:关闭 · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "tool_choice": "none",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + thinking · 非流式 · 思考:关闭 · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "tool_choice": "none",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + thinking · 非流式 · 思考:关闭 · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "tool_choice": "required",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + thinking · 非流式 · 思考:关闭 · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "tool_choice": "required",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:json_object + thinking · 非流式 · 思考:关闭 · 输出:json_object
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "stream": false
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    参数组合:tools + json_object + thinking · 非流式 · 思考:关闭 · 输出:json_object · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "auto",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_object + thinking · 非流式 · 思考:关闭 · 输出:json_object · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "auto",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + json_object + thinking · 非流式 · 思考:关闭 · 输出:json_object · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "none",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_object + thinking · 非流式 · 思考:关闭 · 输出:json_object · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "none",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + json_object + thinking · 非流式 · 思考:关闭 · 输出:json_object · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "required",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_object + thinking · 非流式 · 思考:关闭 · 输出:json_object · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "required",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:json_schema + thinking · 非流式 · 思考:关闭 · 输出:json_schema(strict=true)
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "stream": false
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    参数组合:tools + json_schema + thinking · 非流式 · 思考:关闭 · 输出:json_schema(strict=true) · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "auto",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_schema + thinking · 非流式 · 思考:关闭 · 输出:json_schema(strict=true) · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "auto",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + json_schema + thinking · 非流式 · 思考:关闭 · 输出:json_schema(strict=true) · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "none",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_schema + thinking · 非流式 · 思考:关闭 · 输出:json_schema(strict=true) · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "none",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + json_schema + thinking · 非流式 · 思考:关闭 · 输出:json_schema(strict=true) · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "required",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_schema + thinking · 非流式 · 思考:关闭 · 输出:json_schema(strict=true) · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "required",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:thinking · 非流式 · 思考:开启
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "stream": false
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    参数组合:tools + thinking · 非流式 · 思考:开启 · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "tool_choice": "auto",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + thinking · 非流式 · 思考:开启 · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "tool_choice": "auto",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + thinking · 非流式 · 思考:开启 · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "tool_choice": "none",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + thinking · 非流式 · 思考:开启 · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "tool_choice": "none",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + thinking · 非流式 · 思考:开启 · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "tool_choice": "required",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + thinking · 非流式 · 思考:开启 · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "tool_choice": "required",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:json_object + thinking · 非流式 · 思考:开启 · 输出:json_object
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "stream": false
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    参数组合:tools + json_object + thinking · 非流式 · 思考:开启 · 输出:json_object · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "auto",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_object + thinking · 非流式 · 思考:开启 · 输出:json_object · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "auto",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + json_object + thinking · 非流式 · 思考:开启 · 输出:json_object · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "none",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_object + thinking · 非流式 · 思考:开启 · 输出:json_object · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "none",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + json_object + thinking · 非流式 · 思考:开启 · 输出:json_object · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "required",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_object + thinking · 非流式 · 思考:开启 · 输出:json_object · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "required",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:json_schema + thinking · 非流式 · 思考:开启 · 输出:json_schema(strict=true)
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "stream": false
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    参数组合:tools + json_schema + thinking · 非流式 · 思考:开启 · 输出:json_schema(strict=true) · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "auto",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_schema + thinking · 非流式 · 思考:开启 · 输出:json_schema(strict=true) · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "auto",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + json_schema + thinking · 非流式 · 思考:开启 · 输出:json_schema(strict=true) · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "none",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_schema + thinking · 非流式 · 思考:开启 · 输出:json_schema(strict=true) · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "none",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + json_schema + thinking · 非流式 · 思考:开启 · 输出:json_schema(strict=true) · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "required",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_schema + thinking · 非流式 · 思考:开启 · 输出:json_schema(strict=true) · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "required",
      "stream": false,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:thinking · 流式 · 思考:关闭
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "stream": true
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    参数组合:tools + thinking · 流式 · 思考:关闭 · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "tool_choice": "auto",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + thinking · 流式 · 思考:关闭 · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "tool_choice": "auto",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + thinking · 流式 · 思考:关闭 · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "tool_choice": "none",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + thinking · 流式 · 思考:关闭 · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "tool_choice": "none",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + thinking · 流式 · 思考:关闭 · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "tool_choice": "required",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + thinking · 流式 · 思考:关闭 · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "tool_choice": "required",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:json_object + thinking · 流式 · 思考:关闭 · 输出:json_object
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "stream": true
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    参数组合:tools + json_object + thinking · 流式 · 思考:关闭 · 输出:json_object · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "auto",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_object + thinking · 流式 · 思考:关闭 · 输出:json_object · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "auto",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + json_object + thinking · 流式 · 思考:关闭 · 输出:json_object · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "none",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_object + thinking · 流式 · 思考:关闭 · 输出:json_object · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "none",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + json_object + thinking · 流式 · 思考:关闭 · 输出:json_object · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "required",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_object + thinking · 流式 · 思考:关闭 · 输出:json_object · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "required",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:json_schema + thinking · 流式 · 思考:关闭 · 输出:json_schema(strict=true)
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "stream": true
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    参数组合:tools + json_schema + thinking · 流式 · 思考:关闭 · 输出:json_schema(strict=true) · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "auto",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_schema + thinking · 流式 · 思考:关闭 · 输出:json_schema(strict=true) · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "auto",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + json_schema + thinking · 流式 · 思考:关闭 · 输出:json_schema(strict=true) · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "none",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_schema + thinking · 流式 · 思考:关闭 · 输出:json_schema(strict=true) · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "none",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + json_schema + thinking · 流式 · 思考:关闭 · 输出:json_schema(strict=true) · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "required",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_schema + thinking · 流式 · 思考:关闭 · 输出:json_schema(strict=true) · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "disabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "required",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:thinking · 流式 · 思考:开启
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "stream": true
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    参数组合:tools + thinking · 流式 · 思考:开启 · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "tool_choice": "auto",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + thinking · 流式 · 思考:开启 · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "tool_choice": "auto",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + thinking · 流式 · 思考:开启 · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "tool_choice": "none",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + thinking · 流式 · 思考:开启 · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "tool_choice": "none",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + thinking · 流式 · 思考:开启 · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "tool_choice": "required",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + thinking · 流式 · 思考:开启 · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "你好,请用一句话介绍自己。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "tool_choice": "required",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:json_object + thinking · 流式 · 思考:开启 · 输出:json_object
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "stream": true
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    参数组合:tools + json_object + thinking · 流式 · 思考:开启 · 输出:json_object · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "auto",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_object + thinking · 流式 · 思考:开启 · 输出:json_object · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "auto",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + json_object + thinking · 流式 · 思考:开启 · 输出:json_object · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "none",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_object + thinking · 流式 · 思考:开启 · 输出:json_object · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "none",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + json_object + thinking · 流式 · 思考:开启 · 输出:json_object · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "required",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_object + thinking · 流式 · 思考:开启 · 输出:json_object · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "required",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:json_schema + thinking · 流式 · 思考:开启 · 输出:json_schema(strict=true)
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "stream": true
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    参数组合:tools + json_schema + thinking · 流式 · 思考:开启 · 输出:json_schema(strict=true) · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "auto",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_schema + thinking · 流式 · 思考:开启 · 输出:json_schema(strict=true) · 工具选择:自动
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "auto",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + json_schema + thinking · 流式 · 思考:开启 · 输出:json_schema(strict=true) · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "none",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_schema + thinking · 流式 · 思考:开启 · 输出:json_schema(strict=true) · 工具选择:禁用
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "none",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。
    参数组合:tools + json_schema + thinking · 流式 · 思考:开启 · 输出:json_schema(strict=true) · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "required",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 使用示例中的参数组合。JSON Schema按本页支持的关键词填写;客户端校验JSON正文,reasoning_content单独读取。
    工具结果显式续轮 · tools + json_schema + thinking · 流式 · 思考:开启 · 输出:json_schema(strict=true) · 工具选择:必须
    JSON
    {
      "model": "doubao-seed-2-1-pro-260915",
      "messages": [
        {
          "role": "user",
          "content": "用JSON格式回答,answer为一句中文介绍。"
        },
        {
          "role": "assistant",
          "content": null,
          "encrypted_content": "<原assistant.encrypted_content;不存在则省略,不得自行生成>",
          "tool_calls": [
            {
              "id": "<原tool_call_id>",
              "type": "function",
              "function": {
                "name": "get_demo_value",
                "arguments": "{\"city\":\"北京\"}"
              }
            }
          ],
          "reasoning_content": "<原响应存在时原样保留,否则省略>"
        },
        {
          "role": "tool",
          "tool_call_id": "<原tool_call_id>",
          "content": "{\"value\":1}"
        }
      ],
      "max_completion_tokens": 4096,
      "thinking": {
        "type": "enabled"
      },
      "response_format": {
        "type": "json_schema",
        "json_schema": {
          "strict": true,
          "name": "demo",
          "schema": {
            "type": "object",
            "properties": {
              "answer": {
                "type": "string"
              }
            },
            "required": [
              "answer"
            ],
            "additionalProperties": false
          }
        }
      },
      "tool_choice": "required",
      "stream": true,
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_demo_value",
            "description": "由客户端读取演示值",
            "parameters": {
              "type": "object",
              "properties": {
                "city": {
                  "type": "string"
                }
              },
              "required": [
                "city"
              ]
            }
          }
        }
      ]
    }
    • 将示例占位内容替换为原响应。用实际原assistant/tool_calls替换;客户端验证参数后执行工具,再返回同tool_call_id;每轮新请求独立计费,不自动循环。