Migrate
Migrate from LiteLLM (managed)
Same OpenAI-compatible surface, with a managed gateway instead of self-hosted. Skip the infra; keep the abstraction.
CLI automation for LiteLLM (managed) isn't shipped yet — you'll do this manually below. PRs welcome at packages/aig-cli/src/commands/migrate.ts.
TL;DR — three lines
# 1. set your AIgateway key export AIGATEWAY_API_KEY="sk-aig-..." # 2. change the base URL base_url="https://api.aigateway.sh/v1" # was (self-hosted, varies) # 3. search-and-replace the env var name
What changes, line-by-line
The table below is what aig migrate litellm rewrites. If you're doing it by hand, do these in order.
| Thing | LiteLLM (managed) | AIgateway |
|---|---|---|
| Base URL | your-litellm-host/v1 | https://api.aigateway.sh/v1 |
| API key env var | LITELLM_MASTER_KEY | AIGATEWAY_API_KEY |
| Provider model format | openai/gpt-5.4 (LiteLLM style) | openai/gpt-5.4 (same) |
| Self-hosted infra | You run the proxy | We run the edge (CF Workers, global) |
| Observability | LiteLLM logs to your sink | AIgateway logs + tags + per-tag budgets |
| Failover | Configured in LiteLLM YAML | Configured in AIgateway routing rules |
Before / after — Python (OpenAI SDK)
BEFORE · LiteLLM (managed)
from openai import OpenAI
client = OpenAI(
base_url="(self-hosted, varies)",
api_key=os.environ["LITELLM_MASTER_KEY"],
)
r = client.chat.completions.create(
model="anthropic/claude-opus-4.7",
messages=[{"role": "user", "content": "Hi"}],
)AFTER · AIgateway
from openai import OpenAI
client = OpenAI(
base_url="https://api.aigateway.sh/v1",
api_key=os.environ["AIGATEWAY_API_KEY"],
)
r = client.chat.completions.create(
model="anthropic/claude-opus-4.7",
messages=[{"role": "user", "content": "Hi"}],
)Behavioral notes
- LiteLLM's model slugs are mostly compatible — most provider prefixes (openai/, anthropic/, etc.) match AIgateway exactly.
- Cost tracking: LiteLLM tracks per-key spend; AIgateway adds per-tag and per-sub-account on top.
- No CLI automation yet — manual swap. PRs welcome at packages/aig-cli/src/commands/migrate.ts.
Credit match
Email your last invoice from LiteLLM (managed) to switch@aigateway.sh and we match the credit up to $1,000 (24-hour turnaround). Or read the full pitch at /switch/litellm.
What to read next
- BYOK — bring your existing LiteLLM (managed) provider keys; pay 0% on those routes.
- Sub-accounts — per-customer keys with spend caps; the closest analogue to workspace-isolated keys.
- All migration guides — same docs for OpenRouter, Portkey, Helicone, LiteLLM, Together, Replicate, Fireworks, Requesty.