Safeguard Docs
API Platform (Console)

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

SettingValue
Base URLhttps://api.safeguard.sh/gpt/v1
API keyAn 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_fallbacks turns 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.
  • zdr routes 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.
  • n must be 1.
  • Optional parameters outside the list on Chat completions are ignored, not forwarded.
  • Only /chat/completions, /models and /key are served. There are no embeddings, images, audio or legacy completions endpoints.
  • Streaming uses the same server-sent events, and stream_options.include_usage adds 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

  1. Create a key per application in the Console, each with a monthly spend limit.
  2. Map every model id and confirm it appears in GET /models.
  3. Decide whether you want fallbacks and zero data retention, and set provider or ask a tenant admin or super admin to set the workspace defaults.
  4. Change the base URL, key and model ids, and run your tests.
  5. Watch Usage in the Console while traffic moves.

On this page