PulseAugur
中
实时 10:41:56
English(EN) Streamed LLM Responses Hide Their Token Count. Where Usage Lives in 3 TypeScript APIs

LLM API 以不同方式报告流式 Token 使用情况

集成 LLM 的开发者需要了解流式响应中 Token 使用情况的报告方式,因为这在不同 API 之间存在差异。OpenAI 的 Chat Completions API 需要一个显式选项来包含使用情况数据,该数据在最后一个块中发送。Anthropic 的 Messages API 将使用情况信息分散在多个事件中,输入 Token 较早报告,输出 Token 则逐步报告。本教程提供了特定的 TypeScript 函数,用于正确解析和跟踪 OpenAI 和 Anthropic 的 Token 数量和成本,确保准确的计费和使用情况监控。 AI

影响 开发者现在可以准确地跟踪不同 API 的流式 LLM 响应的 Token 使用情况和成本,从而实现更好的成本管理和应用程序可靠性。

排序理由 该项目提供了关于如何为 LLM API 实现特定功能(流式响应和 Token 计数)的技术教程,这是一个开发者工具。

在 dev.to — LLM tag 阅读 →

AI 生成摘要 · Google Gemini · 来自 1 个来源。 我们如何撰写摘要 →

LLM API 以不同方式报告流式 Token 使用情况

本文如何被排名

Signal score
25 / 100
Composite score across the factors below. Higher = stronger signal that this story matters right now.
Newsworthiness bucket
Tool
该项目提供了关于如何为 LLM API 实现特定功能(流式响应和 Token 计数)的技术教程,这是一个开发者工具。
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.

完整方法见我们的编辑标准。

报道来源 [1]

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

    流式 LLM 响应隐藏了它们的 token 计数。使用量存在于 3 个 TypeScript API 中

    <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.…