Installation
macOS
App Preferences (Recommended)
In the app: Preferences → Advanced → Install CLI. This symlinksCodexBarCLI to /usr/local/bin/codexbar and /opt/homebrew/bin/codexbar.
Repository Script
From the repo:Manual Symlink
Linux
Homebrew (Linuxbrew)
Direct Download
DownloadCodexBarCLI-v<tag>-linux-<arch>.tar.gz from GitHub Releases (x86_64 + aarch64).
Extract and run:
Build from Source
With Package Script
CodexBarCLI into CodexBar.app/Contents/Helpers/CodexBarCLI.
Standalone Build
./.build/release/CodexBarCLI.
Requirements
- Swift 6.2+
- Commander package (
https://github.com/steipete/Commander)
Configuration
CodexBar reads~/.codexbar/config.json for provider settings, secrets, and ordering.
See Configuration for the schema.
Available Commands
The CLI provides several commands for managing and querying usage data:usage
Fetch current usage data (default command)
cost
Print local token cost usage
config validate
Validate config file syntax
config dump
Print normalized config JSON
Global Flags
These flags work with all commands:Display help information
Display version information
Enable verbose logging
Disable ANSI colors in text output
Set log level:
trace, verbose, debug, info, warning, error, criticalEmit JSONL logs on stderr (machine-readable)
Suppress non-JSON output; errors become JSON payloads
Exit Codes
The CLI uses specific exit codes to indicate different failure modes:| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Unexpected failure |
| 2 | Provider missing (binary not on PATH) |
| 3 | Parse/format error |
| 4 | CLI timeout |
Notes
- CLI uses the config file for enabled providers, ordering, and secrets
- Reset lines follow the in-app reset time display setting when available (default: countdown)
- Text output uses ANSI colors when stdout is a rich TTY; disable with
--no-colororNO_COLOR/TERM=dumb - Copilot CLI queries require an API token via config
apiKeyorCOPILOT_API_TOKEN - Prefer Codex RPC first, then PTY fallback; Claude defaults to web with CLI fallback when cookies are missing
- OpenAI web requires a signed-in
chatgpt.comsession in Safari, Chrome, or Firefox. No passwords are stored; CodexBar reuses cookies - Safari cookie import may require granting CodexBar Full Disk Access (System Settings → Privacy & Security → Full Disk Access)
