1Code can be configured through environment variables, config files, and UI settings to customize behavior for your workflow.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/21st-dev/1code/llms.txt
Use this file to discover all available pages before exploring further.
Configuration Sources
1Code loads configuration from multiple sources in priority order:- UI Settings (highest priority) - Settings panel in the app
- Environment variables - Shell profile or
.env.localfiles - Config files -
.claude/directory configs - Default values (lowest priority) - Built-in defaults
Environment Variables
Development & Build
Development server URL. Automatically set by
electron-vite during development.Example: http://localhost:5173API base URL for backend services. Override for local development.Example:
http://localhost:3000Authentication & API Keys
Anthropic API key for Claude models. Used by Claude CLI for custom configurations.Example:
In development mode, this is stripped to allow OAuth testing. In production, it’s preserved for CLI compatibility.
sk-ant-api03-...Alternative to
ANTHROPIC_API_KEY. Used for OAuth tokens.Example: oauth_token_...Custom base URL for Anthropic API. Use for proxies or alternative endpoints.Example:
https://api.anthropic.comOpenAI API key for voice transcription (Whisper API).Use
MAIN_VITE_OPENAI_API_KEY for .env.local files.Example: sk-...OpenAI API key for voice transcription. Vite-compatible format for
.env.local.Example: sk-...Analytics & Monitoring
Sentry DSN for error tracking (optional).Example:
https://xxxxx@xxx.ingest.sentry.io/xxxxxPostHog project key for analytics (optional, main process).Example:
phc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxPostHog API host (optional, main process).
PostHog project key for analytics (optional, renderer process).
PostHog API host (optional, renderer process).
Force enable analytics in development. Set to
"true" to enable.Debugging
Enable raw Claude CLI output logging. Set to
"1" to enable.Automatically enabled in development (unpackaged) builds.Node environment. Set to
"development" for development mode.Platform-Specific
Default shell path. Used for environment loading.Examples:
- macOS:
/bin/zsh - Linux:
/bin/bash - Windows: Uses
COMSPECinstead
System PATH for executable discovery. Extended with common tool locations.
Configuration Files
Project Config: .claude/
Project-specific configuration stored in.claude/ directory:
User Config: ~/.claude/
User-wide configuration in home directory:Worktree Configuration
Define setup commands for worktrees in.1code/worktree.json:
.1code/worktree.json
Array of shell commands to run when setting up a new worktree.Use
$ROOT_WORKTREE_PATH to reference the main repo directory.MCP Server Configuration
MCP servers can be configured globally or per-project:~/.claude/mcp-servers.json
Environment Variable Files
.env.local (Recommended)
Create.env.local in the project root for local development:
.env.local
Shell Profile
Add environment variables to your shell profile for global availability:~/.zshrc
source ~/.zshrc to apply changes.
Configuration Examples
Development Setup
.env.local
Custom API Proxy
~/.zshrc
Offline Development
For offline development with Ollama:- Install Ollama: ollama.ai
- Pull a model:
ollama pull qwen2.5-coder:7b - Configure in Settings → Models → Ollama
http://localhost:11434.
Multi-Environment
Use shell aliases for different configurations:~/.zshrc
Security Best Practices
Never commit secrets
Never commit secrets
Add
.env.local, .env, and any files with secrets to .gitignore..gitignore
Use encrypted storage
Use encrypted storage
When possible, use UI settings instead of environment variables. The app encrypts sensitive data using Electron
safeStorage.Rotate keys regularly
Rotate keys regularly
Rotate API keys every 90 days:
- Generate new key from provider
- Update in 1Code settings/environment
- Revoke old key
Use separate keys per environment
Use separate keys per environment
Use different API keys for development, staging, and production to limit blast radius of compromised keys.
Restrict key permissions
Restrict key permissions
When possible, create API keys with minimal required permissions. Avoid using admin or root keys.
Environment Loading
From/home/daytona/workspace/source/src/main/lib/claude/env.ts:13-34:
Troubleshooting
Environment Variables Not Loading
- Check variable name: Use
MAIN_VITE_prefix for.env.localfiles - Restart app: Changes to environment require app restart
- Check file location:
.env.localshould be in project root - Verify shell profile: For shell vars, ensure profile is sourced
Configuration Conflicts
When multiple sources define the same setting:- UI Settings (highest priority)
- User config env vars
- Vite env vars (
.env.local) - Process env vars
- Shell environment
- Default values (lowest priority)
Shell Environment Not Working
1Code loads shell environment using:- Variable is in shell profile (
~/.zshrc, not~/.zshenv) - Profile is executable and doesn’t have errors
- Shell is the correct one (check
echo $SHELL)
Related Resources
Custom Models
Configure API keys and custom providers
Voice Input
Set up voice transcription with API keys
Skills & Commands
Create custom skills and slash commands
MCP Integration
Configure MCP servers