返回全部动态

Vercel AI SDK 修复 OpenAI 兼容提供商 token 计数异常

原标题:@ai-sdk/openai-compatible@3.0.28

Vercel AI SDK Releases一手来源API 更新质量 69

AI 摘要

Vercel AI SDK 发布 @ai-sdk/openai-compatible@3.0.28 补丁更新,修复了当提供商报告的 reasoning_tokens 大于 completion_tokens 时 outputTokens.text 可能为负的问题。该问题在 Baseten 服务推理模型因长度限制中断推理时出现。修复后 text 值被限制在 0 以上,total 和 reasoning 保持原样。

以上摘要由 AI 生成,可能存在误差。事实请以原文为准。

正文节选

### Patch Changes - 83e6510: fix(provider/openai-compatible): clamp `outputTokens.text` at 0 when a provider reports `completion_tokens_details.reasoning_tokens` greater than `completion_tokens` (observed with Baseten serving reasoning models that hit the length stop mid-reasoning). The text share of completion tokens can never be negative; `total` and `reasoning` remain as reported by the provider.


发布时间:2026-08-10 02:02
抓取时间:2026-08-10 02:55
来源机构:Vercel
阅读原文github.com