Skip to main content
Andi AIRun makes it easy to switch between providers mid-task, allowing you to work around rate limits, optimize costs, and leverage different models.

Why Switch Providers?

Avoid Rate Limits

Claude Pro has usage limits. When you hit a rate limit, switch to an API provider and continue immediately:

Optimize Costs

Switch to cheaper models for simple tasks:

Leverage Different Models

Switch to more powerful models for complex reasoning:

Using —resume

The --resume flag lets you pick up a previous conversation exactly where you left off.

Basic Resume

Resume with Different Tier

Resume with Different Provider

Resume with Custom Model

Session Continuity

When you use --resume, Andi AIRun:
  1. Loads the previous conversation from your most recent session
  2. Preserves all context (files, code, decisions)
  3. Switches the provider seamlessly
  4. Continues the task without interruption
The conversation history is stored locally in ~/.ai-runner/sessions/, so resume works even after closing your terminal.

Setting a Default Provider

Avoid typing the provider flag every time by setting a default:

Setting Default with Custom Model

Clearing the Default

Overriding the Default

Session Isolation

All provider changes are session-scoped and automatically isolated:

Terminal Isolation

Each terminal session is completely independent.

Auto-Cleanup on Exit

Process Safety

  • No global state - changes only affect the current terminal session
  • No config files modified - all changes via environment variables
  • Crash-safe - no cleanup needed if the session crashes
  • Multiple sessions - run different providers simultaneously

Common Switching Patterns

Pattern 1: Rate Limit Recovery

Pattern 2: Cost Optimization

Pattern 3: Model Experimentation

Pattern 4: Development Workflow

Provider-Specific Considerations

Local Providers (Ollama, LM Studio)

Pros:
  • Free (no API costs)
  • No rate limits
  • Private (data stays local)
  • Fast (no network latency)
Cons:
  • Requires hardware (VRAM/RAM)
  • Model quality varies
  • Setup required
Best used for:
  • Cost-conscious development
  • Private/sensitive code
  • Frequent iterations
  • Learning and experimentation

Cloud Providers (AWS, Vertex, Anthropic)

Pros:
  • Most powerful models
  • No hardware requirements
  • Always available
  • Latest model versions
Cons:
  • Pay per use
  • Rate limits (especially Claude Pro)
  • Network dependency
  • Data sent to provider
Best used for:
  • Complex reasoning
  • Large refactors
  • Production work
  • Critical tasks

Vercel AI Gateway

Pros:
  • Access to 100+ models
  • Single API for all providers
  • Unified billing
  • Easy switching
Cons:
  • Pay per use
  • Network dependency
  • Rate limits vary by model
Best used for:
  • Multi-model workflows
  • Experimentation
  • Provider flexibility

Tips for Effective Switching

1. Configure Multiple Providers

Set up 2-3 providers in secrets.sh for maximum flexibility:

2. Use Tier Flags for Cost Control

3. Set Defaults for Common Workflows

4. Monitor Usage and Costs

Keep an eye on your API usage:
  • AWS: CloudWatch metrics
  • Google: Cloud Console
  • Anthropic: Console dashboard
  • Vercel: AI Gateway dashboard

5. Use Local for Development

Troubleshooting

Resume Not Working

Provider Not Responding

Model Not Available

Next Steps

Provider Overview

Learn about the provider system

Local Providers

Set up free local models

Cloud Providers

Configure cloud APIs