1Code supports flexible model configuration, allowing you to bring your own API keys (BYOK), use custom API endpoints, and configure alternative providers like Ollama for offline development.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.
Overview
1Code supports multiple authentication methods:- Claude Subscription - OAuth with your Anthropic account (Claude Pro/Max)
- Custom Models - Use custom base URLs and API keys for proxies or alternative providers
- Ollama - Local models for offline development
Using Custom Model Providers
Custom model configuration allows you to:- Use API proxies or alternative Anthropic-compatible endpoints
- Connect to custom deployments with your own API keys
- Configure different base URLs per project or globally
Configuration Options
The model identifier to use (e.g.,
claude-3-7-sonnet-20250219)Your API key or authentication token
The base URL for API requests (e.g.,
https://api.anthropic.com)Environment Variables
You can also configure custom providers using environment variables in your shell:~/.zshrc or ~/.bashrc
In development mode,
ANTHROPIC_API_KEY is stripped from the environment to allow OAuth testing. In production builds, it’s preserved to support existing Claude Code CLI configurations.How It Works
When you configure a custom model:- 1Code validates the configuration by checking model availability
- The custom base URL is used for all API requests
- Your API key is encrypted using Electron’s
safeStorageand stored locally - Environment variables are passed to the Claude CLI with custom settings
/home/daytona/workspace/source/src/main/lib/trpc/routers/claude.ts:1133-1134:
Multi-Account Management
1Code supports multiple Anthropic accounts with easy switching:Adding Accounts
- Complete OAuth flow for a new account
- Accounts are stored with encrypted tokens
- Switch between accounts from Settings
Account Storage
Accounts are stored in the local SQLite database with:- Email and display name
- Encrypted OAuth token (using Electron
safeStorage) - Connection and last-used timestamps
- Desktop user ID for sync
/home/daytona/workspace/source/src/main/lib/trpc/routers/anthropic-accounts.ts:13-19:
Ollama for Offline Development
1Code integrates with Ollama for offline model usage:Setup
- Install Ollama from ollama.ai
- Pull a model:
ollama pull qwen2.5-coder - Configure Ollama in Settings
Offline Features
When using Ollama, 1Code provides:- Chat title generation - Uses local models for naming conversations
- Commit message generation - Generates commit messages without internet
- Model selection - Choose from installed Ollama models
/home/daytona/workspace/source/src/main/lib/trpc/routers/ollama.ts:16-44:
Default Configuration
Ollama uses these defaults:- Base URL:
http://localhost:11434 - Recommended models:
qwen2.5-coder:32b,qwen2.5-coder:14b,qwen2.5-coder:7b
Security Best Practices
Secure Token Storage
1Code uses Electron’ssafeStorage API to encrypt sensitive data:
- Encryption at rest - Tokens are encrypted before storage
- OS-level security - Uses system keychain on macOS, Windows Credential Store, or libsecret on Linux
- Fallback mode - Base64 encoding if hardware encryption unavailable
Environment Variable Security
When using environment variables:- Add them to your shell profile (
~/.zshrc,~/.bashrc) - Never use
.envfiles tracked by git - Use
.env.localfor local development (add to.gitignore)
API Key Rotation
- Generate new API keys regularly
- Revoke old keys from your provider dashboard
- Update keys in Settings or environment variables
Troubleshooting
Custom Provider Not Working
Check base URL format
Check base URL format
Ensure your base URL:
- Starts with
https://orhttp:// - Does not have a trailing slash
- Points to the correct API endpoint
Verify API key validity
Verify API key validity
Test your API key with curl:
Check network connectivity
Check network connectivity
If using a proxy, ensure:
- Proxy is accessible from your network
- Firewall rules allow connections
- DNS resolution works for custom domains
Ollama Not Detected
- Verify Ollama is running:
ollama list - Check the default port:
curl http://localhost:11434/api/tags - Restart Ollama service if needed
Environment Variables Not Loading
1Code reads environment variables from multiple sources in priority order:- User-configured settings (highest priority)
- Vite env vars (
.env.localfiles withMAIN_VITE_prefix) process.env- Shell environment (loaded via shell profile)
/home/daytona/workspace/source/.env.example:35-38:
Advanced: Custom Provider Examples
AWS Bedrock Proxy
Azure OpenAI Proxy
Self-hosted Proxy
Related Resources
Configuration
Learn about advanced configuration options
Voice Input
Configure voice transcription with custom API keys