Proxy Count Tokens
Proxy Anthropic’s token-counting endpoint.
A compatibility gap rather than a security surface: an Anthropic SDK pointed
at PromptGuard breaks on client.messages.count_tokens() because we did not
serve the route. It counts tokens and returns a number — nothing reaches a
model and nothing is generated, so there is no completion to scan.
The request still goes through the same handler as the rest, which means the
prompt IS scanned on the way in. That is deliberate: the body is a full
messages array, so it is a place a caller could otherwise probe or stage
content with no policy applied.
Note this is NOT what enforces max_tokens_per_request. That runs inline on
every request and must not make a network call to do it — see
shared/security/token_limiter.py.