← Back to PRs

#7913: fix: fixed gemini-cli usage not working for preview models

by RomanHotsiy open 2026-02-03 09:52 View on GitHub →
size: S
Gemini usage is always showing 0. <img width="678" height="310" alt="image" src="https://github.com/user-attachments/assets/9214b5e2-a4ae-45e7-98c7-688040438034" /> Tracked it down to the endpoint not returning experimental models if project is not passed. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR fixes Gemini CLI usage reporting for preview/experimental models by optionally including a `project` field in the `retrieveUserQuota` request body. Implementation-wise, `ProviderAuth` is extended with an optional `projectId` parsed from the Google token JSON, `fetchGeminiUsage` accepts that `projectId` and conditionally sends it in the POST payload, and the usage loader wires the new field through for the `google-gemini-cli` provider. No functional regressions are obvious in the existing usage aggregation flow; the change is narrowly scoped to Gemini usage fetching and auth parsing. <h3>Confidence Score: 4/5</h3> - This PR is safe to merge with low risk and a narrowly scoped behavior change. - Changes are limited to adding an optional `project` parameter to the Gemini quota request and plumbing an optional `projectId` through auth/loading. The main remaining risk is incomplete coverage of how project context is provided (only supported when the stored token is JSON with a `projectId` field), which could leave some users still seeing 0 usage. - src/infra/provider-usage.auth.ts (projectId extraction assumptions) <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs