Lunos logoLunos

Configuration

All options are optional except apiKey. The SDK reads LUNOS_API_KEY and LUNOS_BASE_URL from environment variables automatically, so you can often instantiate with just new Lunos().

Client Options

Option Default Description
apiKey env.LUNOS_API_KEY Your Lunos secret key
baseURL https://api.lunos.tech API base URL
appId Identifies your app in Lunos analytics dashboard
timeout 60000 Request timeout in milliseconds
maxRetries 2 Auto-retry count for transient failures
defaultHeaders Extra headers sent with every request
fetch globalThis.fetch Custom fetch implementation

Basic Usage

import Lunos from "@lunos/sdk";

// Minimal — reads LUNOS_API_KEY from environment
const client = new Lunos();

// With explicit options
const client = new Lunos({
  apiKey: "sk-...",
  appId: "my-service-v1",
  timeout: 30_000,
  maxRetries: 3,
});

Environment Variables

The SDK automatically reads these environment variables:

LUNOS_API_KEY=sk-your-api-key
LUNOS_BASE_URL=https://api.lunos.tech  # optional

App ID

The appId option tags all requests with your application identifier. This shows up in your Lunos usage analytics dashboard, making it easy to track usage per service.

const client = new Lunos({
  apiKey: "sk-...",
  appId: "my-chatbot-v2",
});

Custom Fetch

For environments with custom networking requirements, you can provide your own fetch implementation:

import Lunos from "@lunos/sdk";

const client = new Lunos({
  apiKey: "sk-...",
  fetch: myCustomFetch,
});

Per-Request Overrides

Override timeout and retries on individual requests:

await client.chat.completions.create(
  { model: "openai/gpt-4o", messages: [{ role: "user", content: "Hi" }] },
  { timeout: 120_000, maxRetries: 5 },
);