Migrate from another router
Move from any OpenAI-compatible model router or gateway to Safeguard: base URL, key, model ids, routing options and billing differences.
If your code already calls models through an OpenAI-compatible router or gateway, moving to Safeguard is the same kind of change as moving from OpenAI: a new base URL, a new key and Safeguard's model ids. The details below are the parts that differ from one router to the next.
1. Base URL and key
| Setting | Value |
|---|---|
| Base URL | https://api.safeguard.sh/gpt/v1 |
| API key | An sg-api- key from the Console's API keys page |
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.safeguard.sh/gpt/v1",
api_key=os.environ["SAFEGUARD_INFERENCE_KEY"],
)2. Model ids
Safeguard's ids have the form provider/model, such as anthropic/claude-sonnet-5-5. Many routers use a similar form, but the names after the slash can differ, so look each model up at safeguard.sh/models or with GET /models rather than reusing the old string. Only models that appear in GET /models can be called today.
3. Routing options
Safeguard reads one routing object, provider, with two fields:
"provider": { "allow_fallbacks": true, "zdr": true }allow_fallbacksturns on one retry and then the catalog's listed fallbacks for that model, only within the same model family. It is off unless your request or your workspace turns it on.zdrroutes only to models offered with zero data retention.
Other routing fields your router may have used, such as provider order, allow lists or price caps, are ignored. So are attribution headers. To control cost, use max_tokens and the spend limits.
See Reliability and fallbacks and Zero data retention.
4. Parameters and endpoints
The request and response follow OpenAI's Chat Completions format. Check these differences:
- Text only. Image and audio parts are refused with
400 unsupported_parameter. nmust be1.- Optional parameters outside the list on Chat completions are ignored, not forwarded.
- Only
/chat/completions,/modelsand/keyare served. There are no embeddings, images, audio or legacy completions endpoints. - Streaming uses the same server-sent events, and
stream_options.include_usageadds a final usage chunk. See Streaming.
5. Billing
- No markup. For third-party models you pay the provider's list price per token. Each response reports its own cost in
usage.cost, in US dollars. - Prepaid credit. Requests spend your workspace's credit and stop at zero with
402 insufficient_credit. - Spend limits. A monthly limit for the workspace and, optionally, for each key.
- Card fees. Where card top-up is available, the card processor's fee is added to the charge at cost; the credit you receive is the amount you chose.
See Pricing and billing.
6. Your own provider keys
If you used your router with your own provider accounts, note that Safeguard's API keys call models on Safeguard's provider accounts. In this version your own models and endpoints cannot be called with an API key, and the Console cannot pick them yet. See Bring your own model.
A checklist for the switch
- Create a key per application in the Console, each with a monthly spend limit.
- Map every model id and confirm it appears in
GET /models. - Decide whether you want fallbacks and zero data retention, and set
provideror ask a tenant admin or super admin to set the workspace defaults. - Change the base URL, key and model ids, and run your tests.
- Watch Usage in the Console while traffic moves.
Migrate from OpenAI
Move code that calls OpenAI's Chat Completions API to Safeguard: change the base URL and the key, map the model ids, and check the parameters you use.
Choosing a model
How to choose a model for the inference API by price, context, where it runs, where your data goes, and security needs, using the catalog at safeguard.sh/models.