> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lunary.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI integration

Our Python SDK includes automatic integration with OpenAI's module.

**1. Setup the SDK**

> [card] [Python](https://docs.lunary.ai/integrations/python/installation.md)
>
> Learn how to set up the Python SDK.

**2. Monitor OpenAI**

With our SDKs, tracking OpenAI calls is super simple.

```py theme={null}
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"}]
)
```

**3. Tag requests and identify users**

You can now tag requests and identify users.

```py theme={null}
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"}]
)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.