Migrate
Migrate from Together AI
Cheaper than Together on most open-weight models (we run them on CF edge), with the same OpenAI-compatible API, plus access to frontier closed models.
CLI automation for Together AI 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 https://api.together.xyz/v1 # 3. search-and-replace the env var name
What changes, line-by-line
The table below is what aig migrate together rewrites. If you're doing it by hand, do these in order.
| Thing | Together AI | AIgateway |
|---|---|---|
| Base URL | https://api.together.xyz/v1 | https://api.aigateway.sh/v1 |
| API key env var | TOGETHER_API_KEY | AIGATEWAY_API_KEY |
| Model slugs | meta-llama/Llama-3.3-70B-Instruct-Turbo | meta/llama-4-scout-on-edge (see /models) |
| Frontier models | Open-weight only | Open-weight + Claude/GPT/Gemini/Kimi |
| Latency | Single region (us-east) | Global edge, 47ms p50 overhead |
Before / after — Python (OpenAI SDK)
BEFORE · Together AI
from openai import OpenAI
client = OpenAI(
base_url="https://api.together.xyz/v1",
api_key=os.environ["TOGETHER_API_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
- Model slugs differ — Together uses the HuggingFace-style path, AIgateway uses provider/model. Check /models for the AIgateway equivalent of your current Together model.
- Inference quality is identical (same upstream weights); routing layer is different.
- BYOK: bring your Together key if you have negotiated discounts, route through AIgateway, pay 0% platform fee on those calls.
Credit match
Email your last invoice from Together AI to switch@aigateway.sh and we match the credit up to $1,000 (24-hour turnaround). Or read the full pitch at /switch/together.
What to read next
- BYOK — bring your existing Together AI 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.