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

# Langfuse

> Verfolgen Sie TokenLab OpenAI-kompatible Anfragen mit Langfuse

## Übersicht

Langfuse kann TokenLab-Aufrufe über seine OpenAI-Integration nachverfolgen, wenn das OpenAI SDK mit der `/v1` Basis-URL von TokenLab konfiguriert ist.

<Note>
  **Typ**: Observability

  **Primärer Pfad**: OpenAI SDK Tracing

  **Support-Status**: Unterstützter OpenAI-kompatibler Tracing-Pfad
</Note>

## Umgebung

```bash theme={null}
export LANGFUSE_SECRET_KEY="sk-lf-..."
export LANGFUSE_PUBLIC_KEY="pk-lf-..."
export LANGFUSE_BASE_URL="https://cloud.langfuse.com"
export TOKENLAB_API_KEY="sk-your-tokenlab-key"
```

## Beispiel

```python theme={null}
import os

from langfuse import observe
from langfuse.openai import openai

openai.api_key = os.environ["TOKENLAB_API_KEY"]
openai.base_url = "https://api.tokenlab.sh/v1"


@observe()
def story():
    return openai.chat.completions.create(
        model="claude-sonnet-5",
        messages=[{"role": "user", "content": "Write a short haiku."}],
    ).choices[0].message.content
```

## Hinweise zu Endpunkten

Diese Seite behandelt das Langfuse-Tracing für den OpenAI SDK-Pfad. Wenn Ihre Anwendung native TokenLab-Responses, Anthropic Messages oder Gemini-Endpunkte verwendet, stellen Sie sicher, dass Ihre Instrumentierung diesen Client-Aufrufpfad erfasst.
