estimateTokens method
- String text
Estimates the number of tokens in the given text.
This is an approximation — different providers tokenize differently.
Default implementation uses a rough ~kApproxCharsPerToken chars per token estimate.
Implementation
@override
int estimateTokens(String text) {
// GPT models average ~4 characters per token
return (text.length / 4).ceil();
}