Azure OpenAI (gateway)

Route Azure OpenAI requests through the Respan gateway after your Azure OpenAI provider credentials and deployments are configured in Respan. The client talks to Respan’s OpenAI-compatible endpoint with RESPAN_API_KEY; Respan handles provider authentication.

Setup

1

Install packages

$npm install openai
2

Set environment variables

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
$export RESPAN_BASE_URL="https://api.respan.ai/api"
$export RESPAN_MODEL="YOUR_AZURE_OPENAI_MODEL_OR_DEPLOYMENT_ID"

Configure your Azure OpenAI credentials in Respan before using this route.

3

Point the OpenAI client to the Respan gateway

1import OpenAI from "openai";
2
3const client = new OpenAI({
4 apiKey: process.env.RESPAN_API_KEY,
5 baseURL: process.env.RESPAN_BASE_URL ?? "https://api.respan.ai/api",
6});
7
8const response = await client.chat.completions.create({
9 model: process.env.RESPAN_MODEL ?? "YOUR_AZURE_OPENAI_MODEL_OR_DEPLOYMENT_ID",
10 messages: [{ role: "user", content: "Say hello in one sentence." }],
11});
12console.log(response.choices[0]?.message?.content);

Switch models

Change the model parameter to another Azure OpenAI deployment or to any other model configured for your Respan gateway account.

1await client.chat.completions.create({ model: "YOUR_AZURE_OPENAI_MODEL_OR_DEPLOYMENT_ID", messages });
2await client.chat.completions.create({ model: "gpt-5-mini", messages });
3await client.chat.completions.create({ model: "claude-sonnet-4-5-20250929", messages });

See the full model list.