Anthropic Credits Balance (xbar plugin)
This is the setup guide for the Anthropic menu bar plugin from the article: Keep track of your AI providers credit balance in macOS menu bar.
What it does
The plugin displays your current Anthropic prepaid credits balance in the macOS menu bar as a compact label like Anthropic: $12.34.
It refreshes every minute (the filename ends with .1m.sh) and adds a dropdown action: Refresh now.
Prerequisites
- macOS with
bash,curl, andpython3available. - xbar installed.
- An Anthropic account with prepaid credits enabled.
- Your Anthropic organization id and dashboard
sessionKeycookie value.
Install
- Install xbar from https://xbarapp.com/.
- Open xbar and use Preferences → Open Plugin Folder.
- Copy
anthropic_balance.1m.shinto your xbar plugins folder. - Make it executable:
chmod +x anthropic_balance.1m.sh - Refresh xbar (or restart the app).
Configure org id and session key
Edit anthropic_balance.1m.sh and set:
ENDPOINT_URLby replacing<org-id>with your organization id.SESSION_KEYto your Anthropic dashboardsessionKey.
How to get them (from the plugin README):
- Log in to Anthropic Console.
- Open DevTools and go to Network.
- Find a request to
/api/organizations/<org-id>/prepaid/credits. - Copy the organization id from the request URL.
- Copy
sessionKeyfrom request cookies.
Notes
- Endpoint used:
https://platform.claude.com/api/organizations/<org-id>/prepaid/credits. - The plugin reads
amount(in cents) and formats it as dollars. - If your
sessionKeyexpires, the menu bar title turns intoAnthropic: --(red) and the dropdown shows an error.