DEV Community

Cover image for I kept running out of Claude Code quota mid-task, so I put the limits on my Linux panel
Davi Castro
Davi Castro

Posted on AI-assisted

I kept running out of Claude Code quota mid-task, so I put the limits on my Linux panel

I use Claude Code, Antigravity (Gemini) and Copilot most of the day, and the way I usually found out I had hit a limit was a task stopping halfway through. Each tool shows its usage somewhere (/usage in Claude Code, a settings page elsewhere), but I never look until it's too late.

So I made CotaBar, a small applet for the Cinnamon panel on Linux Mint. Each tool gets a double ring: the outer one is the long window (week or month), the inner one the short window (5 hours). Next to it are the two percentages with a letter for the period (H, D, W, M). Clicking it lists every limit with a bar and when it resets.

CotaBar on the panel with the menu open

How it gets the numbers

A Python script, standard library only, runs every few minutes. It reads the login each tool already keeps on disk and asks the same usage endpoint the tool itself uses:

  • Claude Code: ~/.claude/.credentials.json, the endpoint behind /usage
  • Antigravity: the agy CLI token, Cloud Code's quota summary
  • Codex: ~/.codex/auth.json
  • Copilot: gh auth token

Two rules I didn't want to break:

  • Never refresh a token. Refreshing Claude's or Codex's token rotates it, which would log out the session I have open. If a token is expired, CotaBar keeps the last good reading. With an expired token the tool is idle, so usage can't have gone up; it only zeroes the windows whose reset time already passed.
  • Never write a token. The applet only reads a JSON with percentages and reset times.

A small thing I found along the way: Antigravity's quota endpoint returns only one model group unless the User-Agent carries the client version. With the version it returns Gemini, Claude/GPT and Argon separately.

Install

git clone https://github.com/Davicjc/cotabar.git
cd cotabar && ./instalar.sh
Enter fullscreen mode Exit fullscreen mode

It shows up on the panel without restarting Cinnamon. The menu also has an update button that pulls the latest version from GitHub.

Codex support follows the official endpoint, but I couldn't test it with a real account yet. If you use Codex, I'd love to know whether it works. The idea came from Codenotch, a macOS app that puts these limits on a notch; CotaBar is a separate implementation for the Linux panel.

Repo: https://github.com/Davicjc/cotabar

Top comments (1)

Collapse
 
reidmarlow profile image
Reid Marlow •

Never refreshing the credentials file out-of-band is the right constraint. Claude Code rewrites credentials.json on its own rotation schedule, and an external process issuing a refresh races the active CLI session and invalidates the session token immediately. Zeroing out expired sliding windows by timestamp alone without touching the disk token is clean engineering.