Configuration
Interactive Setup
cmd setup
This will:
- Let you choose your LLM provider
- Guide you through entering your API key (hidden input)
- Store your credentials securely in the system keychain
Credential Storage
API keys are stored securely in your system’s native credential store:
| Platform | Storage |
|---|---|
| macOS | Keychain Access |
| Linux | Secret Service (GNOME Keyring, KWallet) |
| Fallback | Encrypted file (~/.config/cmd/credentials.enc) |
Managing Credentials
# View stored API keys (masked)
cmd config --show-keys
# Delete a stored key
cmd config --delete-key anthropic
cmd config --delete-key openai
cmd config --delete-key ollama_host
Priority Order
When loading credentials, cmd checks in this order:
- Environment variables (allows temporary overrides)
- System keychain (primary storage)
- Encrypted file (fallback for headless environments)
This means you can override keychain credentials with environment variables for CI or temporary use.
Execution Settings
Configure how cmd handles command execution:
# View current settings
cmd config --show
# Enable execution mode (still prompts for confirmation)
cmd config --enable-execution
# Skip confirmation prompts (use with caution)
cmd config --skip-confirmation
# Reset to safe defaults
cmd config --disable-execution --require-confirmation
Settings are stored in ~/.config/cmd/settings.toml:
enable_execution = false
skip_confirmation = false
Environment Variables
You can also configure providers via environment variables:
Anthropic (Claude)
export ANTHROPIC_API_KEY=sk-ant-api03-...
Get your API key at console.anthropic.com/settings/keys
Default model: claude-sonnet-4-6
OpenAI
export OPENAI_API_KEY=sk-proj-...
Get your API key at platform.openai.com/api-keys
Default model: gpt-5.2
Ollama (Local)
Ollama runs models locally - no API key needed.
# Install Ollama
brew install ollama
# Pull a model
ollama pull qwen2.5-coder
# Set the host
export OLLAMA_HOST=http://localhost:11434
Default model: qwen2.5-coder
Provider Priority
If multiple providers are configured, cmd uses this priority:
- Anthropic
- OpenAI
- Ollama
Overriding Defaults
Use CLI flags to override the default model or endpoint:
# Use a different model
cmd -m claude-haiku-4-5 "list files"
# Use a custom endpoint
cmd -e https://my-proxy.com/v1/messages "list files"
Azure OpenAI
For Azure-hosted OpenAI, use the setup wizard:
cmd setup
# Select "Azure OpenAI"
# Enter your API key, resource name, and deployment name
Or manually:
export OPENAI_API_KEY=your-azure-api-key
cmd -e "https://your-resource.openai.azure.com/openai/deployments/gpt-5/chat/completions?api-version=2024-02-15-preview" \
-m gpt-5.2 \
"list files"
See Providers for more details.