NyxosNyxos API
Integrations

Python & Node.js SDK Integration

Code examples using the official OpenAI and Anthropic SDKs with a Nyxos gateway.

Because the gateways follow the industry-standard OpenAI and Anthropic protocols, you can use the official SDKs directly — no third-party wrappers needed.


Python: OpenAI Official SDK

The gateway exposes a full OpenAI-compatible /v1 API:

from openai import OpenAI

client = OpenAI(
    base_url="https://api.nyxos.shop/v1",
    api_key="sk-YOUR_NYXOS_KEY",
)

response = client.chat.completions.create(
    model="<exact-model-id>",  # copied from https://api.nyxos.shop/pricing
    messages=[
        {"role": "system", "content": "You are an expert software engineer."},
        {"role": "user", "content": "Explain async I/O in Python."},
    ],
)

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

Python: Anthropic Official SDK

Use the root host — the SDK appends /v1/messages itself:

import anthropic

client = anthropic.Anthropic(
    base_url="https://api.nyxos.shop",  # NO /v1 here
    api_key="sk-YOUR_NYXOS_KEY",
)

message = client.messages.create(
    model="<exact-claude-id>",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Write a high-performance LRU cache in Rust."}
    ],
)

print(message.content[0].text)

Node.js / TypeScript: OpenAI SDK

import OpenAI from "openai";

const openai = new OpenAI({
  baseURL: "https://api.nyxos.shop/v1",
  apiKey: "sk-YOUR_NYXOS_KEY",
});

const completion = await openai.chat.completions.create({
  model: "<exact-model-id>",
  messages: [
    { role: "system", content: "You are a concise engineering assistant." },
    { role: "user", content: "Compare Redis cluster vs Sentinel." },
  ],
});

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

Quick Health Check

Verify token + network with the cheapest possible call:

curl https://api.nyxos.shop/v1/models \
  -H "Authorization: Bearer sk-YOUR_NYXOS_KEY"

A JSON list of model IDs means the key, group permissions, and endpoint are all working.

On this page