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().
| 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 |
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,
});
The SDK automatically reads these environment variables:
LUNOS_API_KEY=sk-your-api-key
LUNOS_BASE_URL=https://api.lunos.tech # optional
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",
});
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,
});
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 },
);
No headings found on this page.
