Workflows
Show coding agent usage in tmux, Waybar or SwiftBar
Each coding agent CLI shows its usage only when you ask it inside the CLI. If you would rather see it all the time, next to the clock, you can put it in your status bar. This guide sets that up for tmux, Waybar and SwiftBar with small shell scripts that read Agent Tank’s local HTTP API.
Plans and limits change often. Numbers here were checked on the dates listed under Sources; always confirm on the provider’s own pages.
What you’ll get
Inside each CLI, usage is a command away. Claude Code: /usage shows session cost, plan usage limits and activity stats; /cost and /stats are aliases1. Codex: If you want to see your remaining limits during an active Codex CLI session, you can use /status2. Antigravity: /usage (alias /quota): display model quota usage3. All three show it only in the session you type the command in. How to check Claude Code usage goes through the built-in commands.
A status bar shows it all the time instead. With the scripts below you get one entry per configured account, each with the highest usage across its windows, such as the session, five-hour or weekly limit. In the sample data that is claude, work, personal and agy. Waybar and SwiftBar also list every window in a tooltip or dropdown.
Prerequisites
- Agent Tank running on the same machine, on its default address
http://127.0.0.1:3456. Getting started installs it;agent-tank --backgroundkeeps it running after you close the terminal. curlandjqon yourPATH. The scripts callcurlwith a two-second timeout and shape the JSON withjq.- Optional:
TANK_URL. Every script reads the base URL from this variable and falls back to the default. It is the scripts’ own variable, not an Agent Tank setting; set it if you run Agent Tank on another port.
Check both at once. This prints one account id per line:
curl -sf --max-time 2 http://127.0.0.1:3456/status | jq '.providers[].id'
tmux
The script prints a single line with each account and its highest usage, separated by a dot. Save it, make it executable with chmod +x ~/.local/bin/agent-tank-tmux.sh, and call it from status-right:
#!/bin/sh
# Highest used_percent per account, e.g. "claude 28% · work 54%".
URL="${TANK_URL:-http://127.0.0.1:3456}"
json=$(curl -sf --max-time 2 "$URL/status") || { echo "tank off"; exit 0; }
printf '%s' "$json" | jq -r '
[.providers[]
| select(.windows | length > 0)
| "\(.id) \([.windows[].used_percent] | max | round)%"]
| join(" · ")'
set -g status-interval 60
set -g status-right '#(~/.local/bin/agent-tank-tmux.sh) | %H:%M'
Reload with tmux source-file ~/.tmux.conf. tmux runs the script every status-interval seconds (60 here). The full example, with notes, is tmux status bar on the API page.
Waybar (Linux)
Waybar’s custom modules accept JSON with "return-type": "json". The script returns the highest usage as text, every window in the tooltip, and a class you can style: warning above the threshold in the script, offline when Agent Tank is not running, and pending, with the text n/a, until any account has usage.
#!/bin/sh
# Waybar custom module: {"text", "tooltip", "class"}; class "warning" above 80%,
# "pending" with "n/a" while no account has usage yet.
URL="${TANK_URL:-http://127.0.0.1:3456}"
json=$(curl -sf --max-time 2 "$URL/status") || {
echo '{"text":"tank off","tooltip":"Agent Tank is not running","class":"offline"}'
exit 0
}
printf '%s' "$json" | jq -c '
[.providers[].windows[].used_percent] as $all
| if ($all | length) == 0 then
{text: "n/a", tooltip: "No usage yet: waiting for the first refresh", class: "pending"}
else
($all | max) as $top
| {
text: "\($top | round)%",
tooltip: ([.providers[] | .id as $id | .windows[]
| "\($id) · \(.label): \(.used_percent)%"] | join("\n")),
class: (if $top > 80 then "warning" else "normal" end)
}
end'
"modules-right": ["custom/agent-tank", "clock"],
"custom/agent-tank": {
"exec": "~/.config/waybar/agent-tank.sh",
"return-type": "json",
"interval": 60,
"format": "AT {}"
}
#custom-agent-tank.warning { color: #ecc94b; }
#custom-agent-tank.offline,
#custom-agent-tank.pending { opacity: 0.5; }
Make it executable with chmod +x ~/.config/waybar/agent-tank.sh and restart Waybar. The module runs it every 60 seconds. See Waybar custom module on the API page.
SwiftBar and xbar (macOS)
SwiftBar and xbar run any executable in their plugin folder and read the refresh interval from the file name: 5m in agent-tank.5m.sh. The first line is the menu bar title; lines after --- form the dropdown, here one line per window, a link to the dashboard and a refresh item.
#!/bin/bash
# SwiftBar / xbar plugin, refreshed every 5 minutes (the "5m" in the file name).
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
URL="${TANK_URL:-http://127.0.0.1:3456}"
if ! json=$(curl -sf --max-time 2 "$URL/status"); then
echo "AT off"
echo "---"
echo "Agent Tank is not running"
exit 0
fi
printf '%s' "$json" | jq -r --arg url "$URL" '
[.providers[].windows[].used_percent] as $all
| if ($all | length) > 0 then "AT \($all | max | round)%" else "AT n/a" end,
"---",
if ($all | length) == 0 then "No usage yet: waiting for the first refresh" else empty end,
(.providers[] | .id as $id | .windows[]
| "\($id) · \(.label): \(.used_percent)% | font=Menlo size=12"),
"---",
"Open dashboard | href=\($url)/",
"Refresh | refresh=true"'
Install jq with brew install jq, save the file in your plugin folder and run chmod +x agent-tank.5m.sh. The script adds the Homebrew paths to PATH because menu bar apps do not load your shell profile. See SwiftBar / xbar plugin.
Which fields the scripts read
All three scripts call GET /status, which returns { "providers": [...] }: canonical usage for all agents. From each provider object they read only a few fields:
id(provider): Configured account id (the alias for multi-account setups); the key used by /status/:id, /history/:id and /refresh/:id.windows(provider): Usage limits, one entry per limit window.label(window): Human-readable label, such as "Current week (all models)".used_percent(window): Percent used, rounded to two decimals and clamped to 0–100.
The shape is the same for every provider, so the scripts need no Claude-, Codex- or Antigravity-specific code. To show something else, such as resets_at or remaining_percent, change the jq filter; every window field is listed under Window in the API reference.
Choosing a refresh interval
A status bar script only reads what Agent Tank already has; the endpoints that refresh usage are POST /refresh and POST /refresh/:id. Agent Tank keeps the data fresh on its own:
- Mode. The default refresh mode is
activity: Agent Tank refreshes when it detects CLI activity, waiting 5000 ms after it. Inintervalmode it refreshes every 60 s by default. - Cooldown. Minimum time between refreshes of the same agent, applied to manual refreshes, startup refreshes and detected activity. `0` disables the cooldown. The default is 30 seconds.
So asking more often than Agent Tank refreshes just reads the same numbers again. The example intervals (60 seconds for tmux and Waybar, 5m for SwiftBar) are already at or above the defaults. Each call is a local request with a two-second timeout, so a shorter interval is harmless but rarely shows anything new. The options are under Refresh in the configuration reference.
Showing one account or provider
GET /status/:id returns one canonical provider object (404 when the id is unknown). The id is the account id you configured, or the provider’s default id (claude, codex, agy) with a single account. This variant of the tmux script takes the id as an argument:
#!/bin/sh
# Highest used_percent of one account, e.g. "work 39%"; "work n/a" before the first refresh.
# Usage: agent-tank-account.sh <id>
URL="${TANK_URL:-http://127.0.0.1:3456}"
ID="${1:?usage: agent-tank-account.sh <id>}"
json=$(curl -sf --max-time 2 "$URL/status/$ID") || { echo "$ID off"; exit 0; }
printf '%s' "$json" | jq -r '
if (.windows | length) > 0
then "\(.id) \([.windows[].used_percent] | max | round)%"
else "\(.id) n/a" end'
set -g status-interval 60
set -g status-right '#(~/.local/bin/agent-tank-account.sh work) | %H:%M'
Make it executable with chmod +x ~/.local/bin/agent-tank-account.sh. To show two accounts, call it twice in status-right. Account ids come from --agent aliases (accounts and providers); tracking work and personal accounts together covers setting them up.
Troubleshooting
- “tank off”, “AT off” or an
offlineclass.curlgot no answer within two seconds. Check that Agent Tank is running and thatTANK_URL, if set, has the right port. The scripts send no credentials, so if you started Agent Tank with an auth option, add them to thecurlcall as shown under authentication. - “work off” from the one-account script. Also printed when the id is unknown, since
/status/:idanswers 404 for it. Compare with the ids from the check command above. - Empty output or
n/a. Before the first refresh an account has no windows and itsstatusis"pending". The tmux script skips such accounts, and the one-account script printsn/afor them. While no account has usage at all, Waybar showsn/awith thependingclass and SwiftBar showsAT n/a, never a percentage. Wait for Agent Tank to refresh, or look at the dashboard for anerror. jq: command not found. Installjqwith your package manager. In SwiftBar and xbar, check that its directory is in thePATHline of the script.
Once usage is in view, how to avoid running out of limits mid-task has ideas for acting on it before a window fills. To read it on demand instead, see reading usage from a script or VS Code task.
Sources
Every plan name, number and limit behaviour above links to one of these official pages.
- Claude Code /usage command: code.claude.com/docs/en/commands (checked )
- Codex CLI /status shows remaining limits: learn.chatgpt.com/docs/pricing (checked )
- Antigravity CLI /usage: antigravity.google/docs/cli/reference (checked )