跳转到主要内容
如果你的客户端已经使用 Anthropic Messages 格式,可以调用 /v1/messages
curl https://api.apiany.ai/v1/messages \
  -H "Authorization: Bearer $APIANY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax-m3",
    "max_tokens": 512,
    "messages": [
      { "role": "user", "content": "帮我写三个 API 文档章节标题。" }
    ]
  }'
APIAny.AI 会处理请求,并返回 Anthropic 兼容的响应。

工具调用

tools(每个含 namedescriptioninput_schema)声明工具,用 tool_choice 控制选择;支持多轮 tool_use / tool_result 内容块。
{
  "model": "minimax-m3",
  "max_tokens": 512,
  "tools": [
    {
      "name": "get_weather",
      "description": "获取当前天气",
      "input_schema": {
        "type": "object",
        "properties": { "location": { "type": "string" } },
        "required": ["location"]
      }
    }
  ],
  "tool_choice": { "type": "auto" },
  "messages": [{ "role": "user", "content": "纽约天气如何?" }]
}

流式

设置 stream: true 按 Anthropic SSE 事件流返回: message_startcontent_block_startcontent_block_deltacontent_block_stopmessage_deltamessage_stop

参数

支持:modelmessagesmax_tokens(必填)、systemtemperaturetop_ptop_kstop_sequencestoolstool_choicestream