Token Counting
Count Claude tokens before sending with /v1/messages/count_tokens.
Arcflow exposes POST /v1/messages/count_tokens, which forwards to Anthropic
with the token-counting beta header. Use it to estimate context size before you
send a request. Claude models only.
The body is a Messages request without max_tokens:
curl https://api.tryarcflow.com/v1/messages/count_tokens \
-H "Authorization: Bearer sk-..." \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"messages": [{ "role": "user", "content": "How many tokens is this?" }]
}'The response reports the input token count:
{ "input_tokens": 14 }Use this to estimate context before sending a full Messages request, for example to stay within a model's context window or to predict usage.