How to Migrate from OpenAI to a Multi-Model API Gateway
Migration playbook: switching from OpenAI direct integration to a multi-model API gateway in two lines of code. Covers feature-flag rollout, dual-key safety, billing reconciliation during transition, and validating equivalent quality on Claude / Gemini / DeepSeek.
You are on OpenAI direct, your code works, and you want to add Claude, Gemini or DeepSeek without a rewrite. The good news: migrating to a multi-model gateway is one of the lowest-risk infrastructure changes you will ever make — the OpenAI SDK already speaks the protocol every major gateway exposes, so the move is two lines, then an incremental rollout you control. This playbook walks the full path.
Why migrate at all
Staying single-provider means you cannot reach for Claude when it codes better, Gemini when you need a million-token context, or DeepSeek when cost matters — without standing up a second integration each time. A gateway makes every model reachable through the API you already use, so model choice becomes a runtime decision instead of an engineering project.
Step 1 — the two-line change
A gateway like Celedog is OpenAI-compatible, so you keep the OpenAI SDK and change only the base URL and key:
from openai import OpenAI
client = OpenAI(
base_url="https://celedog.io/v1", # was https://api.openai.com/v1
api_key="sk-...", # your Celedog key
)
resp = client.chat.completions.create(
model="claude-4.6-sonnet", # now any of 200+ models
messages=[{"role": "user", "content": "Hello"}],
)
Your existing GPT calls keep working unchanged — model="gpt-4o" still routes to GPT-4o. You have added every other model without touching the rest of your code.
Step 2 — dual-key safety during cutover
Don't flip 100% of traffic on day one. Keep two clients configured — your existing OpenAI client and the new gateway client — behind a feature flag. Route a small percentage through the gateway, compare outputs and latency, and ramp as confidence grows. If anything looks wrong, the flag flips back instantly with no deploy.
Step 3 — feature-flag rollout
- 1% canary. Send a sliver of traffic through the gateway on the same model you use today. You are validating the path, not the model — outputs should be identical.
- Add a second model behind a flag. Route one non-critical feature to Claude or Gemini and measure quality against your existing baseline.
- Ramp. Move traffic in stages — 5%, 25%, 100% — watching error rate, latency and cost at each step.
Step 4 — validate equivalent quality
Before you route a feature to a new model, run your existing eval set (or build a small one) on both the incumbent and the candidate. Models differ in tone, JSON strictness and instruction-following; a model that's better on average can still regress on your specific prompt. Validate per feature, not globally, and keep the prompt tweaks each model needs in version control.
Step 5 — billing reconciliation
During transition you will have spend in two places: your shrinking OpenAI invoice and your growing gateway wallet. A gateway consolidates this — once you are fully migrated, one wallet and one statement replace the per-provider invoices. Use the gateway's per-request logs to attribute cost to features so you can see exactly what moved and what it now costs.
Common pitfalls
- Assuming identical JSON. Different models format structured output slightly differently — validate parsers against each model you adopt.
- Forgetting native features. If you use Anthropic-specific tooling, check the gateway also exposes the native Messages API, not just the OpenAI shape.
- Big-bang cutover. The whole point of the gateway is incremental control — use it. Ramp, don't flip.
Where Celedog fits
Celedog is OpenAI-compatible (and exposes the native Anthropic Messages API for Claude tooling), with 200+ models behind one key, per-request cost logging for clean reconciliation, and one multi-currency wallet so the post-migration billing is a single statement. The migration is a base-URL change away.
The cheapest time to adopt a gateway is before you've hard-coded a provider everywhere; the second cheapest is today, because the change is two lines and a feature flag.
Next steps
- Read the migration docs.
- See the single-API walkthrough.
- Create an account — free signup credit, no card required.
Written by Celedog Team · Last updated May 28, 2026
Where to go next
- Try Celedog — free credits on signup, no card required.
- API documentation
- Per-model pricing
- More Celedog Blog