Skip to main content

Get Your Nordlys API Key

Sign up here to create an account and generate your API key.

Quick Setup

Installation

pip install llama-index-llms-openai llama-index-embeddings-openai

Basic Integration

import os
from llama_index.llms.openai import OpenAI
from llama_index.core import Settings

# Set your Nordlys API key
os.environ["OPENAI_API_KEY"] = os.environ["NORDLYS_API_KEY"]

# Initialize OpenAI client with Nordlys endpoint
llm = OpenAI(
    model="nordlys/hypernova",
    api_base="https://api.nordlylabs.com/v1",
    api_key=os.environ["NORDLYS_API_KEY"],
)

# Set as global model
Settings.llm = llm

# Use with simple queries
response = llm.complete("What is retrieval-augmented generation?")
print(response)

RAG Example

from llama_index.core import VectorStoreIndex, SimpleDirectoryReader

# Load documents
documents = SimpleDirectoryReader("data").load_data()

# Create index
index = VectorStoreIndex.from_documents(documents)

# Query with Mixture of Models
query_engine = index.as_query_engine()
response = query_engine.query("What are the benefits of RAG?")
print(response)

Key Benefits

  • Mixture of Models - Mixture of Models activation for queries and agents
  • RAG-optimized - Nordlys activates specialists per prompt
  • Cost optimization - 30-70% cost reduction across RAG pipelines
  • Agent support - Mixture of Models activation for function-calling agents

Next Steps