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

# OpenLLMetry

> Trace AI Sonar OpenAI-compatible requests with OpenLLMetry

## Overview

OpenLLMetry's OpenAI instrumentation traces calls made through the official OpenAI SDK. Configure that SDK with AI Sonar's `/v1` base URL.

<Note>
  **Type**: Observability

  **Primary Path**: OpenAI SDK instrumentation

  **Support Confidence**: Supported OpenAI-compatible observability path
</Note>

## Installation

```bash theme={null}
pip install opentelemetry-instrumentation-openai openai
```

## Environment

```bash theme={null}
export API_KEY="sk-your-api-key"
```

## Example

```python theme={null}
import os

from openai import OpenAI
from opentelemetry.instrumentation.openai import OpenAIInstrumentor

OpenAIInstrumentor().instrument()

client = OpenAI(
    api_key=os.environ["API_KEY"],
    base_url="https://api.aisonar.dev/v1",
)

client.chat.completions.create(
    model="claude-sonnet-5",
    messages=[{"role": "user", "content": "Trace this request"}],
)
```

## Endpoint Notes

Use this path for OpenAI SDK-compatible AI Sonar calls. For AI Sonar native endpoints, instrument the HTTP or SDK client that actually sends those requests.
