Skip to content

fix: record non-stream usage for provider-native responses#1912

Open
nguyenha935 wants to merge 1 commit into
decolua:masterfrom
nguyenha935:fix/nonstream-usage-history
Open

fix: record non-stream usage for provider-native responses#1912
nguyenha935 wants to merge 1 commit into
decolua:masterfrom
nguyenha935:fix/nonstream-usage-history

Conversation

@nguyenha935

Copy link
Copy Markdown
Contributor

Summary

  • Expand non-stream usage extraction to support provider-native response shapes such as Ollama, Kiro, CommandCode, nested OpenAI Responses usage, and nested Gemini usage metadata.
  • Estimate missing prompt tokens from the original request when a provider reports output tokens only, preserving an estimated flag for visibility.
  • Preserve cache/reasoning usage metadata when saving usage history so Recent Requests and cost accounting have the same token context.

Test Plan

  • ./node_modules/.bin/vitest run --config vitest.config.js --reporter=verbose unit/nonstream-usage-extraction.test.js unit/usage-concern.test.js
  • npm run build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant