PulseAugur
EN
LIVE 10:41:44

LLM APIs Differently Report Streamed Token Usage

Developers integrating LLMs need to be aware of how token usage is reported in streamed responses, as it differs across APIs. OpenAI's Chat Completions API requires an explicit option to include usage data, which is sent in a final chunk. Anthropic's Messages API splits usage information across multiple events, with input tokens reported early and output tokens incrementally. This tutorial provides specific TypeScript functions to correctly parse and track token counts and costs for both OpenAI and Anthropic, ensuring accurate billing and usage monitoring. AI

IMPACT Developers can now accurately track token usage and costs for streamed LLM responses across different APIs, enabling better cost management and application reliability.

RANK_REASON The item provides a technical tutorial on how to implement specific features (streamed responses and token counting) for LLM APIs, which is a developer tool.

Read on dev.to — LLM tag →

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

LLM APIs Differently Report Streamed Token Usage

How we ranked this

Signal score
25 / 100
Composite score across the factors below. Higher = stronger signal that this story matters right now.
Newsworthiness bucket
Tool
The item provides a technical tutorial on how to implement specific features (streamed responses and token counting) for LLM APIs, which is a developer tool.
Source corroboration
Single-source cluster
Only one publisher covered this so far. Single-source stories can still rank when the publisher is high-authority, but they lack cross-source corroboration.
Topics
product, infra
Editorial topic classification. Feeds into how the story surfaces on /topic/<slug> hub pages and into the per-entity coverage mix.
AI-industry relevance
High
Clearly on-topic for AI-industry coverage.
Story freshness
Breaking (< 6h)
Fresh story with cross-source coverage still developing. Ranking may shift as more sources report.

Full methodology in our editorial standards.

COVERAGE [1]

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

    Streamed LLM Responses Hide Their Token Count. Where Usage Lives in 3 TypeScript APIs

    <ul> <li> <strong>Book:</strong> <a href="https://www.amazon.com/dp/B0HBN9XMCY" rel="noopener noreferrer">AI That Answers</a> </li> <li> <strong>The series:</strong> <em>AI in TypeScript</em> — 5 books, from your first LLM call to agents in production — <a href="https://xgabriel.…