Skip to content
lwh0630Public

About

Open-source, cross-platform AI quota monitor (Codex, Claude, Cursor and 47 more). Windows, macOS, Linux, Android and iOS. Built with Flutter.

Topics

Resources

Stars

221 stars

Watchers

0 watching

Forks

Repository files navigation

TokenBar logo

TokenBar

Every AI quota, one glance away. An open-source, cross-platform monitor for AI usage limits, balances and reset times. Runs on Windows, macOS, Linux, Android and iOS.

English | 简体中文

CI Release License: MIT Platforms Flutter Providers

Inspired by CodexBar for macOS. TokenBar brings the same idea to Windows, Android, Linux and iOS (and ships a macOS build too), and covers 57 services.

Why TokenBar

  • See everything in one place. Codex, Claude, Cursor, OpenRouter, DeepSeek, z.ai and 46 more: remaining quota, balance, reset countdown and whether you are burning through it faster than a linear pace.
  • Nothing sits in the middle. The app queries each provider's own endpoint from your device. The optional sync server only ever receives usage snapshots, never credentials.
  • Reuses what you already have. On desktop it reads the login your official CLI or app already stored (read-only). Elsewhere you paste an API key or cookie. TokenBar never asks for a password and never logs in on your behalf.
  • Native desktop feel. A tray icon whose two bars follow your tightest quota, and a compact tray panel that lists every account.
  • Liquid-glass look. A frameless window with a unified title bar, frosted-glass sidebar and cards over a softly drifting ambient background, in light and dark. Pick a gradient preset or your own picture as the background in Settings (picture backgrounds are not available in the web build). On phones, swipe left / right to move between Quota, Accounts and Settings.

Screenshots

The screenshots use fictional demo data.

Desktop

Dashboard on Windows, light theme Dashboard on Windows, dark theme

Settings on Windows, light theme Settings on Windows, dark theme

Tray panel, light theme Tray panel, dark theme

Mobile

Dashboard on Android, light theme Dashboard on Android, dark theme Settings on Android, light theme Settings on Android, dark theme

The app interface is available in Simplified Chinese and English. Switch in Settings → Language; the default follows your system language (Chinese systems get Chinese, everything else gets English). Text that comes from the provider integrations (setup hints, some field names and error messages) is still Chinese for now, see the roadmap. Provider names, plan names and numbers are shown as the providers report them.

Features

Quota windows 5-hour, weekly, monthly and per-model windows, with percent left, reset countdown, local reset time and a pace marker ("ahead of / behind a linear pace", projected usage at reset).
Balances and spend Credit balances, spend and caps in the provider's own currency or credit unit.
Tray icon and panel (desktop) A two-bar tray icon driven by the tightest window, a click-to-open panel for all accounts, right-click menu. The same window doubles as the panel.
Usage history Stacked bars per time slot (24 h / 7 d / 30 d), broken down by quota window or by cost item, with each item's share and total.
Notifications Low-quota alerts at thresholds you choose and an alert when a low quota resets.
Languages Simplified Chinese and English. Choose in Settings → Language; defaults to the system language.
Light and dark themes Follows the system or set manually.
Phone widgets Native Android home-screen widget. iOS WidgetKit sources are included but unverified.
Update check Looks for a newer GitHub release at launch (can be turned off) or on demand, and can download and install it in the app. See Updates.
Optional sync server Self-hosted. Push snapshots from your PC, view them on your phone or in the browser.
CLI tokenbar usage prints the same data in a terminal or as JSON.

Supported services

Three ways to read a service:

  • Local login: reuses the login of the official client already on the machine (read-only). Desktop only.
  • API key / token: paste it once. Works on desktop, phone and web. On desktop, an empty field falls back to the provider's usual environment variable.
  • Cookie: on desktop TokenBar can read the session cookie of the browser you are already signed in with (Firefox, Chrome, Edge, Brave, ... — read-only, only that service's cookies, nothing stored; Settings → Data sources can turn it off, and each account can use a pasted cookie instead). Otherwise copy the Cookie request header from your browser's developer tools. These endpoints are not public and may change without notice. Chrome / Edge 127+ on Windows protect their cookies with app-bound encryption, which TokenBar does not bypass: use Firefox or paste the cookie there.

Subscriptions (local login)

Service How it is read What you see
Codex (ChatGPT) Official browser sign-in from TokenBar or an existing Codex login. Expired tokens fall back to codex app-server. 5-hour and weekly usage, credits, earned reset credits
Claude (Pro / Max) Claude Code login (~/.claude/.credentials.json, Keychain on macOS) 5-hour, weekly, Opus / Sonnet weekly, extra usage
Cursor Cursor desktop login (read-only state.vscdb) or a pasted cursor.com cookie Monthly quota, Auto / API split, on-demand usage
Gemini Firefox login (auto-read, recommended — the browser rotates tokens, so pasted copies die fast), Gemini CLI login (~/.gemini/oauth_creds.json, read-only), or a pasted OAuth token / gemini.google.com cookie Gemini app 5-hour and weekly limits, or Pro / Flash / Flash Lite quota

For Gemini, desktop users can reuse the Gemini CLI's Google login (read-only; since Google stopped serving Gemini CLI OAuth for individual, AI Pro and Ultra accounts in June 2026, this path needs a Workspace, education or Code Assist Standard/Enterprise account). Alternatively paste an OAuth access token from ~/.gemini/oauth_creds.json, or a Cookie header copied from a request to gemini.google.com/usage in your browser's developer tools — the cookie path shows the Gemini app's 5-hour and weekly limits and works for consumer plans. Add it in Accounts → Add account → Gemini. Tokens and cookies are never refreshed; re-login in the Gemini CLI or paste a new cookie when they expire. On desktop, when a fetch reports a signed-out session and Firefox holds a live gemini.google.com login, TokenBar automatically reads the session from Firefox's own cookie store (cookies.sqlite, plain SQLite, read-only while Firefox runs) — the browser keeps the short-lived session tokens fresh, so this path keeps working without re-pasting. Cookies and tokens are never written back.

Official API keys (27)
Service What you see
OpenAI API Spend over the last 30 days (organization admin key; other keys try the legacy balance endpoint)
DeepSeek Account balance
Moonshot / Kimi platform Account balance
xAI Balance and spend (management key + team ID)
Venice DIEM / USD balance
DeepInfra Balance, month-to-date spend, spend limit
Fireworks AI Spend over the last 30 days
Hugging Face Billing usage (token with billing read access; desktop can read the token saved by hf auth login)
ElevenLabs Character quota, voice slots
Vercel AI Gateway Team credits or personal budget
Atlas Cloud Account balance
OpenRouter Credit balance, key limit
Tavily Plan and key credit usage
Linkup Prepaid credit balance
Exa Month-to-date spend of a key (Team Management service key)
fal Credit balance (billing read access)
Soniox Month-to-date usage and budget (organization key)
Poe Remaining points
Neuralwatt Subscription kWh quota, key limit, prepaid balance
ZenMux 5-hour / 7-day quota, pay-as-you-go balance (management key)
Warp AI request quota, bonus credits
Synthetic Rolling, weekly and search quotas
Chutes 4-hour rolling and monthly quotas
abliteration.ai Prepaid USD credits and cumulative usage
TrustedRouter Key limit remaining, daily / weekly / monthly / total spend
Tripo Available and reserved credits
SiliconFlow USD balance (international API key; the China balance API was retired)
Coding plans (8)
Service What you see
z.ai / Zhipu GLM 5-hour and weekly quota, MCP quota (international and China sites)
Kimi Code Weekly / 5-hour / monthly quota (China site by default, region selectable)
MiniMax Interval and weekly quota (China site by default, region selectable)
v0 Billing balance, API rate limits
DevPass Plan credits, weekly premium quota, key spend
xKiro Daily free token quota (resets at 00:00 UTC)
ai& Spend over the last 30 days
Groq Request and token rate over the last 5 minutes (Groq does not publish remaining quota)
Self-hosted gateways (6)
Service What you see
LiteLLM Personal / team budget and spend (virtual key)
sub2api Daily / weekly / monthly quota and rate-limit windows
Bifrost Budget usage
LLM Proxy quota-stats (the group with the least remaining)
ClawRouter Monthly budget
Aixy Budget applying to the key
Other account APIs (12)
Service What you see
Aerostack Monthly AI token quota (account JWT)
Cosmic AI Input / output token quota of a project
FLORA Available balance, month-to-date spend
Future AGI AI credits of the billing period, gateway request quota
GitKraken AI Weekly AI credits
Sail Research Organization credit balance, recent spend
Munito Daily / monthly spend limits
Sofya Available / plan / purchased credits
Chatbox AI Plan / bonus / top-up / image quota (license key)
IBM Bob Bobcoin budget per team
GitHub Copilot Metered quota and credits usage reported by GitHub (GitHub token)
Xiaomi MiMo Token Plan quota (tp- key) or account balance + plan usage (platform cookie)

For GitHub Copilot, paste a GitHub token authorized for the account's Copilot usage in Accounts → Add account → GitHub Copilot. The CodexBar integration uses the GitHub OAuth token itself (gho_...), rather than a short-lived Copilot service token. Desktop users can also supply COPILOT_API_TOKEN; an optional Enterprise host selects that account's API host. TokenBar does not provide a device-login flow or automatically discover other clients' saved Copilot logins.

Copilot usage comes from the non-public /copilot_internal/user endpoint and depends on the token's access. When GitHub returns metered quota values, they are shown directly; if it returns only credits_used, TokenBar shows credits used without inventing a remaining amount or percentage. Unlimited or placeholder quotas do not become 100% remaining bars. GitHub web billing budgets and a user-entered seat allowance are not included in this integration.

For Xiaomi MiMo there are two ways. A Token Plan key (starts with tp-, created in the Token Plan console; pick the China mainland or Singapore region) needs no cookie, works on phones and shows the plan quota; ordinary inference API keys cannot be used. Or sign in to platform.xiaomimimo.com: on desktop the signed-in browser session is read automatically, otherwise copy a request's Cookie header (it must include api-platform_serviceToken and userId) and paste it in Accounts → Add account → Xiaomi MiMo; this also shows the account balance from the platform's non-public endpoints. Replace the cookie when the platform session expires. Plan usage is shown only when returned by the platform; a balance-only account does not gain a synthetic quota window.

Not supported, and why
Service Reason
Doubao (Volcano Ark) The API-key route would have to send a real chat request to probe the quota (it spends tokens); the AK/SK route needs Volcengine request signing
AWS Bedrock Needs AWS SigV4 request signing
Vertex AI Needs a Google Cloud service account / gcloud credentials and signing
Azure OpenAI Needs Azure subscription management credentials
Muse (Meta Muse Code) The only quota endpoint creates an inference key on the account, which is not a read-only operation
Antigravity, Grok, Wayfinder, Pi, CodeRabbit Rely on decrypting browser cookie stores, the macOS keychain or non-public login flows

Each provider reads documented or reverse-documented endpoints taken from CodexBar's research. Nothing is invented: if an endpoint cannot be traced to its source, it is not shipped.

Privacy and security

  • Credentials stay on your device, in the platform secure store (flutter_secure_storage). They never go into logs, snapshots or the sync server, and they are not part of any exported JSON.
  • Read-only by default. TokenBar never refreshes or rewrites another tool's tokens (refreshing rotates the refresh token and can sign the official client out). Refreshing Claude's token is an explicit opt-in setting, off by default.
  • No passwords, no simulated logins. Only an existing local login, a key / cookie that you paste yourself, or (desktop, switchable) the session cookie of a browser you are already signed in with. Browser cookies are read-only, limited to the service being queried, never stored, logged or synced, and a locked browser database is only read from a temporary copy that is deleted again.
  • The sync server is optional and only receives usage snapshots.
  • The update check is one anonymous request to the GitHub API. See Updates.

Install

Download the latest build from the Releases page and check it against SHA256SUMS.txt.

Windows 10 / 11 (x64 and ARM64)

  1. Download tokenbar-<version>-windows-x64-setup.exe (Intel / AMD) or tokenbar-<version>-windows-arm64-setup.exe (Windows on ARM) and run it.
  2. The installer is per-user by default (no administrator rights, installs to %LOCALAPPDATA%\Programs\TokenBar); the privileges dialog lets you install for all users instead. It adds a Start menu entry (and an optional desktop icon), upgrades in place and can be removed from Settings → Apps. The Visual C++ runtime is bundled. For silent installs use /VERYSILENT.

The installer and the app are not code-signed. SmartScreen may show "Windows protected your PC": choose More info → Run anyway. Systems that enforce Smart App Control or an application-control policy can block unsigned executables outright. In that case, build from source.

Android 7.0+ (API 24+)

  1. Download the APK for your device: arm64-v8a for almost every recent phone, armeabi-v7a for old 32-bit devices, x86_64 for emulators.
  2. Open it and allow installation from your browser or file manager when Android asks.

APKs are signed with the TokenBar release key. To verify:

apksigner verify --print-certs tokenbar-<version>-android-arm64-v8a.apk
# certificate SHA-256 digest: c04373ec39a24dd04d6f6797ed984be27d172c01fc30833f957845bb5b622d27

macOS 12+

  1. Download tokenbar-<version>-macos-arm64.dmg (Apple Silicon: M1 and later) or tokenbar-<version>-macos-x86_64.dmg (Intel), open it and drag TokenBar to Applications.
  2. If macOS blocks the first launch, right-click the app and choose Open, or run:
xattr -dr com.apple.quarantine /Applications/TokenBar.app

Linux x64 / ARM64 — experimental

  1. Download tokenbar-<version>-linux-x64.tar.gz (Intel / AMD) or tokenbar-<version>-linux-arm64.tar.gz (ARM, for example Raspberry Pi 4/5 or Asahi Linux) and extract it.
  2. Run ./token_bar inside the extracted folder.

Runtime libraries: GTK 3, libsecret (credential storage, with a running keyring such as GNOME Keyring or KWallet) and libayatana-appindicator3 (tray icon). On Debian / Ubuntu: sudo apt install libgtk-3-0 libsecret-1-0 libayatana-appindicator3-1. On GNOME the tray icon needs the AppIndicator extension. Linux tray icons only offer a menu (no click event), so the compact tray panel is not available there: use the menu's Open TokenBar.

iOS 15+ — experimental, sideload only

tokenbar-<version>-ios-unsigned.ipa is not signed, and there is no Apple Developer account behind this project, so the file cannot be installed as is. Re-sign and install it with your own Apple ID through a sideloading tool such as AltStore or Sideloadly (free Apple IDs have to renew the install every 7 days). The Home Screen widget is not part of the IPA.

Platform status

Platform Status
Windows x64 Supported. Built and tested on Windows 11; CI builds a release on every push.
Windows ARM64 Experimental. Built natively on a Windows ARM runner by CI on every push; not run on real ARM hardware.
Android Supported. Tested on an Android emulator (API 37); CI builds on every push and releases are signed.
Web Builds in CI. Intended for use with the sync server (browsers cannot reach most provider endpoints directly).
macOS Works in the maintainer's testing; CI builds it on every push. Ad-hoc signed and not notarized (see the install note above). Separate Apple Silicon and Intel images.
Linux x64, ARM64 Experimental. CI builds both natively on every push, but they have not been run on a real machine. The tray is a menu only (no tray panel).
iOS Experimental. CI builds an unsigned IPA (sideload only); it has not been run on a device. The WidgetKit sources are not built into it.

Getting started

TokenBar uses the current user's manual HTTP proxy settings on Windows, macOS and Linux (GNOME gsettings) for provider queries. Proxy environment variables take precedence when set.

  1. Launch TokenBar. On desktop it detects the services you are already signed in to (Codex, Claude, Cursor) and adds them.
  2. Open Accounts → Add account to add a service. Select the service and follow its sign-in or configuration instructions. You can add several accounts for the same service.
  3. The dashboard refreshes every few minutes (configurable). Tap an account for per-window detail and history. The Account button at the top right of a card opens the provider’s account overview, usage dashboard, or console in your browser. The Project button opens the official project for self-hosted services without a shared console.

Codex (desktop). Choose Accounts → Add account → Codex → Sign in with ChatGPT. Complete sign-in in your browser and TokenBar adds the account and fetches its usage. Each sign-in uses its own CODEX_HOME. You can also enter the config directory of an existing login. On Windows, TokenBar can use the CLI included with the official Codex desktop app.

Codex cards on the dashboard and the account detail page show the available reset credit count and the expiration of each credit returned by OpenAI. TokenBar reads the inventory in the background during quota refreshes. Select Use next to a credit and confirm the account to redeem it. The requests use the selected account's existing ChatGPT login and the same reset credit routes as the Codex client.

Tray panel (desktop). Click the tray icon to open it. It lists quota windows with reset countdowns and shows the sign-in email when the provider reports it. Drag the handle on a card to reorder the tray list. TokenBar saves the order on this device. The panel closes when it loses focus. Open TokenBar brings back the main window. Clicking the tray icon again steps through the states: panel → full window → hidden, so a quick double click opens the full window directly. On Windows 11 the panel has rounded corners. On macOS, Settings → Desktop → Menu bar only hides the Dock icon (⌘Q is then unavailable; quit from the tray menu).

Usage history. On an account's page choose 24 hours, 7 days or 30 days. Each bar is the usage added in a time slot, stacked by item:

  • Quota usage: the percentage points added to each quota window. When a service has component windows (Cursor Auto / API, Claude Opus / Sonnet) only those are stacked by default; the chips above the chart add or remove series.
  • Cost: the money or credits spent per cost item.

Providers rarely report usage per model, so "models" here are the breakdowns the endpoint exposes. History is recorded locally from the first run on.

Cursor and Codex can additionally be viewed per model as a stacked bar chart (tokens, plus cost where it is known). Cursor reads its dashboard events feed (local login or cookie, so phones work too). Codex reads the local session logs under ~/.codex/sessions and therefore needs the desktop app; the logs are read-only and only model names and token counts are taken from them, never prompt or file content.

Updates

TokenBar checks the latest GitHub release once at launch and whenever you press Settings → About → Check for updates. When a newer version exists it shows the release notes. Press Update now to download the installer for your platform inside the app; nothing is downloaded until you do. You can turn the launch check off, or skip a specific version.

The download is only taken from this repository's GitHub release and is checked against the release's SHA256SUMS.txt before it is used (a mismatch deletes the file). The checksum proves the file is intact, not who built it: the Windows installer and the macOS app are not code-signed.

Platform What "Update now" does
Windows (installed with the setup) Runs the new installer silently, closes TokenBar and starts the new version. A portable copy only opens the release page.
Android Hands the APK to the system installer (the first time, Android asks you to allow TokenBar to install apps).
macOS / Linux Saves the dmg / archive to your Downloads folder, verifies it and opens it; you finish the install.
iOS / Web Opens the release page.

The check sends one anonymous GET to api.github.com with the app version in the User-Agent. Drafts and pre-releases are ignored. TokenBar never downloads or installs anything by itself.

Command line

dart run packages/tokenbar_server/bin/tokenbar.dart --help            # list providers
dart run packages/tokenbar_server/bin/tokenbar.dart usage             # all local logins
dart run packages/tokenbar_server/bin/tokenbar.dart usage -p cursor   # one provider
dart run packages/tokenbar_server/bin/tokenbar.dart usage --json

Optional: self-hosted sync

Only needed if you want to see your PC's quotas on your phone or in a browser. The server stores usage snapshots and never receives provider credentials.

# Server (also serves the web app)
docker compose up -d          # set TOKENBAR_TOKEN (and optionally TOKENBAR_READ_TOKEN) in .env

# Or without Docker
flutter build web
(cd packages/tokenbar_server && dart build cli -o ../../build/server)
TOKENBAR_TOKEN=change-me build/server/bundle/bin/tokenbar serve --web build/web --port 8787

Use dart build cli, not dart compile exe (the SQLite native library would be missing).

On the PC: Settings → Server sync → Push local data, enter the server URL and the admin token. On the phone: View server data with the read-only token. A machine without a desktop UI can run tokenbar collect --server URL --token TOKEN on a schedule.

Build from source

Requirements: Flutter 3.47.9 (Dart 3.13.7). For Android also JDK 17 and the Android SDK; for Windows, Visual Studio 2022 with the Desktop development with C++ workload.

git clone https://github.com/lwh0630/TokenBar.git
cd TokenBar
flutter pub get

flutter run -d windows        # or: -d android, -d chrome
flutter build windows --release
flutter build apk --release   # needs signing material, see below

Android release signing. Release builds never fall back to the debug key. Provide android/key.properties (git-ignored) or environment variables:

storeFile=/absolute/path/to/your.jks
storePassword=...
keyPassword=...
keyAlias=...
# create your own key
keytool -genkeypair -keystore your.jks -alias tokenbar -keyalg RSA -keysize 4096 -validity 10000

Debug builds (flutter run, flutter build apk --debug) need no key.

Demo mode. flutter run --dart-define=TOKENBAR_DEMO=true (add --dart-define=TOKENBAR_DEMO_LANG=en or zh to pin the UI language) starts with fictional accounts and a simulated month of history. It uses in-memory storage, makes no network requests and never touches your real settings or credentials. It is what the screenshots above were taken with.

Tests

flutter analyze && flutter test
(cd packages/tokenbar_core && dart analyze && dart test)
(cd packages/tokenbar_server && dart analyze && dart test)
dart format --output=none --set-exit-if-changed lib test packages

Project layout

lib/                      Flutter app (provider + ChangeNotifier)
packages/tokenbar_core/   Pure Dart: models, provider implementations, sync client, tray icon renderer
packages/tokenbar_server/ CLI (usage / collect / serve) and the optional sync server (shelf + sqlite)
android/ ios/ windows/ …  Platform projects, Android widget, iOS WidgetKit sources
tool/gen_icons.py         Regenerates the app icons for every platform
.github/workflows/        CI and signed release pipeline

Releasing

Releases are cut by release.yml: push a vX.Y.Z tag (or run the workflow by hand). It checks, builds and signs per-ABI Android APKs with the key stored in the production environment, builds the Windows x64 and ARM64 installers, the Linux x64 and ARM64 tarballs, the macOS Apple Silicon and Intel disk images and the unsigned iOS IPA, and creates a draft release with SHA256SUMS.txt. Nothing goes public until the draft is published by hand. APKs are verified against the expected certificate fingerprint before upload.

Roadmap

  • Provider-supplied text is still Chinese: setup hints, field labels and error messages in packages/tokenbar_core, plus the less common quota and credit labels. The app UI itself is translated (lib/l10n/); more UI languages can be added there.
  • Verify the Linux (x64, ARM64), iOS and Windows ARM64 builds on real devices.
  • Code-signed Windows build and a signed, notarized macOS build (both need paid certificates).
  • More providers. Adding one is small and well-trodden: see AGENTS.md for the steps and the rules (documented endpoints only, no invented APIs, no credentials in logs).

Contributing

Issues and pull requests are welcome. Before opening a PR run the checks in Tests. For a new provider, add the implementation, a fixture of a real response and a MockClient test, then list it in the tables above.

License

MIT. Provider research is based on CodexBar (MIT); see NOTICE.md.

Provider logos in assets/provider_icons/ are copied from CodexBar (MIT). They are trademarks of their respective owners, used only to identify the services; see assets/provider_icons/README.md.

TokenBar is an independent project and is not affiliated with or endorsed by any of the services it can monitor.

About

Open-source, cross-platform AI quota monitor (Codex, Claude, Cursor and 47 more). Windows, macOS, Linux, Android and iOS. Built with Flutter.

Topics

Resources

Stars

221 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages