v1

latestOpenAPI 3.0.32026-07-2652923.8 KB
Anthropic Messages

Count input tokens

Returns an estimated input token count for a message payload without generating a response. Useful for budget checks before sending expensive prompts.

post/v1/messages/count_tokens

Request body

modelstring required

Model id (e.g. abliterated-model).

max_tokensinteger

Maximum number of tokens to generate.

temperaturenumber

Sampling temperature.

streamboolean

Enable Server-Sent Events streaming.

flagged_categoriesstring[]

Optional moderation categories to block. Supported: harassment, hate, illicit, sexual. Self-harm and sexual/minors are always blocked.

Response

Token count

input_tokensinteger required

Estimated number of input tokens.

All 5 operations