Configuration
API Key Setup
Section titled “API Key Setup”Magic Shell requires an API key from one of the supported providers. Run the setup wizard:
msh --setupThis will guide you through:
- Selecting a provider (OpenCode Zen or OpenRouter)
- Entering your API key
- Choosing a default model
Get an API Key
Section titled “Get an API Key”OpenCode Zen offers curated models optimized for coding, including free models.
- Visit opencode.ai/auth
- Create an account or sign in
- Copy your API key
OpenRouter provides access to a wide variety of models from different providers.
- Visit openrouter.ai/keys
- Create an account or sign in
- Generate a new API key
Environment Variables
Section titled “Environment Variables”You can also set your API key via environment variables:
# OpenCode Zenexport OPENCODE_ZEN_API_KEY="your-key-here"
# OpenRouterexport OPENROUTER_API_KEY="your-key-here"Add these to your shell profile (~/.bashrc, ~/.zshrc, etc.) for persistence.
Configuration File
Section titled “Configuration File”Magic Shell stores configuration in ~/.magic-shell/config.json:
{ "provider": "opencode-zen", "defaultModel": "big-pickle", "safetyLevel": "moderate", "dryRunByDefault": false, "theme": "opencode"}Options
Section titled “Options”| Option | Description | Default |
|---|---|---|
provider | AI provider (opencode-zen or openrouter) | opencode-zen |
defaultModel | Default model ID | big-pickle |
safetyLevel | Safety strictness (strict, moderate, relaxed) | moderate |
dryRunByDefault | Always show commands without executing | false |
theme | Color theme name | opencode |
Secure Key Storage
Section titled “Secure Key Storage”API keys are stored securely in your system’s keychain:
| Platform | Storage Location |
|---|---|
| macOS | macOS Keychain |
| Linux | libsecret (secret-tool) |
| Windows | Windows Credential Manager |
Changing Settings
Section titled “Changing Settings”Via CLI
Section titled “Via CLI”# Change providermsh --provider openrouter
# Change default modelmsh --model claude-3-5-sonnet
# Change thememsh --theme tokyonight
# List available modelsmsh --models
# List available themesmsh --themesVia TUI
Section titled “Via TUI”In TUI mode (mshell), use keyboard shortcuts:
Ctrl+X M- Change modelCtrl+X S- Switch providerCtrl+X T- Change themeCtrl+X C- View config
Debug Mode
Section titled “Debug Mode”Enable API response debugging:
DEBUG_API=1 msh "your query"This shows the full API request and response, useful for troubleshooting.