OpenAI Credits Balance (xbar plugin)
This is the setup guide for the OpenAI 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 OpenAI credits balance in the macOS menu bar as a compact label like OpenAI: $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 OpenAI account with billing access.
- An OpenAI billing bearer token captured from the web dashboard (not an API key).
Install
- Install xbar from https://xbarapp.com/.
- Open xbar and use Preferences → Open Plugin Folder.
- Copy
openai_balance.1m.shinto your xbar plugins folder. - Make it executable:
chmod +x openai_balance.1m.sh - Refresh xbar (or restart the app).
Configure the token
Edit openai_balance.1m.sh and set:
AUTH_TOKENto your OpenAI dashboard Authorization: Bearer … token value.
How to get it (from the plugin README):
- Log in to OpenAI Platform.
- Open
https://platform.openai.com/settings/organization/billing/overview. - Open Chrome DevTools and go to Network.
- Filter requests by
credit_grantsand open the XHR request. - Copy the
Authorization: Bearer ...token value and paste it intoAUTH_TOKEN.
Notes
- Endpoint used:
https://api.openai.com/dashboard/billing/credit_grants. - The plugin reads
total_availablefrom the JSON response and formats it as dollars. - If the token expires, the menu bar title turns into
OpenAI: --(red) and the dropdown shows an error.