#7913: fix: fixed gemini-cli usage not working for preview models
size: S
Cluster:
OAuth and CLI Fixes
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
#10984: OpenClaw lists gemini-2.0-flash but misses gemini-2.5-flash-lite (G...
by jatinb92 · 2026-02-07
79.1%
#8675: fix: Gemini batch embeddings state path, enum values, and download URL
by seasalim · 2026-02-04
77.4%
#21181: fix(models): add gemini-3.1-pro-preview forward-compat for google-g...
by Mellowambience · 2026-02-19
77.1%
#7781: fix: resolve Google Gemini CLI auth credential extraction #4585
by ManojPanda3 · 2026-02-03
76.6%
#4550: fix: sync google-gemini-cli-auth tokens from external CLI (#3803)
by SalimBinYousuf1 · 2026-01-30
76.4%
#23424: feat: add Gemini 3.1 Pro Preview support (google-gemini-cli)
by hongchanroh · 2026-02-22
76.4%
#11464: feat(models): add forward-compat fallback for gemini-3-pro-image
by ben-milanko · 2026-02-07
75.4%
#21263: fix: add google-vertex support for Gemini 3.1 models
by pdd-cli · 2026-02-19
75.0%
#13075: [Feature]: Add Gemini (Google Search grounding) as web_search provider
by akoscz · 2026-02-10
74.8%
#13006: fix(provider): disable reasoning tags for gemini-3-pro variants to ...
by whyuds · 2026-02-10
74.6%