Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.nordlyslabs.com/llms.txt

Use this file to discover all available pages before exploring further.

Quick Setup

  1. Sign up for an Nordlys API key
  2. Install the OpenAI SDK (if you haven’t already):
npm install openai
  1. Change two lines in your existing code:
import OpenAI from 'openai';

const openai = new OpenAI({
  apiKey: 'your-nordlys-api-key',        // ← Your Nordlys API key
  baseURL: 'https://api.nordlyslabs.com/v1' // ← Only change needed
});

// Everything else works exactly the same
const completion = await openai.chat.completions.create({
  model: 'nordlys/hypernova',
  messages: [{ role: 'user', content: 'Hello!' }]
});
That’s it! Your existing OpenAI code now uses Nordlys model.

Key Features

Same API

All OpenAI methods, parameters, and responses work identically

Model Model selection

Set model to nordlys/hypernova for the Nordlys model

Streaming

Streaming responses work exactly like OpenAI

Function Calling

Function calling and tools work without changes

Streaming Example

const stream = await openai.chat.completions.create({
  model: 'nordlys/hypernova',
  messages: [{ role: 'user', content: 'Tell me a story' }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content || '');
}

Response Format

Nordlys returns standard OpenAI responses:
{
  "id": "chatcmpl-123",
  "choices": [{
    "message": {"content": "Hello! How can I help you?"}
  }],
  "usage": {"total_tokens": 21}
}

Error Handling

Handle common errors gracefully:
try {
  const completion = await openai.chat.completions.create({
    model: 'nordlys/hypernova',
    messages: [{ role: 'user', content: 'Hello!' }]
  });
  console.log(completion.choices[0].message.content);
} catch (error) {
  if (error.status === 401) {
    console.error('Invalid API key');
  } else if (error.status === 429) {
    console.error('Rate limit exceeded - try again later');
  } else {
    console.error('API error:', error.message);
  }
}
Common Issues:
  • 401: Check your Nordlys API key
  • 429: Rate limit exceeded - implement retry logic
  • 400: Invalid request parameters

Need More Control?

API Reference

See all available parameters and options

Examples

Working code examples and use cases