What is an OpenAI-compatible API? How to switch providers in one line

An OpenAI-compatible API takes the same requests and returns the same responses as OpenAI's Chat Completions API, so the OpenAI SDKs and most AI tools work with it once you change the base URL and the key.

· Zurelay guides · Prices update live

The one-line switch

The OpenAI SDKs send requests to OpenAI by default, but they take a base URL. Point it at another provider and use that provider's key and model names; the rest of the code stays.

switch.py
from openai import OpenAI
client = OpenAI(
base_url="https://api.zurelay.com/v1", # the only line that changes
api_key="YOUR_ZURELAY_KEY",
)
reply = client.chat.completions.create(
model="claude-sonnet-5-5",
messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)

The same works in TypeScript with baseURL, and in tools that ask for an "OpenAI base URL" or "custom endpoint": OpenCode, Continue, Cline, Open WebUI and many more. The integration guides have each one's settings.

What carries over

  • Messages, system prompts and streaming.
  • Tool calling and structured output with a JSON schema.
  • Images and other files in the message, for models that read them.
  • The usage block, so token accounting works the same.

What to check before you switch

  • Model names. Each provider has its own IDs; list them with GET /v1/models.
  • Which APIs it serves. Many providers serve Chat Completions but not OpenAI's Responses, Realtime, embeddings or batch APIs. Zurelay serves Chat Completions, images, video and speech, and Anthropic's Messages API for Claude.
  • Extra parameters. Reasoning levels, cache controls and sampling limits differ by model. A good provider documents which ones each model takes.
  • Is it the model it says? Cheap providers sometimes serve an older or cheaper model under a newer name. Five quick checks are in what cheap AI APIs are really selling.

Why switch at all

One OpenAI-compatible key can reach models from many labs, so comparing Claude, GPT, Gemini and DeepSeek on your own prompts is a change of model name, and so is moving to a cheaper one. See the models and prices.

Every model on one OpenAI-compatible key, below list price. Credit from $10, no subscription.Get your API key

Stop paying list price.
Start saving today.

Create a key in seconds, point the SDK you already use at Zurelay, and every request costs up to 90% less from the first token.