OpenAI integration

Our SDKs include automatic integration with OpenAI's modules.

2

Monitor OpenAI

With our SDKs, tracking OpenAI calls is super simple.

import OpenAI from "openai"
import { monitorOpenAI } from "lunary/openai"
// Simply call monitor() on the OpenAIApi class to automatically track requests
const openai = new OpenAI()
const openai = monitorOpenAI(new OpenAI())
3

Tag requests and identify users

You can now tag requests and identify users.

const result = await openai.chat.completions.create({
model: "gpt-3.5-turbo",
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" },
],
})

Questions? We're here to help.