对话能力
结构化输出
用 response_format 让模型返回合法的 JSON。
需要程序直接解析模型输出时,用 response_format 约束返回格式。
JSON Schema 模式
按你给的 Schema 返回,字段和类型都会被约束:
res = client.chat.completions.create(
model="doubao-seed-2.1-pro",
messages=[{"role": "user", "content": "从这句话里提取姓名和城市:张伟下周去杭州出差。"}],
response_format={
"type": "json_schema",
"json_schema": {
"name": "person",
"schema": {
"type": "object",
"properties": {"name": {"type": "string"}, "city": {"type": "string"}},
"required": ["name", "city"],
},
},
},
)JSON Object 模式
只保证返回合法 JSON,不约束字段。部分模型(例如千问 Omni 系列)只支持这一模式:
response_format={"type": "json_object"}使用 JSON Object 模式时,请在提示词里写明期望的字段。
注意
- 输出被
max_tokens截断时,JSON 可能不完整,请检查finish_reason是否为stop。 - 支持情况以模型详情页的“结构化输出”一项为准。
| 模型 ID | 类型 | 输入 / 1M | 输出 / 1M | 上下文 | 线路 |
|---|---|---|---|---|---|
| doubao-seed-2.1-pro | 多模态 | ¥6.00 | ¥30.00 | 1M | 火山方舟 |
| doubao-seed-2.1-lite | 全模态 | ¥0.80 | ¥2.70 | 1M | 火山方舟 |
| doubao-seed-2.1-turbo | 多模态 | ¥3.00 | ¥15.00 | 256K | 火山方舟 |
| doubao-seed-evolving | 多模态 | ¥6.00 | ¥30.00 | 1M | 火山方舟 |
| doubao-seed-2.0-lite | 全模态 | ¥0.60 起 | ¥3.60 起 | 256K | 火山方舟 |
| doubao-seed-2.0-mini | 全模态 | ¥0.20 起 | ¥2.00 起 | 256K | 火山方舟 |
| doubao-seed-character | 多模态 | ¥0.80 起 | ¥2.00 起 | 128K | 火山方舟 |
| qwen3.8-max | 多模态 | ¥12.00 | ¥36.00 | 1M | 阿里云百炼 |
| qwen3.7-plus | 多模态 | ¥2.00 起 | ¥8.00 起 | 1M | 阿里云百炼 |
| qwen3.8-flash | 多模态 | ¥0.80 | ¥2.70 | 1M | 阿里云百炼 |
| qwen3.7-flash | 多模态 | ¥0.20 起 | ¥0.80 起 | 1M | 阿里云百炼 |
| qwen3.8-omni-flash | 全模态 | ¥0.80 | ¥2.70 | 1M | 阿里云百炼 |
| qwen3.5-omni-plus | 全模态 | ¥7.00 | ¥40.00 | 256K | 阿里云百炼 |
| qwen3-coder-flash | 文本对话 | ¥1.00 起 | ¥4.00 起 | 1M | 阿里云百炼 |
| deepseek-v4.1-flash | 多模态 | ¥1.00 起 | ¥4.00 起 | 1M | 火山方舟 · 阿里云百炼 |
| deepseek-v4-pro | 文本对话 | ¥4.50 起 | ¥13.50 起 | 1M | 火山方舟 · 阿里云百炼 |
| deepseek-v4-flash | 文本对话 | ¥1.50 起 | ¥4.50 起 | 1M | 火山方舟 · 阿里云百炼 |
| glm-5.2 | 文本对话 | ¥8.00 起 | ¥28.00 起 | 1M | 火山方舟 · 阿里云百炼 |
| kimi-k3 | 多模态 | ¥20.00 | ¥100.00 | — | 阿里云百炼 |
| mimo-v2.5-pro | 文本对话 | ¥7.00 起 | ¥21.00 起 | 1M | 阿里云百炼 |