Provider guide

Azure OpenAI through one OpenAI-compatible gateway

Front your Azure OpenAI deployments with the same OpenAI-compatible endpoint as every other provider — and add fallback, in-data-plane guardrails, and region-locked routing on top.

Azure OpenAI differs from the public API in its URL layout (/openai/deployments/{deployment}/...), an api-key auth header rather than a bearer token, and an api-version query parameter. Routeplane’s adapter reads these from environment configuration and builds the right request, so callers still send an ordinary OpenAI chat completion.

Because Azure deployments are region-scoped, this adapter is a natural fit for sovereign routing: pin a deployment to a region and let the gateway hard-lock regulated requests to it.

Drop in your OpenAI client

Point your existing OpenAI SDK at the gateway and add two headers — your virtual key and the provider. Nothing else about your code changes.

bashcurl
curl https://api.routeplane.ai/v1/chat/completions \
  -H "content-type: application/json" \
  -H "x-routeplane-api-key: rp_your_gateway_key" \
  -H "x-routeplane-provider: azure_openai" \
  -d '{"model":"gpt-4o","messages":[{"role":"user","content":"Hello!"}]}'
pythonopenai SDK
import openai

client = openai.OpenAI(
    api_key="rp_your_gateway_key",
    base_url="https://api.routeplane.ai/v1",
    default_headers={
        "x-routeplane-api-key": "rp_your_gateway_key",
        "x-routeplane-provider": "azure_openai",   # route to Azure OpenAI
    },
)

resp = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
typescriptopenai SDK
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'rp_your_gateway_key',
  baseURL: 'https://api.routeplane.ai/v1',
  defaultHeaders: {
    'x-routeplane-api-key': 'rp_your_gateway_key',
    'x-routeplane-provider': 'azure_openai', // route to Azure OpenAI
  },
});

const completion = await client.chat.completions.create({
  model: 'gpt-4o',
  messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(completion.choices[0]?.message.content);

Or use the Routeplane SDK

The Routeplane SDKs subclass the official OpenAI clients, wire up the x-routeplane-* headers for you, and add typed access to routing metadata and the non-OpenAI surfaces.

bashinstall
pip install routeplane
pythonrouteplane SDK
from routeplane import Routeplane

client = Routeplane(
    api_key="rp_your_gateway_key",
    provider="azure_openai",   # route to Azure OpenAI
)

resp = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
bashinstall
npm i @routeplane/sdk
typescript@routeplane/sdk
import { Routeplane } from '@routeplane/sdk';

const client = new Routeplane({
  apiKey: process.env.ROUTEPLANE_API_KEY!, // rp_...
  provider: 'azure_openai',                 // route to Azure OpenAI
});

const completion = await client.chat.completions.create({
  model: 'gpt-4o',
  messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(completion.choices[0]?.message.content);

Add a fallback chain

Try your Azure OpenAI deployment first; fall back to the public OpenAI API. Make the provider header a comma-separated list and the gateway walks it in order, skipping any provider whose circuit is open.

bashcurl
curl https://api.routeplane.ai/v1/chat/completions \
  -H "content-type: application/json" \
  -H "x-routeplane-api-key: rp_your_gateway_key" \
  -H "x-routeplane-provider: azure_openai,openai" \
  -d '{"model":"gpt-4o","messages":[{"role":"user","content":"Hello!"}]}'

Azure OpenAI on the gateway

The adapter supports chat completions, native streaming, and embeddings.

Configured from the environment

Set AZURE_OPENAI_ENDPOINT (e.g. https://your-resource.openai.azure.com), AZURE_OPENAI_DEPLOYMENT, and optionally AZURE_OPENAI_API_VERSION (defaults to 2024-10-21). An optional AZURE_OPENAI_DEPLOYMENTS JSON map lets you route different model names to different deployments; an unmapped model returns a clean 422 rather than a wrong deployment.

API-version aware

The adapter gates request features on your api-version — for example rewriting the developer role to system and omitting stream_options for older versions — so a request that would 400 against your API version is shaped to succeed.

Azure OpenAI model pricing

List prices for the Azure OpenAI models you can call through the gateway — click any model for its per-token cost page.

Sovereign routing

Sovereign routing works with Azure OpenAI the same way it works everywhere: add x-routeplane-residency to a request, and when the gateway classifies regulated personal data in it, only providers resident in the requested region stay eligible — a hard constraint that overrides the provider header. Declare where Azure OpenAI runs by setting AZURE_OPENAI_REGION.

Keep reading

Frequently asked questions

Is Routeplane a drop-in replacement for calling Azure OpenAI directly?

Yes. The gateway is OpenAI-compatible, so switching is a base-URL change — point your existing OpenAI SDK at https://api.routeplane.ai/v1 and set the x-routeplane-provider header to azure_openai. You keep your code and gain automatic fallback, in-data-plane PII guardrails, sovereign routing, and per-team cost attribution.

Which Azure OpenAI models can I use through Routeplane?

Any Azure OpenAI model the provider serves. See the list prices linked above for the ones we publish.

Can I enforce data residency on Azure OpenAI requests?

Yes. Add the x-routeplane-residency header (for example IN) and, when a request carries regulated personal data, the gateway restricts routing to providers eligible in that region — overriding the provider header if it has to. The Azure OpenAI adapter reads AZURE_OPENAI_REGION to declare where it is resident.

Route your first request this week.

Point your existing OpenAI-compatible client at Routeplane, set one header, and get fallback, guardrails, and sovereign routing across every provider.