Skip to content

Evanesca opens soon: this page shows how the chat will work.

Count message tokens

POST/messages/count_tokens

Estimates how many input tokens a Messages request would use, without running it: free, even at zero credit, and no operator is called. It is an estimate — one token for every 4 characters of the system prompt, the messages and the tool schemas — because each model has its own tokenizer; what a real call costs is the usage its operator reports.

Catalogue checked on 20 Oct 2026

SoonOpening soon: what follows describes the service as it will work.

Server URLhttps://evanesca.app/api/v1
POST/messages/count_tokensOpens at launch
AuthorizationBearer $EVANESCA_API_KEY
  • x-api-keystringrequired

    Your key, which starts with sk-eva-. Authorization: Bearer followed by the key works too: that is where Claude Code sends it when ANTHROPIC_AUTH_TOKEN is set.

  • anthropic-versionstring

    Sent by Anthropic's SDKs; accepted, and has no effect here.

  • Content-Typestringrequired

    application/json: the body is JSON.

Request body

application/json
  • modelstringrequired

    Required by the format; the estimate does not depend on it.

  • messagesarrayrequired

    The turns, as for POST /messages.

  • system, toolsstring | array · array

    Counted as well when you send them.

Where it runs, what it costs

Evanesca · on the record

Answered by
Evanesca itself: no model runs, no operator is called.
Costs
Nothing: a valid key is enough, even with no credit left.
Precision
An estimate at 4 characters per token, never a billed amount. Long inline data, such as a base64 image, is left out of the count.

Errors

StatustypeMeaning
400invalid_requestThe body is not valid JSON, or model or messages is missing.
401invalid_api_keyNo key, a malformed key, or a revoked one.

Other operator errors reach you with its status and body, and Retry-After when it sends one (errors).

curl https://evanesca.app/api/v1/messages/count_tokens \
  -H "x-api-key: $EVANESCA_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemma-4-26b",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
{
  "input_tokens": 10
}