Lunos logoLunos

Lunos SDK

The official TypeScript/JavaScript SDK for the Lunos AI API gateway — one unified, OpenAI-compatible interface to multiple AI providers.

Installation

npm install @lunos/sdk

Or with other package managers:

pnpm add @lunos/sdk
yarn add @lunos/sdk

Quick Start

import Lunos from "@lunos/sdk";

const client = new Lunos({
  apiKey: process.env.LUNOS_API_KEY,
});

const completion = await client.chat.completions.create({
  model: "openai/gpt-4o",
  messages: [{ role: "user", content: "Hello!" }],
});

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

Features

  • OpenAI-compatible — Drop-in replacement for the OpenAI SDK
  • Multi-provider — Access OpenAI, Anthropic, Google, and more through one API
  • Streaming — Real-time token streaming with async iterators
  • Auto-retry — Exponential backoff on transient failures (429, 5xx)
  • TypeScript-first — Full type safety with exported types
  • Lightweight — Zero dependencies, uses native fetch
  • Universal — Works in Node.js, Deno, Bun, Cloudflare Workers, and Vercel Edge

Requirements

  • Node.js ≥ 18 (or any runtime with global fetch)
  • TypeScript ≥ 4.9 (optional but recommended)

Resources

Resource Description
Configuration Client options and environment variables
Chat Completions Text generation and conversations
Streaming Real-time token streaming
Error Handling Error types and retry behavior