Skip to content

Add Gemini CLI provider for session tracking#168

Merged
iamtoruk merged 1 commit intomainfrom
feat/gemini-provider
Apr 28, 2026
Merged

Add Gemini CLI provider for session tracking#168
iamtoruk merged 1 commit intomainfrom
feat/gemini-provider

Conversation

@iamtoruk
Copy link
Copy Markdown
Member

Summary

  • Gemini provider: parses ~/.gemini/tmp/<project>/chats/session-*.json from Gemini CLI 0.38+
  • Uses real token counts (input, output, cached, thoughts) from Gemini's embedded session data -- no character estimation needed
  • Correctly separates cached tokens from fresh input to avoid double-charging at both input rate and cache rate
  • Pricing for gemini-3.1-pro-preview, gemini-3-flash-preview, gemini-2.5-pro, gemini-2.5-flash from official Google API rates
  • Tool name normalization (ReadFile->Read, SearchText->Grep, Shell->Bash)
  • Menubar tab support with Google Blue (#4485F4)

Closes #166

Test plan

  • TypeScript type check clean
  • 374 tests pass (27 suites)
  • Swift menubar builds clean
  • Tested with real Gemini CLI session data (1 session, gemini-3-flash-preview, $0.07, 104K fresh input + 85K cached + 3K output)
  • Verified cached token math: Gemini's input includes cached as subset, so fresh = input - cached

Parse ~/.gemini/tmp/<project>/chats/session-*.json files from Gemini
CLI 0.38+. Uses real token counts (input, output, cached, thoughts)
embedded in each message instead of character estimation. Correctly
separates cached tokens from fresh input to avoid double-charging.

- Pricing for gemini-3.1-pro-preview, gemini-3-flash-preview,
  gemini-2.5-pro, gemini-2.5-flash from official Google API rates
- Tool name normalization (ReadFile->Read, SearchText->Grep, etc.)
- Menubar tab with Google Blue color (#4485F4)

Closes #166
@iamtoruk iamtoruk force-pushed the feat/gemini-provider branch from e11989d to 3321e47 Compare April 28, 2026 02:48
@iamtoruk iamtoruk merged commit 6d15ea4 into main Apr 28, 2026
3 checks passed
@iamtoruk iamtoruk deleted the feat/gemini-provider branch April 28, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Gemini CLI session tracking

1 participant