Overview
You can switch between AI providers (OpenAI, Anthropic, OpenRouter) at any time by updating environment variables. No code changes required.
Switching from OpenAI to Anthropic
- Get an Anthropic API key (see guide)
- Go to instance Configuration tab
- Add environment variable:
ANTHROPIC_API_KEY=sk-ant-your-key - Update or add:
AI_MODEL=claude-4.5-sonnet - Save changes and restart instance
Switching from Anthropic to OpenAI
- Get an OpenAI API key (see guide)
- Go to instance Configuration tab
- Add environment variable:
OPENAI_API_KEY=sk-your-key - Update AI_MODEL:
AI_MODEL=gpt-4 - Save and restart instance
Available Models
OpenAI Models
gpt-4.1- Latest, most capablegpt-4-turbo- Fast and powerfulgpt-3.5-turbo- Cost-effective
Anthropic Models
claude-4.6-opus- Most intelligentclaude-4.5-sonnet- Balancedclaude-4.5-haiku- Fast and cheap
Using Multiple Providers
You can keep both API keys configured:
OPENAI_API_KEY=sk-... ANTHROPIC_API_KEY=sk-ant-... AI_MODEL=claude-4.5-sonnetSwitch by changing only AI_MODEL and restarting.
Cost Comparison
Approximate costs (as of 2026):
- GPT-3.5 Turbo: $0.0005/1K tokens (cheapest)
- Claude Haiku: $0.00025/1K input, $0.00125/1K output
- GPT-4 Turbo: ~$0.01/1K tokens
- Claude Sonnet: $0.003/1K input, $0.015/1K output
- GPT-4.1: $0.01-0.03/1K tokens
- Claude Opus: $0.015/1K input, $0.075/1K output (most expensive)
Testing After Switching
- Restart instance after config changes
- Check logs for successful AI provider connection
- Send test message to verify responses
- Monitor costs in provider dashboard
Troubleshooting
Wrong Provider Being Used
- Verify
AI_MODELmatches your intended provider - Ensure you restarted after changing config
- Check logs for which provider initialized
Both Keys Present But Wrong One Used
The AI_MODEL determines which provider is used. Ensure it matches the provider you want.
Next Steps
- Learn about choosing the right AI model
- Get OpenRouter keys for multi-model access
- Read about updating environment variables