PulseAugur
中
实时 19:00:03
English(EN) The usage field is optional: how a gateway silently under-reports your tokens

AI 网关可能因可选 API 字段而少报 Token 使用量

一篇技术文章解释了 AI 网关提供商如何悄悄少报 token 使用量,导致使用面板和发票之间出现差异。问题源于 OpenAI 兼容 API 响应中可选的 'usage' 字段,该字段在流式请求时通常默认省略。当启用具有特定选项的流式传输时,会发送一个包含使用数据的特殊块,但如果该块包含一个空的 'choices' 数组,网关代理可能会跳过此块。文章提供了三个 curl 命令,帮助用户诊断其网关是否少报了 token 数量,突显了对账差距和准确跟踪输入与输出 token 成本的困难。 AI

影响 强调了 AI API 计费中潜在的差异,并为开发人员提供了验证 token 使用量的方法。

排序理由 技术文章,详细介绍了 AI API 使用量报告的一个具体实现细节和诊断方法。

在 dev.to — LLM tag 阅读 →

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

AI 网关可能因可选 API 字段而少报 Token 使用量

本文如何被排名

Signal score
9 / 100
Composite score across the factors below. Higher = stronger signal that this story matters right now.
Newsworthiness bucket
Tool
技术文章,详细介绍了 AI API 使用量报告的一个具体实现细节和诊断方法。
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
infra, product
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) · batonyzeng-sketch ·

    使用情况字段是可选的:网关如何默默地低报您的 token

    <p>A team I worked with spent a week arguing with their AI gateway vendor about a 22% gap between the usage panel and the invoice. Both numbers were computed correctly. The panel was summing a field that the gateway only populated for non-streaming requests. Everything they serve…