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

# OpenLLMetry

> Trace TokenLab OpenAI-compatible requests with OpenLLMetry

## Overview

OpenLLMetry's OpenAI instrumentation traces calls made through the official OpenAI SDK. Configure that SDK with TokenLab'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 TOKENLAB_API_KEY="sk-your-tokenlab-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["TOKENLAB_API_KEY"],
    base_url="https://api.tokenlab.sh/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 TokenLab calls. For TokenLab native endpoints, instrument the HTTP or SDK client that actually sends those requests.
