Skip to content

Gemini CLI usage counter needs a Code Assist API call #163

Description

@hiskudin

Split out of the compact-widget multi-client work (feat/fixes-and-improvements).

Why it was left out

The widget and the Usage tab now cover Claude, Codex, and Antigravity. Gemini CLI is the one wired agent with no usage counter, and it is not an oversight — there is nothing local to read:

Client Source Kind
Claude claude --print /usage shells out to the CLI, which reads its own keychain grant
Codex newest ~/.codex/sessions/**/rollout-*.jsonlpayload.rate_limits local file
Antigravity agy loopback Connect-RPC GetUserStatus localhost, no auth
Gemini nothing

~/.gemini holds only oauth_creds.json, settings.json, projects.json, state.json, google_accounts.json, installation_id, trustedFolders.json and a history/ dir. No rollouts with rate limits, no quota file, and the CLI serves no local endpoint the way agy does.

What it would take

A live call to Google's Code Assist API using the OAuth token in ~/.gemini/oauth_creds.json, including refresh handling.

That is a materially different shape of work from the other three probes and deserves its own review, because it would be the first outbound network call this app makes to a non-local, non-Anthropic endpoint. The Usage section of the README currently leans on the opposite property — that stack-nudge never touches your keychain and never calls a provider API directly, because the claude CLI does that for us and the other two probes are local reads. Reading Gemini quota over the network breaks that invariant, so the decision is a product one before it is an implementation one.

Open questions

  • Is the Code Assist quota endpoint documented, or would we be pinning an undocumented one that can change without notice?
  • Token refresh: do we refresh in-process, or shell out to gemini and let it own its credentials (closer to how the Claude probe works, and keeps us out of the credential business)?
  • Free-tier vs paid Code Assist — do both report a quota we can render on the same two-ring gauge?
  • Does it need an opt-in setting, given it is the only probe that leaves the machine?

Not blocking

UsageClient is exhaustive over its cases and the widget reads through WidgetQuota.make, so adding a .gemini case is a compile-error-guided change once a source exists.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions