Indicia Code.

Count tokens

Count the input tokens of a Messages request without running it.

Endpoint
POST https://code.test.indicia-ai.com/v1/messages/count_tokens

Counts the input tokens of a Messages request without running it. It takes the same body as /v1/messages, without max_tokens. It counts toward a service token's requests per minute, not its tokens per day.

Example request

Terminal
curl https://code.test.indicia-ai.com/v1/messages/count_tokens \
  -H "x-api-key: $INDICIA_TOKEN" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5-5",
    "messages": [{"role": "user", "content": "Say hello"}]
  }'

Response

Response
{"input_tokens": 12}

On this page