The CLI SHALL call GET https://zenmux.ai/api/v1/management/subscription/detail with an Authorization: Bearer <key> header for each resolved account and parse the JSON response into typed structures covering plan, currency, base_usd_per_flow, effective_usd_per_flow, account_status, quota_5_hour, quota_7_day, and quota_monthly. Accounts MUST be fetched sequentially in the order they were resolved. A failure on one account MUST NOT abort fetches for the remaining accounts.
zenmux-usage with exactly one resolved accountAuthorization: Bearer <key> and parses success: true into typed structszenmux-usage with accounts personal then work resolvedpersonal, then work, rendering each as soon as its response is availablezenmux-usage --timeout 2s and a server has not responded within 2 secondsIn human output mode the CLI SHALL render, for each resolved account, one labeled row per window (5 hour, 7 day, month). Each row MUST include a fixed-width progress bar, the usage percentage to two decimals, the used-vs-max flows, and the used-vs-max USD value when the API provides them. Bars MUST be color-coded by usage band: green below 60%, yellow from 60% through 85%, red above 85%. The monthly window MUST render the max_flows and max_value_usd values and display — (em-dash) in place of used values since the API does not return used_* fields for that window.
quota_5_hour.usage_percentage = 0.0715, used_flows = 57.2, max_flows = 800, used_value_usd = 1.88, max_value_usd = 26.26 for an account5 hour, a green-colored bar roughly 7% filled, 7.15%, 57.2 / 800 flows, and $1.88 / $26.26quota_monthly with only max_flows and max_value_usd populated— in place of used flows and used USD, and shows the max_flows and max_value_usd valueszenmux-usage --no-color--no-color flagFor every resolved account the CLI SHALL print, before the quota rows, a header that identifies the account by name followed by a plan/status line. The account header MUST be visually distinct (e.g., ━━━ <name> ━━━ with bold styling when colors are enabled). The plan line MUST include the plan tier (capitalized), the monthly amount_usd, the account_status, and the effective_usd_per_flow rate.
personal returns plan.tier = "ultra", plan.amount_usd = 200, account_status = "healthy", effective_usd_per_flow = 0.03283personal, and a plan line containing Ultra plan, $200/mo, healthy, and $0.03283/flowpersonal and work are rendered in human modeBelow each account's three quota rows the CLI SHALL print a summary line labeled "Tokens consumed (estimated USD value)" showing the used_value_usd from the 7-day window for that account, formatted as USD to two decimals.
quota_7_day.used_value_usd = 13.66Tokens consumed (estimated USD value): $13.66When invoked with --json the CLI SHALL write machine-readable JSON to stdout and MUST NOT print any human-formatted output.
{"account": <name>, "success": <bool>, "data": <API data object or null>, "error": <string or null>} in the order accounts were resolved. Successful accounts MUST have error: null; failed accounts MUST have data: null and a human-readable error string.Exit codes behave identically to human mode.
zenmux-usage --json | jq .data.plan.tierjq receives valid JSON and extracts the plan tier from data.plan.tierpersonal and work are resolved and work returns HTTP 429personal element has success: true and a populated data field; the work element has success: false, data: null, and a non-null errorThe CLI SHALL exit with these codes and write a single human-readable line to stderr for CLI-global failures:
2 — invalid flag or argument (including unknown --account name)3 — no account resolvable (missing config and env, or explicit --config file missing)4 — authentication rejected (HTTP 401 or 403) — only when every fetched account failed with this cause5 — rate limited (HTTP 422) — only when every fetched account failed with this cause6 — network error or timeout — only when every fetched account failed with this cause7 — config file parse error or schema validation failure1 — any other unexpected error, or a mix of failure causes across accounts, or at least one account failed while others succeededOn success: false in a response body the CLI SHALL treat that account as a failure and surface any error message from the payload.
personal returns 200 and account work returns 401--account work, --api-key, or env-var fallback) fails with HTTP 401