feat: add Anthropic Claude Pro/Max support + fix Windows Google path#26
Open
schlambos wants to merge 1 commit into
Open
feat: add Anthropic Claude Pro/Max support + fix Windows Google path#26schlambos wants to merge 1 commit into
schlambos wants to merge 1 commit into
Conversation
- Add plugin/lib/anthropic.ts: queries api.anthropic.com/api/oauth/usage (the same internal endpoint used by Claude Code HUD) using the OAuth access token stored in auth.json under the 'anthropic' key. Handles token refresh via console.anthropic.com/v1/oauth/token. Displays 5-hour and 7-day rolling-window utilization. - Fix plugin/lib/google.ts: getAntigravityAccountsPath() incorrectly used APPDATA on Windows instead of ~/.config/opencode/. opencode always writes antigravity-accounts.json to ~/.config/opencode/ on all platforms, so Windows users received silent quota failures. Now uses homedir()/.config unconditionally. - Update plugin/lib/types.ts: add AnthropicAuthData interface and wire 'anthropic' key into AuthData. - Update plugin/lib/i18n.ts: add zh/en translation strings for Anthropic (title, error messages, limit labels). - Update plugin/mystatus.ts: import queryAnthropicUsage, add to parallel Promise.all(), collect and display Anthropic results.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two independent improvements, both tested against a real Windows install with live credentials.
1. Fix: Windows users get silent Google quota failures
File: \plugin/lib/google.ts\
\getAntigravityAccountsPath()\ used \APPDATA\ on Windows, but \opencode\ always writes \�ntigravity-accounts.json\ to ~/.config/opencode/\ on every platform — including Windows. The result was a silent \ENOENT\ error and no Google quota shown for any Windows user who had antigravity accounts configured.
Fix: Remove the \win32\ branch; always resolve to \homedir()/.config/opencode/antigravity-accounts.json.
2. Feature: Anthropic Claude Pro/Max quota support
Files: \plugin/lib/anthropic.ts\ (new), \plugin/lib/types.ts, \plugin/lib/i18n.ts, \plugin/mystatus.ts\
Adds a new platform module that queries the internal endpoint Claude Code uses for its HUD:
\
GET https://api.anthropic.com/api/oauth/usage
Authorization: Bearer
anthropic-beta: oauth-2025-04-20
User-Agent: claude-code/1.0.17
\\
The OAuth access token is read from \�uth.json\ under the \�nthropic\ key (stored there by \opencode-claude-auth). If the token is expired, the module attempts a refresh via \console.anthropic.com/v1/oauth/token\ using Claude Code's public client ID.
Response used: \ive_hour.utilization\ / \seven_day.utilization\ +
esets_at\ timestamps — same fields Claude Code's own HUD reads.
Output example:
\\
Anthropic Account Quota
Account: Claude Pro/Max
5-hour limit
█████████████████████████████░ 98% remaining
Resets in: 4h 22m
7-day limit
██████████████████████████████ 100% remaining
Resets in: 6d 9h
\\
Both changes were discovered and validated while debugging a real production setup on Windows 11 where Google quota was broken and Anthropic was missing entirely.