Introduction

文本

Claude Fable 5Claude Fable 5.1Claude Fable 5.2Claude Haiku 4.5Claude Haiku 5.5Claude Opus 4.6Claude Opus 4.7Claude Opus 4.8Claude Opus 5Claude Opus 5.5Claude Sonnet 4.6Claude Sonnet 5Claude Sonnet 5.5

图片

视频

mysitemysite
开始使用API 参考
Claude

Claude Fable 5 · Messages

文本 / Claude / Claude Fable 5 / Messages

POST/v1/messages

请求参数

Authorization

在 Header 添加参数 Authorization,其值为 Bearer 之后拼接你的 API Key。

Authorization: Bearer ****************
anthropic-version: 2023-06-01
Header 参数
Content-Typestring可选
application/json
Acceptstring可选
application/json
Body 参数application/json必填
modelstring必需
模型 ID,固定为 `claude-fable-5`
messagesarray[object]必需
对话消息列表;每条含 `role`(user / assistant)与 `content`(文本或内容块)
max_tokensinteger必需
最大生成 token 数;Anthropic API 必填
systemstring | array[object]可选
系统提示词,作为顶层字段传入(不放进 messages)
streamboolean可选
是否流式返回(SSE),默认 `false`
stop_sequencesarray[string]可选
自定义停止序列,命中即停止生成
toolsarray[object]可选
工具定义,用于工具调用
tool_choiceobject可选
控制是否及使用哪个工具
metadataobject可选
请求元信息,如 `user_id`
thinkingobject可选
该模型始终启用自适应思考;可省略此字段,不能禁用或设置 `budget_tokens`
output_configobject可选
输出配置;可用子字段取决于模型
示例
{  "model": "claude-fable-5",  "max_tokens": 1024,  "messages": [    {      "role": "user",      "content": "你好,介绍一下你自己"    }  ]}

请求示例代码

curl https://api.hotrouter.ai/v1/messages \  -H "Authorization: Bearer $API_KEY" \  -H "Content-Type: application/json" \  -H "anthropic-version: 2023-06-01" \  -d '{    "model": "claude-fable-5",    "max_tokens": 1024,    "messages": [      {        "role": "user",        "content": "你好,介绍一下你自己"      }    ]  }'

返回响应

200 · 成功
idstring必需
本次响应的唯一 id
typestring必需
对象类型(message)
rolestring必需
消息角色
contentarray[object]必需
内容块数组
stop_reasonstring可选
结束原因(end_turn / max_tokens 等)
usageobject必需
本次调用的 token 用量
示例
{  "id": "msg_xxx",  "type": "message",  "role": "assistant",  "content": [    {      "type": "text",      "text": "你好!很高兴见到你……"    }  ],  "stop_reason": "end_turn",  "usage": {    "input_tokens": 12,    "output_tokens": 24  }}

Introduction

Previous Page

Claude Fable 5.1

Next Page

On this page

请求参数请求示例代码返回响应
{
  "model": "claude-fable-5",
  "max_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "content": "你好,介绍一下你自己"
    }
  ]
}
curl https://api.hotrouter.ai/v1/messages \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "claude-fable-5",
    "max_tokens": 1024,
    "messages": [
      {
        "role": "user",
        "content": "你好,介绍一下你自己"
      }
    ]
  }'
{
  "id": "msg_xxx",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "你好!很高兴见到你……"
    }
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 12,
    "output_tokens": 24
  }
}