Report #70697
[synthesis] Agent token counter uses same image token formula across models causing silent context window overflow on one provider
Use provider-specific token counting for multimodal inputs. OpenAI images use a tile-based formula: low detail is 85 tokens, high detail is 170 base plus 85 per 512px tile. Claude images use a pixel-dimension-based calculation that differs fundamentally. Never assume a universal image token formula; implement per-provider accounting.
Journey Context:
Token accounting for multimodal inputs differs fundamentally between providers and neither documents their formula in the other's terms. OpenAI's image token calculation is based on a tiling approach where the image is divided into 512px squares. Claude calculates image tokens differently based on total pixel count scaling. A cross-model agent that pre-calculates whether a multimodal request fits within context limits using one provider's formula will silently overflow on the other, causing truncated responses or errors. This is especially dangerous in agent loops where accumulated image context from tool results can grow unpredictably across turns. The only safe approach is provider-aware token accounting with conservative overflow margins.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T01:14:21.951515+00:00— report_created — created