Anthropic
Estimate input tokens for an Anthropic Messages request
Heuristic input-token estimator. Accepts the same shape as /v1/messages minus max_tokens (optional here per the Anthropic spec). Returns {"input_tokens": N}.
v1 is a heuristic (4 chars/token + per-message overhead + per-image fixed cost), not a real BPE tokenizer call. Targets ±10 % accuracy across representative shapes. Sufficient for Claude Code's advisory context-window display.
Auth identical to /v1/messages: Authorization: Bearer tp_<64 hex>, validated by the unified middleware before dispatch.
post/v1/messages/count_tokens
Request
- Base URL: http://localhost:9998
- URL: http://localhost:9998/v1/messages/count_tokens
- Auth: HTTP bearer
Request body
Response
Estimated input token count
Changes
No recorded changes to this operation across all 1 revision of this API.