Skip to content

Quickstart

Get an API key and send your first request with curl, Python or Node.js.

1. Get an API key

Sign in with your Nodul account, create a Router space and an API key in it. The key is shown once: save it in an environment variable.

export NODUL_ROUTER_API_KEY="sk-nr-..."

Requests are billed in PnP to the payer of the space: make sure the payer's Nodul space has a positive PnP balance.

2. Send a request

Pick a model in the catalog and send a chat completion. Choose a model below to update the examples.

Base URL
https://router.nodul.ru/api/v1
curl https://router.nodul.ru/api/v1/chat/completions \
  -H "Authorization: Bearer $NODUL_ROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemma-3-4b-it",
    "messages": [{"role": "user", "content": "Say hello in one short sentence."}]
  }'
import os
from openai import OpenAI

client = OpenAI(base_url="https://router.nodul.ru/api/v1", api_key=os.environ["NODUL_ROUTER_API_KEY"])
completion = client.chat.completions.create(
    model="google/gemma-3-4b-it",
    messages=[{"role": "user", "content": "Say hello in one short sentence."}],
)
print(completion.choices[0].message.content)
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://router.nodul.ru/api/v1", apiKey: process.env.NODUL_ROUTER_API_KEY });
const completion = await client.chat.completions.create({
  model: "google/gemma-3-4b-it",
  messages: [{ role: "user", content: "Say hello in one short sentence." }],
});
console.log(completion.choices[0].message.content);

3. Read the response

The response is an OpenAI chat completion. Two fields matter for the router:

  • id is the generation id (gen-…): look the request up with GET /api/v1/generation?id=… or in the cabinet logs.
  • usage.cost is the amount charged for the request, in PnP.
{
  "id": "gen-5d0c3b6e-…",
  "object": "chat.completion",
  "model": "google/gemma-3-4b-it",
  "provider": "Google",
  "choices": [{ "index": 0, "finish_reason": "stop", "message": { "role": "assistant", "content": "Hello there!" } }],
  "usage": { "prompt_tokens": 14, "completion_tokens": 4, "total_tokens": 18, "cost": 0.000012 }
}
Nodul Router — one API for every model