Documentation

Compatible client SDKs in the NexoRouter documentation.

Compatible client SDKs

Status: OpenAI SDK is stable for documented endpoints. Other clients are candidates until tested.

NexoRouter does not publish a first-party SDK yet. The recommended integration is direct HTTP or an OpenAI client that lets you configure base_url, API key, and model ID.

Choose a client

OptionStatusUse it when
curl or fetchStableYou want to see the exact request, debug headers, or minimize dependencies.
OpenAI SDK for PythonStable for documented Chat CompletionsYour service uses Python and you want typed objects and built-in HTTP handling.
OpenAI SDK for Node.jsStable for documented Chat CompletionsYour app uses Node.js or TypeScript.
OpenAI SDKs for other languagesCandidateThe client supports a custom base URL and keeps the /chat/completions endpoint.
Agent frameworksCandidateYou have verified basic chat and the client/model combination needed by your agent.

“Compatible” does not mean every SDK method is available. NexoRouter only guarantees endpoints published in the API Reference.

Shared configuration

API key: a key created in NexoRouter
Base URL: https://api.nexorouter.com/v1
Model: a current ID from Models or GET /v1/models
Method: Chat Completions

Keep the key on the server. Do not put it in browser-delivered JavaScript, distributed mobile apps, repositories, screenshots, or logs.

Python

Install the client:

python -m pip install --upgrade openai
export NEXOROUTER_API_KEY="your_nexorouter_key"

Create main.py:

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["NEXOROUTER_API_KEY"],
    base_url="https://api.nexorouter.com/v1",
    timeout=60.0,
    max_retries=2,
)

response = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[
        {"role": "system", "content": "Answer clearly and briefly."},
        {"role": "user", "content": "Give me three checks before releasing an API integration."},
    ],
    max_tokens=256,
)

print(response.choices[0].message.content)
print(response.usage)

Run it:

python main.py

Node.js and TypeScript

Install the client:

npm install openai
export NEXOROUTER_API_KEY="your_nexorouter_key"
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.NEXOROUTER_API_KEY,
  baseURL: "https://api.nexorouter.com/v1",
  timeout: 60_000,
  maxRetries: 2,
});

const response = await client.chat.completions.create({
  model: "deepseek-v4-flash",
  messages: [
    { role: "system", content: "Answer clearly and briefly." },
    { role: "user", content: "Give me three checks before releasing an API integration." },
  ],
  max_tokens: 256,
});

console.log(response.choices[0].message.content);
console.log(response.usage);

Direct HTTP with fetch

This option avoids relying on additional SDK methods:

const response = await fetch("https://api.nexorouter.com/v1/chat/completions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.NEXOROUTER_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "deepseek-v4-flash",
    messages: [{ role: "user", content: "Reply with: connected" }],
    max_tokens: 32,
  }),
});

const body = await response.json();

if (!response.ok) {
  throw new Error(`${response.status} ${body?.error?.code ?? "api_error"}: ${body?.error?.message ?? "Request failed"}`);
}

console.log(body.choices[0].message.content);

Compatibility checks

Before adopting another SDK, confirm that it:

  1. Lets you change the base URL.
  2. Sends Authorization: Bearer ....
  3. Uses POST /v1/chat/completions, not only /v1/responses.
  4. Sends the exact model ID without renaming it.
  5. Works without streaming.
  6. Exposes HTTP status, error body, and rate-limit headers.

If the SDK creates embeddings, Responses API, Anthropic Messages, or Gemini-native requests, that part is outside the current compatibility boundary.

Production

  • Create a separate key for each environment and service.
  • Set budget, expiry, and model scope.
  • Use a timeout and bounded retries only for transient failures.
  • Respect retry-after on 429 responses.
  • Log request ID, model ID, and status; never log the key or full prompts by default.
  • Check Usage Logs for tokens, cost, latency, and errors.

Next

Compatible client SDKs — NexoRouter