Skip to content

Latest commit

 

History

History
103 lines (73 loc) · 3.49 KB

File metadata and controls

103 lines (73 loc) · 3.49 KB
summary CodexBar CLI configuration commands for provider toggles, API keys, and isolated config files.
read_when
Using codexbar config from scripts or CI
Enabling or disabling providers without opening Settings
Storing provider API keys from the command line

CLI configuration

codexbar config edits the same resolved config file used by the app's Settings → Providers pane. New installs use ~/.config/codexbar/config.json; absolute XDG_CONFIG_HOME paths and CODEXBAR_CONFIG are supported, and existing ~/.codexbar/config.json installs keep using the legacy file when no XDG config exists. The CLI writes the file with 0600 permissions.

Providers

List persistent provider toggles:

codexbar config providers
codexbar config providers --json --pretty

Enable or disable a provider:

codexbar config enable --provider grok
codexbar config disable --provider cursor

These are persistent app/CLI settings. They are different from codexbar usage --provider grok, which is a one-shot command override and does not edit config.

If every provider is disabled, codexbar usage with no --provider prints no text output, and codexbar usage --json prints []. Passing --provider <name> still fetches that provider for the one command.

API keys

API keys are stored under the provider entry in config:

printf '%s' "$ELEVENLABS_API_KEY" | codexbar config set-api-key --provider elevenlabs --stdin

set-api-key enables the provider by default. Add --no-enable when you only want to save the key:

printf '%s' "$OPENROUTER_API_KEY" | codexbar config set-api-key --provider openrouter --stdin --no-enable

Useful examples:

printf '%s' "$OPENAI_ADMIN_KEY" | codexbar config set-api-key --provider openai --stdin
printf '%s' "$ANTHROPIC_ADMIN_KEY" | codexbar config set-api-key --provider claude --stdin
printf '%s' "$DEEPGRAM_API_KEY" | codexbar config set-api-key --provider deepgram --stdin
printf '%s' "$GROQ_API_KEY" | codexbar config set-api-key --provider groq --stdin
printf '%s' "$LLM_PROXY_API_KEY" | codexbar config set-api-key --provider llmproxy --stdin
printf '%s' "$Z_AI_API_KEY" | codexbar config set-api-key --provider zai --stdin

Only providers that consume config-backed API keys accept this command. Admin API providers may require a key with organization/usage permissions, not a normal inference key. Browser/OAuth providers such as Grok use their own provider sessions instead of an xAI API key for CodexBar's billing view, so enable them with codexbar config enable --provider grok.

LLM Proxy also needs a base URL. Use LLM_PROXY_BASE_URL for CLI runs, or add "enterpriseHost" to the provider entry in the CodexBar config file.

Isolated config files

For tests, demos, and CI, point CodexBar at a temporary config file:

export CODEXBAR_CONFIG=/tmp/codexbar-config.json
codexbar config enable --provider grok
codexbar config providers --json --pretty

The override applies to both reads and writes for the current process environment.

Cost history window

The app setting controls the menu's local cost-history window. For one-off CLI reports, pass --days:

codexbar cost --provider codex --days 90
codexbar cost --provider claude --days 180 --format json --pretty

The accepted range is 1...365 days.

Validation

After hand-editing config:

codexbar config validate
codexbar config dump --pretty

dump prints normalized config, including providers omitted from a hand-written file.