Expand description
Token counting with cascading fallback.
Attempts token counting in order:
- API
count_tokens(Anthropic-compatible endpoints) - tiktoken (OpenAI/GPT models)
- Character estimate (4 chars ≈ 1 token)
Structs§
- Token
Counter - Token counter with cascading fallback.
Functions§
- create_
token_ counter - Create a
TokenCounterfrom config values.