A VS Code extension that shows your Claude and Codex usage in the status bar using the credentials already managed by their companion tools.
- Claude budget – powered by the Claude Code extension login
- Codex budget – powered by the ChatGPT extension login
- Quick jump to account settings – click either status bar meter to open that service's settings page
- Manual refresh – run
AI Limits: Refresh Nowfrom the Command Palette to clear the cache and fetch immediately - Shows last 5 hours and last 7 days in the status bar
- Displays USD spend for API-key based accounts and percentage utilization for OAuth/session-based accounts
- Shows clear states for Please log in, loading, No usage yet, and error
- Tooltip shows detailed breakdown, reset times when available, and refresh timing
- Auto-refreshes every 5 minutes and whenever authentication sessions change
Install at least one of the companion extensions and sign in:
| Extension | Marketplace ID | Purpose |
|---|---|---|
| Claude Code | anthropic.claude-code |
Provides Anthropic authentication |
| ChatGPT | openai.chatgpt |
Provides OpenAI authentication |
AI Limits only shows a status bar item for companion extensions that are installed.
If an installed companion extension is not authenticated, the item stays visible and shows Please log in.
If neither companion extension is installed, the extension activates silently with no UI impact.
✳ 5h: 80% 7d: 14% ◎ 5h: 3% 7d: 13%
Examples of the compact states:
| State | Example |
|---|---|
| Not logged in | ✳ Please log in |
| Loading | ✳ ... |
| No usage in either window yet | ✳ No usage yet |
| Error | ✳ error |
| Usage available | ✳ 5h: 80% 7d: 14% ◎ 5h: 3% 7d: 13% |
Hover over an item for a detailed tooltip with exact figures, reset times when known, and refresh timing.
Clicking a status bar item opens the corresponding usage/settings page in your browser. VS Code may show a trusted-domain warning the first time you open links to https://claude.ai or https://chatgpt.com. To avoid future prompts, add those domains once through Trusted Domains: Manage Trusted Domains.
- On startup the extension checks whether
anthropic.claude-codeand/oropenai.chatgptare installed. - For each installed extension it reads credentials from the same on-disk or keychain locations that extension uses:
- Claude Code: reads the macOS Keychain entry for service
"Claude Code-credentials"(account =$USER). Falls back to~/.claude/.credentials.jsonon non-macOS systems or if the keychain is unavailable. - Codex / ChatGPT: reads
~/.codex/auth.json(or$CODEX_HOME/auth.json).
- Claude Code: reads the macOS Keychain entry for service
- The extension resolves usage data from the most reliable source available:
- Claude API key auth:
GET https://api.anthropic.com/v1/usagewithstart_time/end_time - Claude OAuth auth:
GET https://api.anthropic.com/api/oauth/usagefor 5-hour and 7-day utilization percentages - OpenAI API key auth:
GET https://api.openai.com/v1/usage?date=YYYY-MM-DDplusGET /v1/dashboard/billing/subscription - Codex ChatGPT OAuth auth: searches
~/.codex/sessions/recursively for the most recently modified.jsonlfile and uses the embeddedrate_limitssnapshot (300minute and10080minute windows)
- Claude API key auth:
- The status bar renders one of five compact states per provider (checked in this order):
Please log inwhen the companion extension is installed but no usable credentials are founderrorwhen credentials were found but the data fetch failed...while data is being loadedNo usage yetwhen both usage windows are currently empty or unavailable- Usage values when at least one window is available
- Results are cached by token, refreshed every 5 minutes, and refreshed again when VS Code reports extension or authentication changes. If a companion extension was not yet registered at startup (VS Code does not guarantee all extensions are visible when
onStartupFinishedfires), a one-time retry runs 10 seconds later so the status bar items appear without requiring a manual refresh. - Run AI Limits: Refresh Now from the Command Palette at any time to clear the cache and trigger an immediate fetch.
When the Claude APIs do not provide usable usage data, the extension falls back to local Claude project JSONL files where possible. This fallback can estimate USD usage for API-key based workflows, but it does not help OAuth percentage mode when no percentage snapshot is available.
OpenAI's usage endpoint returns data aggregated by UTC calendar day. The 5-hour figure is pro-rated from today's usage based on the elapsed fraction of the day, so it is an approximation.
When authenticated through Claude OAuth or ChatGPT/Codex OAuth, the extension shows percentage utilization for the 5-hour and 7-day windows instead of USD spend.
For Codex, those percentages come from the latest local rollout snapshot. Older snapshots are intentionally ignored once they are too stale, so the UI may show No usage yet rather than a misleading old value.
When you click a status bar item, the extension uses VS Code's standard external-link handling to open the service's usage page. VS Code may ask you to trust https://claude.ai and https://chatgpt.com before opening them. This trust list is controlled by VS Code rather than by the extension, so the prompt cannot be suppressed automatically.
If you want to stop seeing that warning, run Trusted Domains: Manage Trusted Domains from the Command Palette and add:
https://claude.aihttps://chatgpt.com
When the API response does not include a pre-computed cost field, costs are estimated using hardcoded list pricing:
| Service | Model assumed | Input | Output | Cache write | Cache read |
|---|---|---|---|---|---|
| Anthropic | Claude 3.5 Sonnet | $3 / 1M | $15 / 1M | $3.75 / 1M | $0.30 / 1M |
| OpenAI | GPT-4o | $5 / 1M | $15 / 1M | — | — |
Cache pricing applies only to the Anthropic JSONL local-file fallback path. Actual costs may differ if you use other models or have negotiated pricing.
The quickest manual check is to press F5 in this repo and use the Extension Development Host:
- Install the companion extension you want to test.
- Sign out to verify
Please log in. - Sign in and wait for a refresh to verify live usage formatting.
- Use an account or environment with no current usage window data to verify
No usage yet.
Automated coverage for the status bar states lives in test/suite/statusBarManager.test.ts.
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Run tests (requires VS Code to be installed)
npm test
# Watch mode
npm run watchsrc/
extension.ts Entry point; wires providers, status bar, and refresh timer
types.ts Shared TypeScript interfaces
statusBarManager.ts Creates and updates the two status bar items
fetchWithRetry.ts Fetch wrapper with retry/back-off logic
sharedCache.ts In-memory cache keyed by token hash
providers/
claudeProvider.ts Reads Claude credentials, then uses API and local fallbacks
openaiProvider.ts Reads Codex credentials, then uses API or session snapshots
test/
runTests.ts Launches the VS Code Extension Development Host test runner
suite/
index.ts Mocha suite loader
extension.test.ts
claudeProvider.test.ts
openaiProvider.test.ts
sharedCache.test.ts
statusBarManager.test.ts
MIT