Fix Google streaming usage billing#5
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Looking for one thing? Review this PR in Change Stack to search files, summaries, diffs, and code without losing your place. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughThis PR addresses correct handling of Google API streaming usage metadata that arrives split across multiple HTTP response chunks. It extends 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
0e116ea to
c083996
Compare
Summary
Fixes Google/Gemini streaming usage billing in the Nevermind gateway.
Production showed successful Google streaming requests being logged with:
input_tokens=0output_tokens=0cost_credits=0Root cause: the Google SSE usage parser assumed each chunk contained complete
data:lines. In production,usageMetadatacan arrive split across stream chunks, so the parser silently missed the final token usage payload.Changes
thoughtsTokenCountas output tokens alongsidecandidatesTokenCount.vercel logsis live-only when Axiom has no runtime rowsVerification
0tokens /0credits).inputTokens=12,outputTokens=6,costCredits=1).mise exec -- pnpm -C backend testmise exec -- pnpm testRoadmap handoff
The remaining self-serve gateway roadmap has been moved into focused GitHub issues and should be treated as the source of truth:
Summary by CodeRabbit
Bug Fixes
Documentation
Tests