Anthropic-compatible API
rout.my exposes an Anthropic Messages-compatible endpoint for clients that send Anthropic request shapes.
text
POST https://api.rout.my/v1/messages
POST https://api.rout.my/v1/messages/count_tokens
POST https://api.rout.my/anthropic/v1/messages
POST https://api.rout.my/anthropic/v1/messages/count_tokensClient base URL
If a client asks for a base URL and appends /v1/messages itself, configure:
text
https://api.rout.myUse the full endpoint URL only in manual curl requests. Do not set Anthropic SDK or Claude Code base URL to https://api.rout.my/v1, or the client may call /v1/v1/messages.
Authentication
Bearer auth works:
http
Authorization: Bearer sk_your_key_hereAnthropic-style headers are also accepted by the route:
http
x-api-key: sk_your_key_here
anthropic-version: 2023-06-01Request
bash
curl https://api.rout.my/v1/messages \
-H "x-api-key: $ROUTMY_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4.6",
"max_tokens": 256,
"messages": [
{ "role": "user", "content": "Write one short sentence." }
]
}'Notes
| Topic | Behavior |
|---|---|
model | Use an exact model ID available to your account. |
messages | Anthropic-style messages are converted internally. |
| Images | Image blocks are converted when the selected model supports vision input. |
| Streaming | Anthropic-style streaming is supported when requested by the client. |
| Token counting | POST /v1/messages/count_tokens returns { "input_tokens": n } using the same local estimator as request accounting. |
| Tool use | Client tools are translated where compatible; native Anthropic-only tool fields are preserved for native Anthropic providers. |
| Native params | container, service_tier, metadata, thinking, mcp_servers, context_management, output_config, cache_control, and inference_geo are accepted and preserved where supported. |
| Beta headers | anthropic-beta and anthropic-version headers are forwarded to native Anthropic providers. |
Use this route when a client specifically expects Anthropic Messages. For OpenAI-compatible SDKs, prefer /v1/chat/completions.