Chat completions
Generate responses from any model.
POST https://tokenroute.app/api/v1/chat/completions - fully compatible with the OpenAI Chat Completions API.
bash
curl https://tokenroute.app/api/v1/chat/completions \
-H "Authorization: Bearer $TOKENROUTE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4.6",
"messages": [{ "role": "user", "content": "Hello!" }]
}'Response
The response includes the assistant message and a usage object with token counts and the cost charged to your balance.
json
{
"id": "gen-...",
"model": "anthropic/claude-sonnet-4.6",
"choices": [{ "message": { "role": "assistant", "content": "Hi!" }, "finish_reason": "stop" }],
"usage": { "prompt_tokens": 9, "completion_tokens": 3, "total_tokens": 12, "cost": 0.00004 }
}