estimateTokenCount method
Estimate token count for a list of messages.
Applies a conservative 4/3 padding factor to the raw estimate.
Implementation
int estimateTokenCount(List<Message> messages) {
int total = 0;
for (final msg in messages) {
for (final block in msg.content) {
total += _estimateBlockTokens(block);
}
}
return (total * 4 / 3).ceil();
}