Environment variables
The environment variables that override CommitBrief config keys, plus the few that change runtime behavior, and the precedence between flags, environment, and config.
CommitBrief reads a small set of environment variables — mostly provider API keys, plus a few that adjust runtime behavior. Where a variable overrides a config key, the variable wins for that run; it never writes the key back to a config file.
| Variable | Effect | Config key |
|---|---|---|
ANTHROPIC_API_KEY | Anthropic API credential — overrides providers.anthropic.api_key in config. | providers.anthropic.api_key |
OPENAI_API_KEY | OpenAI API credential — overrides providers.openai.api_key in config. | providers.openai.api_key |
GEMINI_API_KEY | Google Gemini API credential — overrides providers.gemini.api_key in config. | providers.gemini.api_key |
DEEPSEEK_API_KEY | DeepSeek API credential — overrides providers.deepseek.api_key in config. | providers.deepseek.api_key |
MISTRAL_API_KEY | Mistral API credential — overrides providers.mistral.api_key in config. | providers.mistral.api_key |
COHERE_API_KEY | Cohere API credential — overrides providers.cohere.api_key in config. | providers.cohere.api_key |
OLLAMA_HOST | Ollama base URL — overrides providers.ollama.base_url in config UNCONDITIONALLY, even if you set base_url explicitly. | providers.ollama.base_url |
COMMITBRIEF_PROVIDER | Selects the active provider for this run — overrides provider in config. | provider |
COMMITBRIEF_MODEL | Selects the active provider's model for this run — overrides providers.<name>.model in config. | providers.<name>.model |
Precedence
For a setting reachable both ways, the order is the same one every other CommitBrief flag follows:
command-line flag → environment variable → config file → built-in default
An environment variable is a good fit for CI (set once at the job or
org level) and for secrets you don’t want written into a config file.
.commitbrief/config.yml is repo-local and not committed by default,
because .commitbrief/ is added to .gitignore, but an environment
variable keeps a secret out of any file at all. A flag still wins if you
pass one explicitly on that run.
The one exception to “flag wins” is color: NO_COLOR and
COMMITBRIEF_NO_COLOR turn color off even when you pass
--color always.
Variables outside the table
The table above lists the variables that override a config key. A few more are read for behavior that has no config key to point at:
COMMITBRIEF_CONFIG— path of the user-level config file, used instead of~/.commitbrief/config.yml. A relative path is resolved against the current directory.NO_COLOR— when set to any non-empty value, turns color off, overriding--color always.COMMITBRIEF_NO_COLOR— CommitBrief-specific equivalent ofNO_COLOR.LANG/LC_ALL— not used for language selection: language is config-driven (--lang, then repo config, then user config, then English).
See also
- Configuration — the full config file and every config key, including the ones the table above overrides.
- Providers — per-provider setup, including which API key variable each one reads.