1
Setup the SDK
JavaScript
Learn how to set up the JS SDK.
2
Monitor OpenAI
With our SDKs, tracking OpenAI calls is super simple.
3
Tag requests and identify users
You can now tag requests and identify users.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Setup the SDK
Monitor OpenAI
import OpenAI from "openai";
import { monitorOpenAI } from "lunary/openai";
// Simply call monitor() on the OpenAIApi class to automatically track requests
const openai = monitorOpenAI(new OpenAI());
Tag requests and identify users
const result = await openai.chat.completions.create({
model: "gpt-4o",
temperature: 0.9,
tags: ["chat", "support"], // Optional: tags
user: "user_123", // Optional: user ID
userProps: { name: "John Doe" }, // Optional: user properties
messages: [
{ role: "system", content: "You are an helpful assistant" },
{ role: "user", content: "Hello friend" },
],
});