Features

Usage of every account

By jhyunwoo
Last updated November 29, 2026
Checked with ccam 0.16.1 and Claude Code 2.1.302

On this page

ccam usage shows, for every account at once, how much of each limit is used: the 5-hour limit, the weekly limit and each model's own weekly limit (such as Fable). Use it before you start a long task, or when Claude Code says a limit is near, to see which account has room left. ccam statusline puts the account name and its usage in Claude Code's status line while you work. For the tokens and estimated costs behind the usage, ccam ccusage runs ccusage over every account's conversations (below).

Usage

Every account at once

ccam usage
ccam u

ccam usage, or ccam u for short, looks up every account and shows how much of each limit it has used. It takes no arguments, and it accepts --dry-run, since it changes nothing but its own cache.

$ ccam usage
 1 personal  9h 36m ago (cached)
   5-hour   ░░░░░░░░░░░░░░░░░░░░   0%
   Weekly   ██████████████░░░░░░  70%  resets in 2d 16h
   Fable    ██░░░░░░░░░░░░░░░░░░  12%  resets in 2d 16h
 2 work      just now (cached)
   5-hour   █████░░░░░░░░░░░░░░░  24%  resets in 2h 29m
   Weekly   ████████░░░░░░░░░░░░  41%  resets in 3d 11h
   Fable    ███████████░░░░░░░░░  55%  resets in 5d 2h
 3 side      access token expired; `ccam side` renews it when it starts
→ Most headroom: personal   (open it with ccam next --auto)

Each account gets a line with its number, its name and how old its numbers are; (cached) means they come from a saved file, not from the endpoint. Under it, one line per limit shows a 20-cell bar, the percentage and the time until the window resets: 5-hour, Weekly (all models), then each model's own weekly window, such as Fable. A window the account does not have shows -. A percentage turns yellow at 80% and red at 100%. On a terminal every account appears at once as fetching…, and its lines are drawn as it answers.

If Claude Code refused a request because a window was full, that window shows 100% until it resets, unless a lookup at least 5 minutes after the limit shows room in it again (the limit record).

An account that is not logged in shows not logged in → ccam login <name>, and an API key account shows no limits (API). Expired logins are below.

The last line, shown only when you have more than one account, names the account ccam next --auto would open, by nearly the same rules: auto_max_usage, auto_strategy, the running sessions and the organization of the account you used last, and never an account with a window at 100% (How ccam picks an account). Unlike ccam next --auto, it does not check the login, so it can name an account whose login has expired. With the default headroom strategy it reads → Most headroom: <name>; with expiring or balance it gives the reason, such as → next --auto picks personal: its 5-hour window resets first, in 1h 12m (40% of its 5 hours used). To go on as that account at a limit, see Continuing at the limit and Automatic switching.

Watching the numbers

ccam usage --watch
ccam usage --watch=10

--watch draws the report again every 60 seconds until you press Ctrl+C, and --watch=10 every 10 seconds. A value of 0 or less also means 60. The value goes after =: --watch 10 is refused with a hint.

Details and JSON

ccam usage -v
ccam usage --json

-v (--verbose) adds a source: line under each account: where its numbers came from (the usage endpoint, Claude Code, the status line, a saved file, or the usage limit Claude Code reported). When a limit record overrides the numbers, a line such as Weekly full: Claude Code reported the usage limit 1h 0m ago, so 100% until the reset follows.

--json prints the reports as JSON for scripts: name, slot, status, limits (with credits when the account has usage credits on), source, at, error, and limited and limited_windows when a limit record sets windows to 100%. With no accounts it prints [].

Choosing where the numbers come from

ccam usage --source cache
ccam usage --source claude
ccam usage --no-cache

--source decides how ccam gets the numbers:

  • live asks the usage endpoint with each account's login. It is the default unless usage_source in config.toml says otherwise.
  • claude has Claude Code look the usage up, so ccam sends no token (below).
  • cache shows the saved numbers only and makes no network request.

Any other value fails with --source must be live, claude or cache. A lookup younger than 60 seconds is used again instead of asking anew; --no-cache asks again anyway, except for an account the endpoint has told to wait after too many requests (Where the numbers come from).

Usage from Claude Code itself

With usage_source = "claude" at the top of config.toml (above the first [[group]], [[profile]] or [[folder]]), or --source claude, ccam does not read the login token at all. For each account it starts claude -p --input-format stream-json --output-format stream-json --verbose --safe-mode --no-session-persistence in the account's folder and sends Claude Code's get_usage request on standard input (Claude Code 2.1.270 or later). Claude Code looks the usage up with its own login and answers with the 5-hour, weekly and model windows.

--safe-mode keeps the account's hooks, MCP servers and plugins from starting, and no session is saved. Each account needs one Claude Code start (about a second), so this source is slower than live. The accounts are asked at once, each with a 20-second timeout, and the 60-second cache applies as usual.

A login whose access token has expired, or expires within 5 minutes, gets 50 seconds, since Claude Code renews it as it starts and a renewal cut off may lose the login. If ccam gives up on a lookup, it asks Claude Code to exit with SIGTERM, so Claude Code finishes a renewal it has started (Windows has no SIGTERM, so there the process is terminated).

A login that has fully expired shows login expired → `ccam login <name>` without starting Claude Code. Claude Code marks the request as experimental, so if it stops answering, ccam shows the saved numbers and ccam doctor reports it. When Claude Code answers that its own lookup failed, ccam shows the saved numbers with the usage endpoint gave Claude Code no usage (it may be refusing lookups for now), not a plan without limits.

With --dry-run, ccam does not start Claude Code, because Claude Code writes to the account's folder; it shows the saved numbers instead. usage_source takes live or claude; cache is a --source choice only.

Expired logins

An access token lasts a few hours, and Claude Code renews it when it starts. ccam does not renew it for you, because renewing a login while a Claude Code session uses it could sign that session out. An account whose access token has expired shows access token expired; `ccam <name>` renews it when it starts, above its saved numbers if it has any: start it once with ccam <name> and Claude Code renews the token. A login that has fully expired, because its refresh token expired or Claude Code cleared it after the server refused it, shows login expired → `ccam login <name>` and needs a new login.

ccam usage --refresh

--refresh renews expired access tokens itself, but only for accounts with no running Claude Code session, however that session was started. It never renews logins stored in the macOS Keychain or in an imported ~/.claude, and a renewal may take up to 30 seconds (Renewing tokens). It cannot be combined with --dry-run, because it rewrites login tokens: --dry-run cannot be combined with --refresh, which rewrites login tokens.

Usage in the status line

ccam statusline install

Claude Code then shows the account name and its usage in the status line, for example [work] · Opus · 5h 24% · 7d 41%. From 90% on, the line also suggests → ccam next --auto --continue, unless it wraps a status line command of your own. If an account already has a status line command, ccam keeps it and puts the account name in front. The status line also saves its numbers, which ccam usage uses when the endpoint does not answer (the status line collector).

ccam statusline install takes no options. It writes the command ccam statusline into every account's settings.json. That command reads Claude Code's status line JSON from standard input, and its one option is --wrap <command>: an existing status line command whose first output line gets the account name in front. Both refuse --dry-run with --dry-run is not supported by `ccam statusline`; nothing was changed.

Tokens and costs: ccam ccusage

ccam usage shows how much of each limit an account has used. ccusage counts the tokens and estimated costs in Claude Code's conversation logs instead. On its own it looks for Claude Code's logs only in ~/.claude and ~/.config/claude (or the folders CLAUDE_CONFIG_DIR names), so the only ccam account it can see is one imported in place at ~/.claude. ccam ccusage runs it with CLAUDE_CONFIG_DIR set to the folders of every account that has conversations, so one report covers them all:

ccam ccusage
ccam ccusage daily --breakdown
ccam ccusage claude monthly --json

ccam ccusage alone prints ccusage's daily report over every account. ccam reads its own options first, and from the first other argument on, everything goes to ccusage as you typed it: daily --breakdown adds the cost per model, and claude monthly --json covers Claude Code alone, by month, as JSON. ccam ccusage -- --help shows ccusage's own help. The one argument ccam may change is --config, for bun x and npx (below).

ccam ccusage -a work blocks --active
ccam ccusage -a work,side weekly

-a (--account) limits the report to the accounts you name, by name or number, comma-separated or repeated. blocks --active shows the current 5-hour block, and each account has its own, so name one account for it.

ccam runs ccusage if it is installed, otherwise bun x ccusage, and failing that npx ccusage@latest; the last two fetch it from npm. They start in ccam's own folder (~/.local/state/ccam/ccusage), not in the folder you are in, so a project there cannot choose what they run with its node_modules/.bin, a bin in its package.json or a registry in its .npmrc. ccam --dry-run ccusage prints the command it would run, with the cd into that folder, instead of running it. When none of them is available, it tells you to install Node.js, Bun or ccusage. On Linux and macOS ccusage takes ccam's place; on Windows ccam waits for it and ends with its exit code. Under WSL, ccam skips a ccusage, bun or npx on a Windows drive, which would run as a Windows program without the account folders.

  • The report covers the accounts whose folders have conversations (a projects folder). A conversation that accounts share through a group counts once.
  • With -a, an account that shares its history through a group brings the whole group's conversations, and ccam says whose: ccam: work shares its conversation history with personal, so the report counts their conversations too.
  • ccusage also reports the other coding tools it finds, such as Codex, unless you name one: ccam ccusage claude daily is Claude Code alone.
  • While ccam runs it, ccusage reads its settings (ccusage.json) only from ./.ccusage and the account folders. --config names another file: ccam ccusage daily --config ~/.config/claude/ccusage.json. As bun x and npx start in ccam's own folder, ccam passes them ./.ccusage/ccusage.json with --config when that file exists and you name none, and gives a relative --config as a full path. ccusage then reads other relative paths, such as --pi-path, from ccam's folder, so give those in full.
  • ccusage would read a folder whose path has a comma as two folders, so ccam refuses it and names the account; leave that account out with -a.
  • ccusage is a ccam command, so an account named ccusage starts with ccam run ccusage; ccam doctor says so.

How it works

Where the numbers come from

The numbers come from three places:

  • Anthropic's usage endpoint, GET https://api.anthropic.com/api/oauth/usage, called with each account's own login. It is not publicly documented and may change; ccam doctor tells you when its format changes.
  • The values Claude Code hands to its status line command, which ccam statusline saves.
  • Claude Code's own lookup, with usage_source = "claude" (above).

ccam looks up every account at once, each in its own lookup, and redraws an account's lines as soon as it answers. Connecting may take 2 seconds, and each account gets 3 seconds in total. An account that fails or does not answer in time shows its saved numbers, so one slow account never holds up the others. ccam does not follow redirects, since a redirect would send the token somewhere else, and reads at most 1 MB of an answer.

personal and work answer in time and show live numbers. side takes longer than 3 seconds, so ccam shows its saved numbers instead. ccam then draws a block per account and picks the account named on the last line.

For one account, ccam makes these checks in order:

  1. With --source cache, it goes straight to the saved numbers.
  2. Unless --no-cache is set, a live result in ~/.local/state/ccam/usage/<name>.json measured less than 60 seconds ago is used, judged as of now: a window that has reset since shows 0%, and a file dated ahead of the clock does not count as fresh. Running ccam usage twice in a row costs one request per account.
  3. ccam reads the login from .credentials.json (or the macOS Keychain) without changing it, and only its claudeAiOauth part. No subscription login means not logged in, or no limits (API) when .claude.json holds an API key. A login whose refresh token has expired, or that Claude Code cleared, shows login expired → `ccam login <name>` and is not looked up.
  4. An expired access token is not used. Without --refresh, the account shows its saved numbers with access token expired; `ccam <name>` renews it when it starts.
  5. Otherwise ccam calls the endpoint. A 401 or 403 counts as an expired login (login expired: authentication failed (401)), and any other status or an answer it cannot read counts as an error; both fall back to saved numbers. A lookup ended by Ctrl+C says cancelled. A 429 means the endpoint has received too many requests for this account: ccam writes <name>.pause with the time to ask again (Retry-After, or 5 minutes, at most an hour), shows saved numbers with rate limited by the usage endpoint; asking again after 15:10, and does not call the endpoint for that account until then, even with --no-cache. Asking again at once would only prolong the rate limit.
  6. A good answer is written to <name>.json with the time it was measured.

For saved numbers, ccam takes the newest saved lookup (<name>.json, or <name>.claude.json from Claude Code's lookups) and, when <name>.statusline.json was written after it, lays the status line's 5-hour and weekly windows over it; the model windows, which the status line does not have, stay as the lookup saved them. A window that has reset since the numbers were saved shows 0%, because the old percentage no longer holds. That is why personal in the example shows 0% with no reset time.

The endpoint has two answer formats. The newer one has a limits array with session (5-hour), weekly_all and weekly_scoped (per model) entries. The older one has five_hour, seven_day, seven_day_opus and seven_day_sonnet objects. ccam reads both: the limits array wins, and the old objects fill in what it does not cover. An answer with no limits at all is reported as a changed format, which ccam doctor tells you about.

The limit record

When Claude Code stops a turn at a usage limit, the ccam plugin's hook reads the refused request from the conversation: which window was full (5-hour, weekly, Opus, Sonnet or Fable) and when it resets. It writes that to ~/.local/state/ccam/usage/<name>.limit.json. ccam lays the record over whatever else it knows, from every source: each window in it counts as 100% until its reset, however old or low the saved numbers are, so ccam next --auto, ccam pick, --fallback and auto_switch do not choose the account again before then.

A limit can end before its reset time, for example when you use a limit reset (/limit-reset in Claude Code). So a lookup of the usage endpoint, ccam's or Claude Code's, made 5 minutes or more after the limit and showing that window below 100% wins over the record for that window. The status line does not count. The 5 minutes keep an account that was just refused from being chosen again on numbers that do not show the limit yet.

With nothing else known, the record alone is what the account shows (source: the usage limit Claude Code reported with -v). The hook writes no record for unattended sessions (-p runs and background sessions), though ccam agent records the limits its own runs hit, nor does a stop set by an organization (for example, when it is out of usage or a group's limit is $0), which its admins can lift at any time. ccam login into another Claude account drops the record; deleting the file clears it too.

Renewing tokens

Refresh tokens rotate: renewing one gives you a new refresh token and invalidates the old one. If ccam renewed the login while Claude Code was running as the same account, that session would be signed out. So ccam usage reads tokens and never writes them, unless you pass --refresh. Then ccam:

  1. refuses accounts registered in place with ccam import, since plain claude may use that login without ccam knowing;
  2. refuses logins stored in the macOS Keychain;
  3. takes a lock file, ~/.local/state/ccam/locks/profile-<name>.refresh.lock, so two ccam processes never both renew the same token; while it is held, the account shows token not renewed: another ccam process is using this login right now (a refresh, rename, remove or logout). ccam rename, remove and logout take it too, and refuse while a renewal is in progress;
  4. under the lock, refuses if a session of the account is running, however it was started (through ccam, plain claude, an IDE, or a background session and the daemon behind it, which renews the login itself), and skips the request if another process already renewed the token;
  5. sends nothing while Claude Code holds its own renewal locks in the account folder (.oauth_refresh.lock, <folder>.lock): Claude Code is renewing that login right then;
  6. posts the refresh token to the token endpoint and waits up to 30 seconds for the answer, the time Claude Code gives its own renewals. Once sent, a request is never interrupted, even by Ctrl+C: the server may already have rotated the refresh token, and only its response carries the new login. Ctrl+C or a hangup ends the other lookups, and ccam exits (130 after Ctrl+C) once the answer is saved;
  7. saves under Claude Code's write lock (.storage-write.lock) and changes only the token fields of .credentials.json as it is then: what Claude Code wrote meanwhile (an MCP sign-in) stays, a login Claude Code renewed meanwhile is kept, and a logout is never undone. When the answer gives the new refresh token's lifetime, it is stored as refreshTokenExpiresAt, as Claude Code does.

A refresh that does not go through says why, on the account line or above its saved numbers: token not renewed: a session is running, for example, or login may be lost: … when a request was sent but its answer could not be used or saved, with the advice to run ccam login <name> if Claude Code then asks you to log in.

The status line collector

Claude Code runs the status line command and pipes it a JSON document. ccam reads the model name and rate_limits from it:

  1. ccam finds the account from CCAM_PROFILE, which ccam sets when it starts Claude Code, or otherwise by matching CLAUDE_CONFIG_DIR against the account folders.
  2. ccam reads rate_limits.five_hour and rate_limits.seven_day. The JSON has no rate limits for API key accounts, or before the session's first response; then nothing is saved.
  3. ccam writes ~/.local/state/ccam/usage/<name>.statusline.json. ccam usage uses it when the endpoint does not answer.
  4. ccam prints [name] · model · 5h N% · 7d N%. With --wrap, it runs your command through sh -c with the same input and prints its output the way Claude Code shows a status line: every line that is not blank, with [name] in front of the first. A command that fails shows the account name alone. On Windows it runs the command the way Claude Code does: with Git Bash when it is installed, otherwise with PowerShell.
  5. When the 5-hour or weekly usage is at 90% or more and there is another account, the line ends with → ccam next --auto --continue, for example [work] · Opus · 5h 93% · 7d 41% · → ccam next --auto --continue. A wrapped command's output gets no such hint.

The wrapped command has no time limit of its own: Claude Code gives a status line command 10 minutes and stops a run when a newer update starts, so a slow command shows as it would without ccam. When Claude Code ends ccam, the command ends too (on Linux and macOS with every process it started).

ccam statusline install writes statusLine into each account's settings.json and keeps the object's other keys, such as padding, refreshInterval and hideVimModeIndicator. When an account already has a status line command, ccam keeps it as --wrap '<old command>'; on Windows as --wrap-base64 <base64>, which needs no quoting in either shell. If the status line already runs ccam (from another path, or quoted the way an older version wrote it), ccam replaces it instead of wrapping it, and keeps the command it wraps.

On Windows the path to ccam is written with forward slashes and ~ for the home folder (~/.local/bin/ccam.exe statusline), which both Git Bash and PowerShell understand. A path that needs quotes is written in full for the shell Claude Code uses: '…' for Git Bash, & '…' for PowerShell. A settings.json shared through a group is written once, through its link, so every account in the group gets it. Running it again prints (already set) for files that already use ccam.

Safety and edge cases

  • ccam usage never changes a token file unless you pass --refresh. When an access token has expired, run the account once with ccam <name> and Claude Code renews it. A login that has fully expired needs ccam login <name>.
  • --refresh never touches running accounts (even when Claude Code was started without ccam), imported accounts or Keychain logins. A refused refresh shows the saved numbers and the reason (token not renewed: …).
  • The usage endpoint is not publicly documented and may change. When it does, you still see saved numbers, and ccam doctor reports the format change.
  • With no saved numbers and no answer, the account line shows lookup failed: and the reason, for example no saved usage with --source cache.
  • The cache files hold only percentages and reset times, never tokens.