Claude Fable 5.2(claude-fable-5-2)面向高难度推理和长周期智能体任务,能处理跨多个代码仓库、持续数天的工程工作。图文(含 PDF)输入,100 万上下文,12.8 万输出,思考不能关闭,提供 Anthropic 兼容消息接口。
鉴权
- Base URL
https://api.dreamto.ai- Authorization
Authorization: Bearer YOUR_API_KEY- Content-Type
application/json- 模型名 (model)
claude-fable-5-2
接入协议
为什么选这个协议
适合原本使用 Claude SDK 或 Anthropic Messages API 的用户直接迁移。
接口地址
POST/v1/messages
Authorization: Bearer YOUR_API_KEYContent-Type: application/jsonanthropic-version: 2023-06-01请求 / 响应 JSON
请求
{
"model": "claude-fable-5-2",
"tools": [],
"stream": false,
"system": "请用简洁中文回答。",
"messages": [
{
"role": "user",
"content": [
{
"text": "你好,世界",
"type": "text"
}
]
}
],
"thinking": {
"type": "enabled",
"budget_tokens": 1024
},
"max_tokens": 4096
}响应
{
"id": "msg_example",
"role": "assistant",
"type": "message",
"model": "claude-fable-5-2",
"usage": {
"input_tokens": 8,
"output_tokens": 16
},
"content": [
{
"text": "Hello from Mix API",
"type": "text"
}
],
"stop_reason": "end_turn"
}请求字段 / 响应字段
请求字段
| 字段 | 类型 | 必填 | 默认 | 可选值 / 范围 | 说明 | 示例 |
|---|---|---|---|---|---|---|
| messages | array | Y | - | - | Anthropic/OpenAI 兼容消息数组。 | [{"role":"user","content":"你好,世界"}] |
| system_instruction | string | N | - | - | Claude system 提示词。 | 请用简洁中文回答。 |
| max_tokens | integer | N | 4096 | - | Claude 必填或建议显式设置的最大输出长度。 | 4096 |
| temperature | number | N | - | - | 控制输出随机性;不设置默认值,避免用户未传时自动带到上游。 | 0.7 |
| top_p | number | N | - | - | 核采样概率阈值。 | 0.95 |
| top_k | integer | N | - | - | 限制候选 token 数。 | 40 |
| thinking | object | N | - | - | Claude 扩展思考配置。 | {"type":"enabled","budget_tokens":1024} |
| tools | array | N | - | - | Claude tools 定义。 | [] |
| tool_choice | string | N | - | - | auto、any 或指定工具。 | auto |
| stream | boolean | N | false | - | 是否使用流式响应。 | false |
响应字段
| 字段 | 类型 | 必填 | 默认 | 可选值 / 范围 | 说明 | 示例 |
|---|---|---|---|---|---|---|
| id | string | N | - | - | - | msg_example |
| type | string | N | - | - | - | message |
| role | string | N | - | - | - | assistant |
| model | string | N | - | - | - | claude-fable-5-2 |
| content | array | N | - | - | - | [{"text":"Hello from Mix API","type":"text"}] |
| content[] | object | N | - | - | - | {"text":"Hello from Mix API","type":"text"} |
| content[].type | string | N | - | - | - | text |
| content[].text | string | N | - | - | - | Hello from Mix API |
| stop_reason | string | N | - | - | - | end_turn |
| usage | object | N | - | - | - | {"input_tokens":8,"output_tokens":16} |
| usage.input_tokens | integer | N | - | - | - | 8 |
| usage.output_tokens | integer | N | - | - | - | 16 |
代码示例
cURLrequest.sh
curl -X POST "https://api.dreamto.ai/v1/messages" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-fable-5-2",
"max_tokens": 4096,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "你好,世界"
}
]
}
],
"system": "请用简洁中文回答。",
"stream": false,
"thinking": {
"budget_tokens": 1024,
"type": "enabled"
},
"tools": []
}'