Documentation

Quickstart in the NexoRouter documentation.

Quickstart

This guide gets a first OpenAI-compatible NexoRouter request working in a few minutes.

Choose a path

PathBest forStatus
API with curl or fetchFirst test, debugging, and services without an SDKStable
OpenAI SDKPython, Node.js, or TypeScript apps already using Chat CompletionsStable for documented endpoints
Compatible SDK in another languageClients that support a custom base URLCandidate; complete the compatibility checklist
Agent frameworkMulti-step loops, memory, and toolsCandidate; verify chat, model, and tool calling separately
CookbookA runnable example projectStable within the capabilities it declares

NexoRouter does not publish a first-party SDK yet. “OpenAI-compatible” means you can reuse the documented Chat Completions shape; it does not automatically make every SDK method compatible.

Path

StepGoalWhere to verify
Create a keyGet a credential for one project or toolDashboard -> API Keys
Pick a modelCopy the exact model IDModels
Send a requestConfirm the API path worksTerminal or app logs
Check the resultConfirm billing, latency, and request IDUsage Logs

What you need

  • A NexoRouter account.
  • Prepaid balance in Billing.
  • An active API key from Dashboard -> API Keys.
  • A publicly available model ID from Models.

1. Create an API key

Open Dashboard -> API Keys and create a key.

NexoRouter sign-up page

Recommended settings for a first test:

FieldSuggested value
Namelocal-dev or the project name
BudgetWorkspace balance for a quick test, or $5 for a hard cap
Expiry30 days for local testing, never only when you manage rotation elsewhere
Model scopeAll models for exploration, or one copied model ID for strict control

Copy the full key when it is shown. Store it in an environment variable and do not paste it into Git, screenshots, tickets, or public chat.

export NEXOROUTER_API_KEY="your_nexorouter_key"

2. Set the base URL

Use the production base URL:

https://api.nexorouter.com/v1

Most SDKs and tools want the base URL only up to /v1. Do not add /chat/completions unless the tool explicitly asks for a full endpoint.

Field name in toolsValue
Base URL, API URL, OpenAI Base URL, or Endpointhttps://api.nexorouter.com/v1
API key, OpenAI API key, or Bearer tokenYour NexoRouter API key
ModelA model ID copied from Models

3. Choose a model

Open Models and copy the exact model ID. Model IDs are case-sensitive.

NexoRouter model catalog

Good first choices:

Model IDBest for
kimi-k2.6Low-cost API checks, automation, and agent loops
kimi-k3General app features, extraction, and support workflows

4. Send a request

curl https://api.nexorouter.com/v1/chat/completions \
  -H "Authorization: Bearer $NEXOROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kimi-k2.6",
    "messages": [
      { "role": "system", "content": "You are a concise assistant." },
      { "role": "user", "content": "Reply with one sentence: NexoRouter is connected." }
    ],
    "temperature": 0.7,
    "max_tokens": 128
  }'

A successful response contains the answer at choices[0].message.content.

5. Use an OpenAI SDK

Use the OpenAI SDK only with an explicit NexoRouter base URL. Keeping the official OpenAI default base URL while using a NexoRouter key will fail.

Install the matching package first:

python -m pip install --upgrade openai
# or
npm install openai

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="kimi-k2.6",
    messages=[
        {"role": "user", "content": "Reply with one sentence: NexoRouter is connected."}
    ],
)

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

Node.js / TypeScript:

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: "kimi-k2.6",
  messages: [
    { role: "user", content: "Reply with one sentence: NexoRouter is connected." },
  ],
});

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

Environment variable style:

export OPENAI_API_KEY="$NEXOROUTER_API_KEY"
export OPENAI_BASE_URL="https://api.nexorouter.com/v1"

Use this only for local tools or apps that already read OPENAI_API_KEY and OPENAI_BASE_URL. Do not overwrite real OpenAI credentials in a shared environment.

Confirm it in the Dashboard

After the request, open Usage Logs and check:

  • API key name.
  • Model ID.
  • Prompt and completion tokens.
  • Cost in USD and quota units.
  • Latency.
  • Request ID.
  • Success or error status.

If the first request fails

SymptomFirst checkNext page
invalid_api_keyKey value, Bearer header, base URL, expiry, enabled stateAPI key invalid
model_not_foundModel ID spelling and key model scopeModel not found
insufficient_quotaBilling balance and key budgetBalance insufficient
TimeoutClient timeout, model speed, non-streaming requestTimeouts

Do not send your full API key to support. Send the key name, last four characters, request ID, model ID, and approximate time.

Success checklist

  • The HTTP response is 200.
  • choices[0].message.content contains text.
  • Usage Logs shows the expected key and model ID.
  • Tokens, cost, and latency are reasonable for the request.
  • The key is not present in client code, Git, or logs.
  • The model was copied from the current catalog, not an old guide.

Next