Skip to main content
← All posts

Migrating from the OpenAI API: a practical checklist

Published

If your code already talks to the OpenAI API, the code is the easy part. The endpoint here is OpenAI-compatible — same request shape, same response shape, same SDKs — so switching is two arguments, not a rewrite. The real migration work is everything around the code: model names, billing, and limits. This is the checklist we hand to teams moving production traffic over.

The two-argument change

Point the OpenAI SDK at this endpoint and use a ModelSite key. Chat completions, streaming, and the usage fields your metrics already parse all keep their shape:

# Before: talking to OpenAI directly
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])

# After: same SDK, same code paths, different endpoint
client = OpenAI(
    api_key=os.environ["MODELSITE_API_KEY"],
    base_url="https://api.modelsite.ai/v1",
)

Model names are different strings

OpenAI model ids do not exist here. The catalog carries DeepSeek, Qwen, GLM, MiniMax and more, each under its own id — and the API will tell you exactly what is available:

curl https://api.modelsite.ai/v1/models \
  -H "Authorization: Bearer $MODELSITE_API_KEY"

A 404 on a chat request almost always means the model string is wrong, not that anything is down. Check it against the list before anything else.

What transfers unchanged

  • Streaming: server-sent events arrive in the same chunk format your client already consumes.
  • Request body fields pass through in the OpenAI format — what you serialize is what the model receives.
  • Every response carries a usage block: prompt tokens, completion tokens, and cached tokens where the model supports them.

What behaves differently

  • Billing is a prepaid wallet, not a monthly invoice. Requests draw down a balance you top up in advance.
  • Every request passes an admission hold: an estimated cost is reserved before the request runs, then settlement reprices it from actual usage.
  • One model id is often served by a pool of upstreams with failover. Availability comes from the pool; output can carry small vendor-to-vendor nuances.
  • Limits are enforced per organisation and per API key — concurrency and rate — not by subscription tier.

Cutover checklist

  • Create the account and top up the wallet.
  • Create an API key; keep one key per environment so spend stays separable.
  • Switch the base URL in staging first.
  • Replace model ids against the /v1/models list.
  • Canary a slice of traffic and watch its usage rows for a day.
  • Cut over fully, and keep the old path able to roll back for a week.

After the switch

Watch the dashboard's cost breakdown and per-key spend for the first few days. Every call lands as a usage row with the model, token counts and charge, so reconciliation against your own logs is mechanical — and if a number ever looks wrong, that row is what support will ask for.