Documentation
OpenAI-compatible API docs for NexoRouter's model gateway.
Quickstart
OpenAI-compatibleNexoRouter 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 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
}'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)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
| Production | https://api.nexorouter.com/v1 |
| Local development | http://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.
Authorization: Bearer YOUR_API_KEYChat 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 https://api.nexorouter.com/v1/models \
-H "Authorization: Bearer $NEXOROUTER_API_KEY"| Starter model | Best for |
|---|---|
| deepseek-v4-flash | Fast, low-cost product features and agent loops |
| gpt-4o-mini | General app workflows, extraction, and support |
| Qwen/Qwen-Plus | Balanced 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 limits | Use key budgets and model scopes today. |
| Traffic limits | RPM and TPM automation is planned for the gateway layer. |
| Balance limits | Requests stop when prepaid balance is exhausted. |
Errors
Public API errors use a stable English JSON shape compatible with OpenAI-style clients.
{
"error": {
"message": "Insufficient prepaid balance. Current balance: $0.000000.",
"type": "invalid_request_error",
"code": "insufficient_quota"
}
}| HTTP | Code | Meaning |
|---|---|---|
| 401 | invalid_api_key | The API key is missing, disabled, expired, or malformed. |
| 403 | insufficient_quota | The workspace or key does not have enough prepaid balance. |
| 400 | invalid_request_error | The request body, model ID, or parameters are not valid. |
| 403 | model_not_allowed | The key was created with a model scope that excludes this model. |
| 404 | model_not_found | The requested model is not available for public sale. |
| 5xx | gateway_error | The 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.
# 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",
)