Last updated · 8 min read

Plans and limits change often. Numbers here were checked on the dates listed under Sources; always confirm on the provider’s own pages.

Before you start

Everything here reads Agent Tank’s local API, so you need:

  • Agent Tank running on the same machine, at http://127.0.0.1:3456 by default. Getting started installs it.
  • curl and jq on your PATH.
  • Optional: TANK_URL. The scripts read the base URL from this variable and fall back to the default. It is the scripts’ own variable, not an Agent Tank setting.

The scripts send no credentials. If you started Agent Tank with an auth option, add the -u or Authorization option to each curl call, as authentication shows. Save each script under ~/.local/bin/ and make it executable with chmod +x.

This script calls GET /status, or GET /status/:id when you pass an account id, and prints one line per window:

~/.local/bin/agent-tank-usage.sh
#!/bin/sh
# Every window with its usage, pace and reset, e.g.
# "claude · Current session: 25% used, pace 0.42, resets 2026-10-17T14:00:00.000Z".
# Usage: agent-tank-usage.sh [id]   (every account without an id)
URL="${TANK_URL:-http://127.0.0.1:3456}"
path="/status${1:+/$1}"
json=$(curl -sf --max-time 2 "$URL$path") || {
  echo "No answer from $URL$path: is Agent Tank running, and is the id right?" >&2
  exit 2
}
printf '%s' "$json" | jq -r '
  (.providers // [.])[]
  | if (.windows | length) == 0 then "\(.id): no usage yet (status \(.status))"
    else .id as $id | .windows[]
      | "\($id) · \(.label): \(.used_percent)% used, pace \(.pace.ratio // "n/a"), resets \(.resets_at // "unknown")"
    end'

For the Claude account in Agent Tank’s synthetic sample, agent-tank-usage.sh claude prints:

Output (synthetic sample)
claude · Current session: 25% used, pace 0.42, resets 2026-10-17T14:00:00.000Z
claude · Current week (all models): 28% used, pace 0.92, resets 2026-10-22T09:00:00.000Z
claude · Current week (Fable): 15% used, pace 0.49, resets 2026-10-22T09:00:00.000Z

An account that has not been refreshed yet prints “no usage yet” with its status instead of a percentage, so missing data never looks like unused allowance. If Agent Tank does not answer, or the id is unknown, the script says so on stderr and exits with code 2. The pace figure is explained in how fast am I using my Claude Code limit.

Check headroom before a long job

Before you start something that will run for an hour, it helps to know the account has room for it. This script checks one account and sets its exit code accordingly. The second argument is the minimum share left in every window, in percent; it defaults to 20:

~/.local/bin/agent-tank-headroom.sh
#!/bin/sh
# Exit 0 when every window of an account has at least MIN% left (default 20),
# 1 when one has less, and 2 when Agent Tank does not answer or has no usage yet.
# Usage: agent-tank-headroom.sh <id> [min-remaining]
URL="${TANK_URL:-http://127.0.0.1:3456}"
ID="${1:?usage: agent-tank-headroom.sh <id> [min-remaining]}"
MIN="${2:-20}"
json=$(curl -sf --max-time 2 "$URL/status/$ID") || {
  echo "$ID: no answer from Agent Tank at $URL" >&2
  exit 2
}
low=$(printf '%s' "$json" | jq -r --argjson min "$MIN" '
  if (.windows | length) == 0 then "pending"
  else .windows[] | select(.remaining_percent < $min)
    | "  \(.label): \(.remaining_percent)% left, resets \(.resets_at // "unknown")"
  end') || exit 2
case "$low" in
  "") echo "$ID: every window has at least $MIN% left" ;;
  pending) echo "$ID: no usage yet; wait for the first refresh" >&2; exit 2 ;;
  *) printf '%s: less than %s%% left in\n%s\n' "$ID" "$MIN" "$low" >&2; exit 1 ;;
esac
Exit codeMeaning
0Every window of the account has at least the minimum left.
1At least one window has less; the script lists them on stderr.
2Agent Tank did not answer, the id is unknown, or the account has no usage yet.

Because a failed check exits non-zero, the shell’s && runs the job only after a passing one:

# Start the job only while every Claude window has at least 20% left
~/.local/bin/agent-tank-headroom.sh claude 20 && ./long-job.sh

The script counts every window of the account, including model-specific ones such as Claude’s weekly Fable window. If a job does not use that model, add select(.model == null) | in front of the select(.remaining_percent …) step so only the all-models windows count. A pending account is treated as a failure, not a pass, for the same reason as above. How to avoid running out of limits mid-task has more on planning around resets.

A VS Code task, no extension

VS Code can run any shell command as a task from Terminal › Run Task…. Put this in .vscode/tasks.json in your workspace, or merge the two entries into an existing file:

.vscode/tasks.json
{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Agent Tank: show usage",
      "type": "shell",
      "command": "~/.local/bin/agent-tank-usage.sh",
      "problemMatcher": [],
      "presentation": { "reveal": "always", "panel": "dedicated", "clear": true }
    },
    {
      "label": "Agent Tank: check Claude headroom",
      "type": "shell",
      "command": "~/.local/bin/agent-tank-headroom.sh claude 20",
      "problemMatcher": [],
      "presentation": { "reveal": "always", "panel": "dedicated", "clear": true }
    }
  ]
}

“Agent Tank: show usage” prints every account’s windows in a dedicated terminal panel; “Agent Tank: check Claude headroom” runs the check and shows its result. "problemMatcher": [] tells VS Code not to scan the output for build errors. The commands call the scripts from the sections above by path, so install those first; as written, they suit Linux and macOS, where VS Code runs shell tasks in a POSIX shell.

If you only use Claude Code, its own extension covers part of this: In the VS Code extension, /usage opens the Account & usage dialog, which shows your signed-in account and your usage; on a claude.ai plan that means usage bars for your plan’s limits, such as the current session and the week1. The task is for seeing every agent and account at once, including Codex and Antigravity, from the same place.

CI and cron with --once --json

The scripts above need Agent Tank running as a server. For a scheduled job you may prefer a single run. --once: Fetch usage once and exit, without starting the HTTP server. Auto-refresh and keepalive are off for the run. --json: Print pure JSON ({ "providers": [...] }) and suppress logging. Use with --once. The output is the same body as GET /status (see one-shot JSON), so the same jq filters work on it.

This line exits 1 when any window is above 90 percent used, so a CI step or a shell && can gate on it:

agent-tank --once --json | jq -e '[.providers[].windows[] | select(.used_percent > 90)] | length == 0'

And this crontab entry keeps the latest snapshot in a file and appends to a log when the check fails, from the cron example on the API page:

crontab
# crontab -e: every 30 minutes, keep the latest snapshot and log when a window is above 90%
*/30 * * * * agent-tank --once --json > ~/.cache/agent-tank.json && jq -e '[.providers[].windows[] | select(.used_percent > 90)] | length == 0' ~/.cache/agent-tank.json > /dev/null || echo "$(date -Is) Agent Tank check failed or a window is above 90 percent" >> ~/.cache/agent-tank-alerts.log

A one-shot run reads the CLIs on the machine it runs on, so the requirement is the same as for the server: at least one supported CLI installed and authenticated on your PATH (claude, agy, or codex). That makes it a fit for your own workstation or a self-hosted runner where you are signed in, not a shared CI service.

Troubleshooting

  • Exit code 2 straight away. Agent Tank is not running, TANK_URL points at the wrong port, or the id is not one of yours. agent-tank-usage.sh with no argument lists the ids it can see.
  • “no usage yet”. Agent Tank has not finished its first refresh for that account. Wait a moment, or open the dashboard to see whether the account shows an error.
  • The VS Code task says “command not found”. The script is not at the path in tasks.json, or it is not executable. Run the same command in VS Code’s terminal to see the shell’s own message.
  • Numbers look old. Reading the API never triggers a refresh; Agent Tank refreshes on its own schedule. Check last_updated on the account.

Which fields the scripts read

Every provider has the same shape, so the scripts have no Claude-, Codex- or Antigravity-specific code. They read only these fields:

  • id (provider): Configured account id (the alias for multi-account setups); the key used by /status/:id, /history/:id and /refresh/:id.
  • status (provider): "refreshing" while a refresh is running and "error" when the last refresh failed, even if windows still holds cached usage. "pending" before the first refresh and "ok" otherwise.
  • 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.
  • remaining_percent (window): Always 100 - used_percent, so the two add up to 100. Antigravity's reported remaining percentage is kept as-is and used_percent is derived from it.
  • resets_at (window): Reset time in ISO 8601; null when unknown, such as an Antigravity limit reporting "Quota available".
  • pace (window): Pace signal for the window; null when there is no pace signal.

Every other field, such as resets_in_seconds or model, is listed under Window in the API reference. To show usage all the time rather than on demand, put it in your status bar with tmux, Waybar or SwiftBar.

Sources

Every plan name, number and limit behaviour above links to one of these official pages.

  1. Claude Code VS Code extension Account & usage dialog: code.claude.com/docs/en/vs-code (checked )