PulseAugur
EN
LIVE 12:47:10

LLM providers differ on token usage reporting, complicating cost tracking

A developer has detailed the complexities of tracking token usage across major LLM providers like OpenAI, Anthropic, and Gemini. The primary challenge lies in how each provider reports usage data, especially with streaming responses. OpenAI includes usage in a final chunk only if specifically requested, while Anthropic splits input and output token counts across different event types. Furthermore, the handling of cached tokens differs significantly between OpenAI and Anthropic, requiring careful normalization to ensure accurate cost calculations. AI

IMPACT Highlights the need for robust observability tools as LLM API usage and costs become more complex.

RANK_REASON Developer details complexities of a tool for tracking LLM token usage.

Read on dev.to — LLM tag →

AI-generated summary · Google Gemini · from 1 sources. How we write summaries →

LLM providers differ on token usage reporting, complicating cost tracking

COVERAGE [1]

  1. dev.to — LLM tag TIER_1 English(EN) · SPANLENS ·

    Tracking token usage across OpenAI, Anthropic, and Gemini: every streaming gotcha I hit

    <p>OpenAI, Anthropic, and Gemini each report token usage differently, and it stops being trivia the moment you track LLM cost. I build Spanlens, an open-source LLM observability tool that sits in front of all three as a proxy and records every call with its model, latency, tokens…