Documentation

OpenAI-compatible API docs for NexoRouter's model gateway.

Quickstart

OpenAI-compatible

NexoRouter exposes a standard OpenAI-compatible API. Use your NexoRouter API key with existing OpenAI SDKs and switch only the base URL.

1. Create key

Generate a dashboard API key.

2. Set base URL

https://api.nexorouter.com/v1

3. Pick model

deepseek-v4-flash

curl
curl https://api.nexorouter.com/v1/chat/completions \
  -H "Authorization: Bearer $NEXOROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [
      {"role": "system", "content": "You are a concise assistant."},
      {"role": "user", "content": "Explain NexoRouter in Spanish."}
    ],
    "temperature": 0.7,
    "max_tokens": 512
  }'
python
import os
from openai import OpenAI

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

response = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[
        {"role": "system", "content": "You are a concise assistant."},
        {"role": "user", "content": "Explain NexoRouter in Spanish."},
    ],
)

print(response.choices[0].message.content)
javascript
import OpenAI from "openai";

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

const response = await client.chat.completions.create({
  model: "deepseek-v4-flash",
  messages: [
    { role: "system", content: "You are a concise assistant." },
    { role: "user", content: "Explain NexoRouter in Spanish." },
  ],
});

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

Base URLs

Productionhttps://api.nexorouter.com/v1
Local developmenthttp://localhost:3001/v1

Authentication

Send your key in the Authorization header. Keys are created in the NexoRouter dashboard and can be limited to specific sellable models.

header
Authorization: Bearer YOUR_API_KEY

Chat Completions

The public API supports OpenAI-compatible chat completions for sellable text models. Streaming, image, audio, and video endpoints remain internal until billing rules are finalized.

Endpoint

POST /chat/completions

Required

model, messages

Optional

temperature, max_tokens

Models

The public models endpoint returns only NexoRouter sellable models: confirmed pricing, token-billed text or embedding models, and model IDs that can be used directly in chat requests.

curl
curl https://api.nexorouter.com/v1/models \
  -H "Authorization: Bearer $NEXOROUTER_API_KEY"
Starter modelBest for
deepseek-v4-flashFast, low-cost product features and agent loops
gpt-4o-miniGeneral app workflows, extraction, and support
Qwen/Qwen-PlusBalanced multilingual generation and reasoning

Billing

NexoRouter uses prepaid balance. Stripe Checkout adds credits after the signed payment webhook is confirmed. API calls stop when prepaid balance reaches zero.

Balance

Shared by all workspace keys.

Key budget

Optional hard budget per API key.

Logs

Usage appears in dashboard logs.

Rate Limits

Private launch accounts should start with conservative traffic. If you need sustained production load, contact support so limits can be reviewed before scaling.

Key limitsUse key budgets and model scopes today.
Traffic limitsRPM and TPM automation is planned for the gateway layer.
Balance limitsRequests stop when prepaid balance is exhausted.

Errors

Public API errors use a stable English JSON shape compatible with OpenAI-style clients.

error shape
{
  "error": {
    "message": "Insufficient prepaid balance. Current balance: $0.000000.",
    "type": "invalid_request_error",
    "code": "insufficient_quota"
  }
}
HTTPCodeMeaning
401invalid_api_keyThe API key is missing, disabled, expired, or malformed.
403insufficient_quotaThe workspace or key does not have enough prepaid balance.
400invalid_request_errorThe request body, model ID, or parameters are not valid.
403model_not_allowedThe key was created with a model scope that excludes this model.
404model_not_foundThe requested model is not available for public sale.
5xxgateway_errorThe model gateway or provider returned an error.

OpenAI Migration

Most OpenAI SDK code works unchanged after replacing the API key and base URL. Keep your request body OpenAI-compatible and choose a model ID from the Models page.

python
# Before
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])

# After
client = OpenAI(
    api_key=os.environ["NEXOROUTER_API_KEY"],
    base_url="https://api.nexorouter.com/v1",
)
Quickstart documentation — NexoRouter