ai command.
What Are Providers?
Providers are different backend services that run AI models. Each provider has its own:- Authentication: API keys, credentials, or subscriptions
- Pricing: Some free (local), some pay-per-token (API), some subscription (Claude Pro)
- Rate limits: Different limits per provider and tier
- Model selection: Not all providers have all models
- Geographic regions: Different data residency and compliance
Available Providers
Providers are configured once in
~/.ai-runner/secrets.sh and switched with simple flags. No need to edit config files or set environment variables.Cross-Runtime Providers
Provider flags work across runtimes where possible:
For Codex-specific providers (OpenRouter, Mistral, etc.), use
--profile:
Why Switch Providers?
There are several reasons to switch providers mid-task:1. Avoiding Rate Limits
The most common reason. Claude Pro has rate limits that can block you for hours:2. Cost Optimization
Different providers have different pricing:3. Local vs Cloud
Run models locally for privacy, or in the cloud for power:4. Geographic Compliance
Different providers operate in different regions:5. Model Availability
Test different models or use alternate AI systems:The —resume Flag for Continuity
The--resume flag picks up your previous conversation on a different provider:
--resume does:
- Loads the most recent conversation session
- Continues from where you left off
- Preserves all context and history
- Works across any provider switch
Rate limit recovery
Rate limit recovery
Cost optimization mid-task
Cost optimization mid-task
Local to cloud escalation
Local to cloud escalation
Testing providers
Testing providers
Session-Scoped Behavior
All provider switches are session-scoped — they only affect the current terminal session:ai session:
- Your original Claude Code settings are automatically restored
- No global configuration is changed
- Other terminals are completely unaffected
This non-destructive design means you can safely experiment with providers without breaking your Claude Code installation.
Setting Default Providers
If you frequently use a specific provider, save it as your default:~/.ai-runner/default.conf.
Flag precedence (highest to lowest):
Provider Examples
Switch Between Major Clouds
Use Anthropic API Directly
Local Models (Free)
Alternate Models via Vercel
Model Tiers
Most providers support three model tiers:
Combine tiers with providers:
Provider Configuration
Providers are configured in~/.ai-runner/secrets.sh:
Configuration is loaded at startup. After editing
secrets.sh, start a new session or run source ~/.ai-runner/secrets.sh.Check Current Configuration
Useai-status to verify your setup:
Advanced: Agent Teams with Any Provider
Agent teams work with all providers:Practical Workflows
Rate Limit Recovery Workflow
Cost-Optimized Development
Multi-Provider Testing
Privacy-Conscious Workflow
View Active Sessions
See all your conversation sessions:--resume.
Provider Setup
Detailed configuration for each provider
Executable Markdown
Use provider flags in shebang scripts