Environment Variables
Override any YeePilot configuration setting using environment variables
Overview
Every YeePilot configuration option can be overridden using environment variables. This is useful for CI/CD pipelines, containerized deployments, temporary overrides, and keeping secrets out of config files.
Environment variables always take precedence over values in ~/.yeepilot/config.yaml.
Naming Convention
Environment variables follow a consistent pattern:
- Start with the
YEEPILOT_prefix. - Convert the config key to UPPERCASE.
- Replace dots and nested keys with underscores.
Examples
| Config Key | Environment Variable |
|---|---|
ai.provider | YEEPILOT_AI_PROVIDER |
ai.model | YEEPILOT_AI_MODEL |
ai.api_key | YEEPILOT_AI_API_KEY |
ai.max_tokens | YEEPILOT_AI_MAX_TOKENS |
ai.token_mode | YEEPILOT_AI_TOKEN_MODE |
security.mode | YEEPILOT_SECURITY_MODE |
sandbox.enabled | YEEPILOT_SANDBOX_ENABLED |
sandbox.use_namespaces | YEEPILOT_SANDBOX_USE_NAMESPACES |
personality.language | YEEPILOT_PERSONALITY_LANGUAGE |
tui.theme | YEEPILOT_TUI_THEME |
update.auto_check | YEEPILOT_UPDATE_AUTO_CHECK |
Configuration Precedence
When the same setting is defined in multiple places, YeePilot resolves them in this order (highest priority first):
- Environment variables -- Always win.
- Config file (
~/.yeepilot/config.yaml) -- Used if no env var is set. - Built-in defaults -- Used if neither env var nor config file value exists.
# This overrides whatever is in config.yaml
export YEEPILOT_AI_PROVIDER=anthropic
export YEEPILOT_AI_MODEL=claude-sonnet-4-20250514
yeepilot runCommon Environment Variables
AI Provider Settings
# Select provider and model
export YEEPILOT_AI_PROVIDER=openai
export YEEPILOT_AI_MODEL=gpt-4o
# API key (preferred over config file for security)
export YEEPILOT_AI_API_KEY=sk-...
# Custom API endpoint (e.g., for local models)
export YEEPILOT_AI_BASE_URL=http://localhost:11434/v1
# Token management
export YEEPILOT_AI_MAX_TOKENS=8192
export YEEPILOT_AI_TOKEN_MODE=saver
# Agent and thinking
export YEEPILOT_AI_AGENT_MODE=true
export YEEPILOT_AI_THINK_MODE=medium
export YEEPILOT_AI_AUTONOMY_PROFILE=strict_reviewSecurity Settings
# Security posture
export YEEPILOT_SECURITY_MODE=strict
export YEEPILOT_SECURITY_REQUIRE_CONFIRMATION=true
# Audit log location
export YEEPILOT_SECURITY_AUDIT_LOG_PATH=/var/log/yeepilot/audit.logSandbox Settings
# Disable namespaces (useful on macOS or restricted environments)
export YEEPILOT_SANDBOX_USE_NAMESPACES=false
# Adjust resource limits
export YEEPILOT_SANDBOX_MAX_CPU_SECONDS=600
export YEEPILOT_SANDBOX_MAX_MEMORY_MB=1024Personality and Display
# Language and tone
export YEEPILOT_PERSONALITY_LANGUAGE=de
export YEEPILOT_PERSONALITY_TONE=professional
export YEEPILOT_PERSONALITY_VERBOSITY=brief
# TUI theme
export YEEPILOT_TUI_THEME=darkDirect API Key Variables
In addition to YEEPILOT_AI_API_KEY, YeePilot also recognizes the standard API key environment variables used by each provider:
| Variable | Provider |
|---|---|
OPENAI_API_KEY | OpenAI |
ANTHROPIC_API_KEY | Anthropic |
OPENROUTER_API_KEY | OpenRouter |
These work without the YEEPILOT_ prefix and are checked automatically when no other API key is configured.
# These are equivalent for OpenAI:
export YEEPILOT_AI_API_KEY=sk-abc123
# or
export OPENAI_API_KEY=sk-abc123If both YEEPILOT_AI_API_KEY and a provider-specific variable are set, YEEPILOT_AI_API_KEY takes precedence.
Practical Examples
Temporary Provider Switch
Switch to a different provider for a single session without changing your config file:
YEEPILOT_AI_PROVIDER=anthropic \
YEEPILOT_AI_MODEL=claude-sonnet-4-20250514 \
ANTHROPIC_API_KEY=sk-ant-... \
yeepilot runProduction Server Lockdown
Set strict security via environment for all users on a shared server:
# Add to /etc/environment or /etc/profile.d/yeepilot.sh
export YEEPILOT_SECURITY_MODE=strict
export YEEPILOT_AI_AUTONOMY_PROFILE=strict_review
export YEEPILOT_SANDBOX_ENABLED=true
export YEEPILOT_SANDBOX_USE_NAMESPACES=true
export YEEPILOT_SANDBOX_NETWORK_ACCESS=falseCI/CD Pipeline
Use YeePilot in a non-interactive pipeline:
export YEEPILOT_AI_PROVIDER=openai
export YEEPILOT_AI_MODEL=gpt-4o-mini
export OPENAI_API_KEY="${OPENAI_SECRET}"
export YEEPILOT_SECURITY_MODE=strict
export YEEPILOT_AI_AUTONOMY_PROFILE=high
yeepilot exec "check disk usage and report servers over 80%"Cost-Conscious Configuration
Minimize token usage and API costs:
export YEEPILOT_AI_TOKEN_MODE=saver
export YEEPILOT_AI_MAX_TOKENS=2048
export YEEPILOT_AI_CONVERSATION_MAX_HISTORY=5
export YEEPILOT_AI_OUTPUT_TRUNCATE_LENGTH=200Shell Configuration
To make environment variables persist across sessions, add them to your shell profile:
Bash
# Add to ~/.bashrc or ~/.bash_profile
export YEEPILOT_AI_PROVIDER=openai
export OPENAI_API_KEY=sk-...Zsh
# Add to ~/.zshrc
export YEEPILOT_AI_PROVIDER=openai
export OPENAI_API_KEY=sk-...Fish
# Add to ~/.config/fish/config.fish
set -gx YEEPILOT_AI_PROVIDER openai
set -gx OPENAI_API_KEY sk-...After editing, reload your shell or run source ~/.bashrc (or the equivalent for your shell).
Dev Mode
The YEEPILOT_DEV_MODE variable is a special case. It only takes effect when used with a development build of YeePilot (compiled with the dev build tag). Production binaries ignore this variable entirely.
# Only works with dev builds
export YEEPILOT_DEV_MODE=1This is used by contributors during development and is not relevant for normal usage.
Verifying Your Configuration
To see which settings are active (including environment variable overrides), run:
yeepilot statusThis displays the current provider, model, security mode, and other active settings, showing where each value comes from.