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, and python3 available.
  • xbar installed.
  • An OpenAI account with billing access.
  • An OpenAI billing bearer token captured from the web dashboard (not an API key).

Install

  1. Install xbar from https://xbarapp.com/.
  2. Open xbar and use Preferences → Open Plugin Folder.
  3. Copy openai_balance.1m.sh into your xbar plugins folder.
  4. Make it executable:
    chmod +x openai_balance.1m.sh
    
  5. Refresh xbar (or restart the app).

Configure the token

Edit openai_balance.1m.sh and set:

  • AUTH_TOKEN to your OpenAI dashboard Authorization: Bearer … token value.

How to get it (from the plugin README):

  1. Log in to OpenAI Platform.
  2. Open https://platform.openai.com/settings/organization/billing/overview.
  3. Open Chrome DevTools and go to Network.
  4. Filter requests by credit_grants and open the XHR request.
  5. Copy the Authorization: Bearer ... token value and paste it into AUTH_TOKEN.

Notes

  • Endpoint used: https://api.openai.com/dashboard/billing/credit_grants.
  • The plugin reads total_available from 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.