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 langchain langchain-openai

Basic Usage

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    api_key="your-nordlys-api-key",
    base_url="https://api.nordlylabs.com/v1",
    model=""
)

response = llm.invoke("Explain machine learning simply")
print(response.content)

Streaming Example

for chunk in llm.stream("Tell me a story about AI"):
    print(chunk.content, end="", flush=True)

Key Features

  • Drop-in replacement - Works with existing LangChain code
  • Nordlys model - Automatic Nordlys model based on complexity
  • Streaming support - Real-time responses work seamlessly
  • Chain compatibility - All LangChain patterns work without changes

Next Steps