Vercel AI SDK's fullStream may emit a finish event with zero/invalid usage data in real API calls, even though tests show it working. This implements a hybrid approach: 1. convertVercelStream emits usage from finish event if valid (>0 tokens) 2. Track whether usage was emitted during stream consumption 3. If no usage emitted, fall back to awaiting stream.usage Promise This ensures tests pass (which have valid finish events) while also handling real API scenarios where finish events may have incomplete data. Changes: - vercelStreamConverter: Only emit usage if tokens > 0 - OpenAI.ts: Add hasEmittedUsage tracking + fallback - Anthropic.ts: Same approach with cache token support Co-authored-by: nate <nate@continue.dev> Generated with [Continue](https://continue.dev) |
||
|---|---|---|
| .. | ||
| config-types | ||
| config-yaml | ||
| continue-sdk | ||
| fetch | ||
| hub | ||
| llm-info | ||
| openai-adapters | ||
| terminal-security | ||
| shared-release.config.js | ||