> ## 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

> Rastreie requisições compatíveis com OpenAI no TokenLab usando o OpenLLMetry

## Visão Geral

A instrumentação OpenAI do OpenLLMetry rastreia chamadas feitas através do SDK oficial da OpenAI. Configure esse SDK com a URL base `/v1` do TokenLab.

<Note>
  **Tipo**: Observabilidade

  **Caminho Principal**: Instrumentação do SDK da OpenAI

  **Nível de Suporte**: Caminho de observabilidade compatível com OpenAI suportado
</Note>

## Instalação

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

## Ambiente

```bash theme={null}
export TOKENLAB_API_KEY="sk-your-tokenlab-key"
```

## Exemplo

```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"}],
)
```

## Notas sobre o Endpoint

Use este caminho para chamadas do TokenLab compatíveis com o SDK da OpenAI. Para endpoints nativos do TokenLab, instrumente o cliente HTTP ou SDK que efetivamente envia essas requisições.
