Find a model

Browse the full catalog →

Change two lines

Point the OpenAI SDK at TrustedRouter with a new base URL and key. Your model names, messages, streaming and tool calls stay the same.

Before: OpenAI

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["OPENAI_API_KEY"],
)

response = client.chat.completions.create(
    model="gpt-5.4-mini",
    messages=[{"role": "user", "content": "Say hello"}],
)

After: TrustedRouter

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api-azure.trustedrouter.com/v1",
    api_key=os.environ["TRUSTEDROUTER_API_KEY"],
)

response = client.chat.completions.create(
    model="gpt-5.4-mini",
    messages=[{"role": "user", "content": "Say hello"}],
)

Before: OpenAI

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
});

const response = await client.chat.completions.create({
  model: "gpt-5.4-mini",
  messages: [{ role: "user", content: "Say hello" }],
});

After: TrustedRouter

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api-azure.trustedrouter.com/v1",
  apiKey: process.env.TRUSTEDROUTER_API_KEY,
});

const response = await client.chat.completions.create({
  model: "gpt-5.4-mini",
  messages: [{ role: "user", content: "Say hello" }],
});

Changed lines are marked +. Create a key in the console and store it as TRUSTEDROUTER_API_KEY.

Model names keep working

Send the OpenAI names you use today, dated versions included. To try another lab, use its full name from the models page.

You sendTrustedRouter runs
gpt-5.4-miniopenai/gpt-5.4-mini
gpt-4.1-2025-04-14openai/gpt-4.1
anthropic/claude-sonnet-5.5Claude Sonnet 5.5
trustedrouter/autoA ranked list of models, with fallback

What works the same

OpenAI models behave as they do today. Other labs' models differ, so test each one you switch to.

FeatureWorks the same?
Chat CompletionsYes
StreamingYes
Tool callsYes, on models that support them
JSON outputYes, on models that support it
Other labs' modelsTest each one; features differ by model

If OpenAI is down

List a backup model. If the first one fails, TrustedRouter sends the request to the next. Or use trustedrouter/auto and let the router choose. More options are in provider routing.

Python
response = client.chat.completions.create(
    model="gpt-5.4-mini",
    messages=messages,
    extra_body={"models": [
        "gpt-5.4-mini",
        "anthropic/claude-haiku-4.5",
    ]},
)

Zero data retention

Send prompts only to providers that keep no data. If none qualifies, the request fails before any provider sees it. It never falls back to a weaker one.

Python
extra_body={
    "provider": {"min_privacy": "zdr"},
}

Rate limits

You set your key's limits as spend caps in USD: daily, weekly or monthly. When a cap is reached or traffic is throttled, you get a 429 with Retry-After. Wait that long, then retry. See spend controls.

Test these before you switch

  1. Tool calls
  2. JSON output
  3. Streaming
  4. Rate limits and retries on 429
  5. Zero data retention, if you handle customer data
  6. The same real prompts on the old and new model: compare answers, speed and price per request
  7. Rollback: keep the old base URL in one setting

Read next: OpenAI compatible API, provider routing, pricing.

Workspace access

Sign in

Choose a sign in method to access your TrustedRouter workspace.

New to TrustedRouter?

By continuing you agree to the terms of service and privacy policy.