Uh oh!
There was an error while loading. Please reload this page.
fix(ai-gemini): parse usageMetadata in image adapter response - #331
fix(ai-gemini): parse usageMetadata in image adapter response#331tecoad wants to merge 2 commits into
Conversation
The Gemini image adapter was always returning `usage: undefined` even though the API response includes `usageMetadata` with token counts. Map `usageMetadata` fields to the `ImageGenerationResult.usage` object, consistent with how the OpenAI image adapter already handles usage. ClosesTanStack#330 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThe changeset documents that ChangesGemini image usage release note
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
AlemTuzlak
commented
Jul 1, 2026
@tecoad hey man, thank you for this but it's already been fixed on main! |
Summary
usage: undefinedby mappingusageMetadatafrom the API response to theImageGenerationResult.usagefieldpromptTokenCount→inputTokens,candidatesTokenCount→outputTokens,totalTokenCount→totalTokensCloses#330
Test plan
usageis populated with token countsusageMetadatais absent,usagegracefully falls back toundefinedpnpm test:libandpnpm test:typeson theai-geminipackage🤖 Generated with Claude Code
Summary by CodeRabbit