Overview
CodexBar stores all provider configurations in a single JSON file at~/.codexbar/config.json. This file contains:
- Provider enable/disable toggles
- Authentication credentials (API keys, cookies)
- Source mode preferences (CLI, web, OAuth, API)
- Provider-specific settings (region, workspace ID)
File Location
- Path:
~/.codexbar/config.json - Permissions:
0600(enforced on macOS and Linux) - Auto-created: If missing, CodexBar creates it with default settings
Schema
Root Structure
| Field | Type | Required | Description |
|---|---|---|---|
version | number | Yes | Config schema version (currently 1) |
providers | array | Yes | List of provider configurations |
Provider Configuration
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Provider identifier (see Provider IDs) |
enabled | boolean | No | Enable/disable provider (defaults to provider default) |
source | string | No | Preferred source mode: auto, web, cli, oauth, api |
cookieSource | string | No | Cookie policy: auto (browser import), manual, off |
cookieHeader | string | No | Raw cookie header for manual cookie mode |
apiKey | string | No | API token for providers with API support |
region | string | No | Provider-specific region (e.g., zai, minimax) |
workspaceID | string | No | Workspace identifier (e.g., opencode) |
tokenAccounts | object | No | Multi-account token data (see Token Accounts) |
Provider IDs
Valid provider identifiers:Provider order in the
providers array controls display order in the app and CLI. Reorder the array to change menu bar icon sequence.Source Modes
| Mode | Description | Availability |
|---|---|---|
auto | Uses provider-specific fallback order | All providers |
web | Force browser cookie authentication | Web-capable providers |
cli | Force CLI tool invocation | CLI-capable providers |
oauth | Force OAuth flow | Claude, Gemini, Copilot |
api | Force API key authentication | Providers with API support |
auto is selected. See individual provider docs for details.
Cookie Sources
| Source | Description | Use Case |
|---|---|---|
auto | Import cookies from browsers automatically | Default for most users |
manual | Use cookieHeader field | Browser import fails or unsupported browser |
off | Disable cookie-based authentication | Use CLI or OAuth instead |
Manual Cookie Header Format
When usingcookieSource: "manual", provide the raw cookie header:
Token Accounts
Some providers support multiple accounts with separate tokens (e.g., OpenRouter, Synthetic).Schema
| Field | Type | Required | Description |
|---|---|---|---|
version | number | Yes | Token accounts schema version (currently 1) |
activeIndex | number | Yes | Index of the active account in the accounts array |
accounts | array | Yes | List of account objects |
Account Object
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique UUID for the account |
label | string | Yes | Display name (typically email) |
token | string | Yes | API token or bearer token |
addedAt | number | Yes | Unix timestamp when account was added |
lastUsed | number | No | Unix timestamp of last use |
Examples
Minimal Configuration
Default providers with no customization:Codex with Manual Cookie
Claude with OAuth and CLI Fallback
OAuth credentials are stored in Keychain, not in
config.json. The source field only controls the preferred authentication method.z.ai with API Token and Region
OpenCode with Workspace ID
Multiple Providers with Custom Order
OpenRouter with Multi-Account Tokens
Editing the Config File
Via Settings UI
Most settings can be changed through Settings → Providers:- Enable/disable toggles
- Source mode selection
- Cookie source selection
- API key entry
- Region and workspace ID fields
config.json.
Manual Editing
- Quit CodexBar
- Open
~/.codexbar/config.jsonin a text editor - Make changes (see examples above)
- Validate JSON syntax
- Relaunch CodexBar
Validating the Config
Use the CLI to validate your config:Config Normalization
CodexBar normalizes the config on load:- Adds missing providers: Any provider not in the
providersarray is appended with defaults - Removes duplicates: If a provider appears multiple times, only the first occurrence is kept
- Applies defaults: Omitted fields use provider-specific defaults
- Cleans sensitive fields: Trims whitespace and removes surrounding quotes from
apiKeyandcookieHeader
Migration from Legacy Storage
CodexBar previously stored credentials in Keychain and UserDefaults. Starting with v2.0, all credentials are migrated toconfig.json.
What gets migrated:
- Keychain-stored API tokens (z.ai, Copilot, OpenRouter, Synthetic, etc.)
- Keychain-stored cookie headers (Codex, Claude, Cursor, Factory, etc.)
- UserDefaults provider toggles and source modes
- OAuth tokens (Claude OAuth, Gemini OAuth)
- Browser safe storage keys (for automatic cookie decryption)
Backup and Restore
Backing Up
Restoring
Resetting to Defaults
Troubleshooting
Config file is missing or empty
Config file is missing or empty
Symptom: CodexBar shows no providers or “Failed to load config”Solution:
- Check that
~/.codexbar/directory exists - Check file permissions:
ls -la ~/.codexbar/config.json - Recreate with:
codexbar config validate(generates default config if missing)
Changes don't persist after editing
Changes don't persist after editing
Symptom: Manual edits to
config.json are lost after relaunching CodexBarSolution:- Ensure CodexBar is fully quit (check Activity Monitor)
- Verify JSON syntax with:
python3 -m json.tool ~/.codexbar/config.json - Check that file isn’t read-only:
ls -la ~/.codexbar/config.json - If permissions are wrong:
chmod 600 ~/.codexbar/config.json
API key or cookie not working
API key or cookie not working
Provider order doesn't match config
Provider order doesn't match config
Symptom: Menu bar icons appear in wrong order despite correct
providers array orderSolution:- Verify the order in
config.json - Restart CodexBar (Quit → Relaunch, not just closing the menu)
- Check Settings → Providers for the order
- If still wrong, delete
config.jsonand reconfigure
