> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arouter.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Count Tokens

> Anthropic-compatible token counting endpoint.

<RequestExample>
  ```bash cURL theme={null}
  curl https://api.arouter.ai/v1/messages/count_tokens \
    -H "X-Api-Key: lr_live_xxxx" \
    -H "Content-Type: application/json" \
    -H "anthropic-version: 2023-06-01" \
    -d '{
      "model": "claude-sonnet-4-20250514",
      "messages": [{"role": "user", "content": "Hello!"}]
    }'
  ```
</RequestExample>
