Problem
TextInputMeta.tokenCount and GenerationOutputMeta.tokensOut are emitted as plain integers in inference events regardless of whether they came from a real tokenizer or from a heuristic approximation (wordCount / 0.75 for input, charCount / 4 for output).
For non-English text, code-heavy prompts, or models with non-GPT tokenizers (Gemma, LLaMA, Phi), the approximation error is frequently 2–3x. The backend and dashboard have no way to tell which numbers to trust.
Proposed fix
Add a companion boolean field to both TextInputMeta and GenerationOutputMeta:
tokenCountEstimated: Boolean — true when the approximation heuristic was used, false when a real tokenizer was provided by the caller
Wire format addition (backwards-compatible — field absent on old clients):
"token_count": 42,
"token_count_estimated": true
This lets the backend suppress or annotate estimated values in analytics, and lets the dashboard surface a nudge to provide a real tokenizer.
No breaking changes required
The field is additive. Old clients omitting it can be treated as estimated by the backend.
Problem
TextInputMeta.tokenCountandGenerationOutputMeta.tokensOutare emitted as plain integers in inference events regardless of whether they came from a real tokenizer or from a heuristic approximation (wordCount / 0.75for input,charCount / 4for output).For non-English text, code-heavy prompts, or models with non-GPT tokenizers (Gemma, LLaMA, Phi), the approximation error is frequently 2–3x. The backend and dashboard have no way to tell which numbers to trust.
Proposed fix
Add a companion boolean field to both
TextInputMetaandGenerationOutputMeta:tokenCountEstimated: Boolean—truewhen the approximation heuristic was used,falsewhen a real tokenizer was provided by the callerWire format addition (backwards-compatible — field absent on old clients):
This lets the backend suppress or annotate estimated values in analytics, and lets the dashboard surface a nudge to provide a real tokenizer.
No breaking changes required
The field is additive. Old clients omitting it can be treated as estimated by the backend.