Synopsis
usage command (default) fetches current usage data, credits, and account information from AI providers like Codex and Claude. It mirrors the menubar app’s data paths and supports multiple data sources including web, CLI, OAuth, and API.
Parameters
Provider ID to query. Options:
- Specific provider ID (e.g.,
codex,claude,copilot,gemini,kilo,kimi,minimax,warp,openrouter,synthetic,z.ai) both- Query default providers (Codex + Claude)all- Query all enabled providers from config
~/.codexbar/config.json.Output format. Options:
text- Human-readable output with progress bars and ANSI colorsjson- Machine-readable JSON output
Data source strategy. Options:
auto- (macOS only) Uses browser cookies for Codex + Claude, with CLI fallback when cookies are missingweb- (macOS only) Web-only; no CLI fallbackcli- CLI-only (Codex RPC → PTY fallback; Claude PTY)oauth- Claude OAuth only (debug); not supported for Codexapi- API key flow when the provider supports it (z.ai, Gemini, Copilot, Kilo, Kimi K2, MiniMax, Warp, OpenRouter, Synthetic)
web and auto are not supported; CLI exits with error.Output source field reflects the actual strategy used: openai-web, web, oauth, api, local, or provider CLI label.Select a specific token account by label or email. Requires a single
--provider.Token accounts are configured in ~/.codexbar/config.json. For Claude, accounts accept either sessionKey cookies or OAuth access tokens (sk-ant-oat...). OAuth requires the user:profile scope.Select token account by 1-based index. Requires a single
--provider.Fetch data for all configured accounts for the specified provider. Requires a single
--provider.Hide Codex credits in text output.
Pretty-print JSON output with indentation.
Fetch provider status pages and include them in output. Queries status.openai.com, status.anthropic.com, etc.
Debug flag: print Antigravity planInfo fields to stderr.
Timeout in seconds for web data source requests.
Write HTML snapshots to
/tmp when web scraping fails to extract data.Disable ANSI colors in text output. Also honors
NO_COLOR environment variable or TERM=dumb.Emit machine-readable JSONL logs on stderr.
Suppress non-JSON output; errors become JSON payloads.
Enable verbose logging.
Set log level:
trace, verbose, debug, info, warning, error, or critical.Show help message.
Show version information.
Response Fields
JSON Output Structure
Provider ID (e.g.,
codex, claude, copilot).Account identifier when using multi-account tokens.
Provider CLI or API version (e.g.,
0.6.0, 2.0.58).Actual data source used:
openai-web, web, oauth, api, local, or provider-specific CLI label (e.g., codex-cli).Provider status page information (when
--status is used).Usage limits and reset times.
Credits information (Codex, Kilo, etc.).
Antigravity plan information (when available).
OpenAI dashboard snapshot with usage breakdown.
Error information when provider query fails.
Examples
Default usage (text format)
Query specific provider with JSON output
Query all providers
Query with status page data
Query specific account
Query all accounts for a provider
Use API key source
Machine-readable output only
Use web source explicitly
Exit Codes
- 0: Success
- 1: Unexpected failure
- 2: Provider binary not found (not on PATH)
- 3: Parse/format error
- 4: CLI timeout
Notes
Configuration
- CLI reads
~/.codexbar/config.jsonfor provider settings, secrets, and ordering - Enabled providers and their order are respected from config
- Reset times follow the in-app reset time display setting (default: countdown)
Web Data Sources
- Codex web: OpenAI web dashboard (usage limits, credits, code review, usage breakdown)
- Requires signed-in session in Safari, Chrome, or Firefox at
chatgpt.com - No passwords stored; CodexBar reuses browser cookies
- Safari may require Full Disk Access (System Settings → Privacy & Security → Full Disk Access)
openaiDashboardJSON field is normally cached;--source auto|webrefreshes live via WebKit
- Requires signed-in session in Safari, Chrome, or Firefox at
- Claude web: claude.ai API (session + weekly usage, plus account metadata)
- Uses browser cookies or OAuth tokens from config
Text Output
- Uses ANSI colors when stdout is a rich TTY
- Disable colors with
--no-color,NO_COLORenvironment variable, orTERM=dumb - Progress bars show usage percentage visually
- Reset lines show countdown or absolute time based on app preferences
API Keys
- Copilot: Requires
apiKeyin config orCOPILOT_API_TOKENenvironment variable - Kilo: Supports
KILO_API_KEYenvironment variable - Gemini, z.ai, etc.: Configure API keys in
~/.codexbar/config.json
Data Source Priority
- Codex: Prefers RPC, falls back to PTY
- Claude: Defaults to web with CLI fallback when cookies are missing
- Kilo auto: app.kilo.ai API first, then CLI auth fallback (
~/.local/share/kilo/auth.json)
