Messages(Anthropic 兼容)
Anthropic Messages 兼容端点。/anthropic/v1/messages 是等价别名。
认证可用 Authorization: Bearer,也可用 Anthropic SDK 发的 x-api-key。两个头都发但值不同返回 400 AMBIGUOUS_API_KEY;同值重复不算歧义(CC Switch 等工具会同时发两个头)。
错误信封走 Anthropic 形状,与其余端点不同 —— 见 401 示例。
Authorization
bearerAuth Authorization: Bearer <your RouteMux API key>.
Create keys at https://routemux.com/console/keys. New keys use the sk- prefix;
the legacy rmx_live_ prefix is still accepted.
The Anthropic SDK's x-api-key and the Google SDK's x-goog-api-key are accepted too.
Sending several key headers with different values returns 400 AMBIGUOUS_API_KEY.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Request and response bodies match the upstream provider's official format verbatim —
RouteMux passes them through untouched. See the provider's own docs for field definitions;
the gateway itself only reads model and stream.
Response Body
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/messages" \ -H "Content-Type: application/json" \ -d '{ "model": "anthropic/claude-sonnet-5", "max_tokens": 256, "messages": [ { "role": "user", "content": "Hello" } ] }'{ "model": "string", "stream": true}