用 Anthropic 原生協議呼叫 Qwen3.7-Plus。
POST /v1/messages
model | string | required | 要呼叫的模型名, 填模型廣場裡的名稱。 |
messages | array | required | 對話訊息陣列, 每項含 role 與 content。role 只能是 user / assistant, 系統提示詞走獨立的 system 欄位而不是放進這裡。 |
role | string | required | |
content | string | required | 字串, 或多模態陣列 |
max_tokens | integer | required | 本次回覆最多生成多少 token。這個協議下是必填項。 |
system | string | 系統提示詞。可傳字串, 也可傳陣列以便對不同片段單獨設定。 | |
stream | boolean | 是否流式返回。true 時以 SSE 逐塊推送。 | |
temperature | number | 取樣溫度, 越大輸出越發散、越小越穩定。 | |
tools | array | 可供模型呼叫的工具列表。模型需要時會返回 tool_use 內容塊, 由你執行後以 tool_result 回填。 | |
tool_choice | object | 控制是否/如何選用工具: 由模型決定、強制使用、或指定某個具體工具。需與 tools 一起使用。 | |
stop_sequences | array | 遇到其中任一字串就停止生成。 | |
top_p | number | 核取樣, 只在累計機率前 top_p 的候選裡挑。與 temperature 選一個調即可。 | |
top_k | integer | 只在機率最高的 k 個候選裡挑。 | |
thinking | object | 擴充套件思考設定, 讓模型在回答前先推理。開啟後思考過程會作為獨立內容塊返回, 並計入輸出用量。僅支援該能力的模型有效。 | |
metadata | object | 自定義元資訊, 便於你自己歸類檢索。 |
200 — 返回 Claude Messages 原生結構curl https://api.router.ai/v1/messages \
-H "Authorization: Bearer sk-你的令牌" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.7-plus",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "你好"}]
}'