1
Setup the SDK
Python
Learn how to set up the Python 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
from openai import OpenAI
import lunary
client = OpenAI()
lunary.monitor(client) # This line sets up monitoring for all calls made through the 'openai' module
chat_completion = client.chat.completions.create(
model="gpt-4.1",
messages=[{"role": "user", "content": "Hello world"}]
)
Tag requests and identify users
chat_completion = client.chat.completions.create(
model="gpt-4.1",
user_id="user_123", # Optional: user ID
user_props={"name": "John Doe"}, # Optional: user properties
tags=["chat", "support"], # Optional: add tags
messages=[{"role": "user", "content": "Hello world"}]
)