Set NROUTER_API_KEY
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Use the OpenAI SDK, REST format, and streaming patterns you already know while nRouter adds model choice, provider failover, guardrails, budgets, and spend visibility.
Existing client, governed traffic
Base URL and API key
OpenAI-compatible request path
Provider credentials managed for you
Governance included on every tier
Written by Suresh, Senior SEO Engineer · Technically reviewed by Rama Surasani, Founder & CEO, CloudAct Inc. · Last updated October 6, 2026
nRouter provides an OpenAI-compatible API for accessing multiple AI providers through one endpoint. To migrate an existing OpenAI SDK integration, change the base URL and API key, then select a model from the nRouter catalogue. Your existing client structure, streaming code, and message format can remain largely unchanged, while routing, budgets, guardrails, and observability run at the gateway layer.
Create an nRouter virtual key, point the client at https://api.nrouter.ai/v1, and choose a live model ID. The request format stays familiar; the gateway becomes the provider and governance control plane.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Chat completions can use stream: true and server-sent events. Handle partial chunks and stream errors in the client. Once output has started, do not assume a request can be transparently replayed to another provider; failover behavior depends on the failure point and endpoint policy.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Model IDs identify the catalogue entry selected by your request. Check each model’s provider, modality, context window, input and output pricing, and capability flags before production use. Provider abstraction simplifies switching, but it does not make different model capabilities identical.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
API compatibility is the integration layer, not the whole product. nRouter can route by policy, apply provider fallback, redact PII, detect prompt injection, enforce organization/team/key budgets, and record request and cost data around the compatible call.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
The nRouter endpoint is not an OpenAI product and should not be treated as a promise that every OpenAI-specific parameter behaves identically. Its value is a familiar client contract plus multi-provider access and gateway-level controls.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Models expose different capabilities. Tool calling, JSON mode, vision, audio, reasoning, streaming, rate limits, and context windows vary by model and provider. Some provider-specific parameters do not transfer. The API reference and live catalogue are the source of truth before rollout.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Use a staged rollout: change the base URL and key, verify the model ID, test streaming, tool calling, and error handling, configure budgets and guardrails, confirm cost headers and logs, then enable production traffic gradually.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
Built into the same managed gateway so teams can ship with one API key, clear controls, and an auditable request path.
The simplest migration changes the base URL and key. The examples below use the tested OpenAI-compatible request shape; confirm the selected model and endpoint capability in the API reference before adding provider-specific parameters.
// Node.js — OpenAI SDK
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.NROUTER_API_KEY,
baseURL: "https://api.nrouter.ai/v1",
});
const response = await client.chat.completions.create({
model: "gpt-5",
messages: [{ role: "user", content: "Explain model routing in one sentence." }],
});
console.log(response.choices[0].message.content);
# Python
from openai import OpenAI
client = OpenAI(api_key="your-nrouter-key", base_url="https://api.nrouter.ai/v1")
response = client.chat.completions.create(
model="gpt-5",
messages=[{"role": "user", "content": "What is an OpenAI-compatible API?"}],
)
# Environment variables
export OPENAI_API_KEY="your-nrouter-key"
export OPENAI_BASE_URL="https://api.nrouter.ai/v1"
# cURL
curl https://api.nrouter.ai/v1/chat/completions \
-H "Authorization: Bearer $NROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5","messages":[{"role":"user","content":"Explain provider failover."}]}'
# Streaming: add stream: true and consume server-sent event chunks.
# LangChain, LlamaIndex, Vercel AI SDK, and CrewAI can use the same base URL
# when their OpenAI-compatible provider accepts a custom endpoint.| Gateway | Best known for | nRouter perspective |
|---|---|---|
| /v1/chat/completions | Chat and streaming completions | Supported through the OpenAI-compatible request format; model capability and streaming behavior vary by model. |
| /v1/models | Model discovery | Returns the live catalogue surface used to verify IDs and capabilities. |
| /v1/embeddings | Embeddings | Available where the selected embedding model and provider support the endpoint. |
| /v1/images | Image generation | Available where supported by the selected model and provider. |
| /v1/audio and /v1/videos | Audio operations and video jobs | Available where supported; consult the API reference for request and polling behavior. |
nRouter passes through provider list prices with 0% token markup. Pay-as-you-go credits currently carry a 4% platform fee added on top. The compatible API layer also connects to routing, guardrails, budgets, and observability; see the pricing page for current allowances and terms.
It is an API that follows familiar OpenAI client and request conventions so applications can use a compatible SDK or REST shape against another gateway or provider layer.
Yes. Set the client base_url to https://api.nrouter.ai/v1 and use an nRouter virtual key, then select a model from the live catalogue.
The canonical base URL is https://api.nrouter.ai/v1.
Yes, where the model is available in the nRouter catalogue and supports the requested endpoint. Check the model capability metadata because provider features and parameters vary.
Streaming chat completions use stream: true and server-sent event chunks. Your client should handle partial output and stream errors; do not assume mid-stream replay to another provider.
Yes, where the selected embedding model and provider support /v1/embeddings. Verify the live catalogue and API reference before rollout.
Usually the migration starts with changing the endpoint, key, and model ID, followed by testing provider-specific parameters, streaming, errors, budgets, and guardrails.
Tool calling is supported where the selected model and provider expose it. Test the exact model, schema, and response behavior because tool support is not identical across providers.
Some parameters are provider- or model-specific and may not transfer through a common API. The API reference and model catalogue are the source of truth.
Configured routing can select eligible fallback providers or models for retryable failures, subject to capability, budget, timeout, and policy checks.
Use the standard client with the nRouter base URL.
Keep agent integrations stable while changing model policies.
Understand compatibility and recovery behavior across providers.
Add routing, budgets, caching, and cost governance.
Review the tested endpoint list, request shapes, and endpoint-specific behavior.
Set the base URL, create a key, and send your first request.
Move from OpenAI and other gateways with practical integration steps.
Compare live models, capabilities, context windows, and pricing.
Connect SDKs and frameworks through the compatible API surface.
Configure provider and model selection policies.
Add PII redaction and prompt-injection protection in the request path.
Enforce organization, team, and key spend limits.
Track requests, latency, usage, and cost centrally.
Compare compatible API access with governance and budget controls.
Compare migration paths, integrations, and gateway controls.
Compare host-neutral routing and request-path governance.
Build on one gateway
Start with one OpenAI-compatible key, then add routing, budgets, guardrails, and observability as your workload grows.