Skip to main content

Overview

Phoenix can trace TokenLab requests by auto-instrumenting the OpenAI Python client configured with TokenLab’s OpenAI-compatible base URL.
Type: ObservabilityPrimary Path: OpenAI SDK instrumentationSupport Confidence: Supported OpenAI-compatible tracing path

Installation

pip install arize-phoenix openinference-instrumentation-openai openai

Environment

export TOKENLAB_API_KEY="sk-your-tokenlab-key"

Register Phoenix

from phoenix.otel import register

tracer_provider = register(
    project_name="tokenlab-app",
    auto_instrument=True,
)

Call TokenLab

import os

from openai import OpenAI

client = OpenAI(
    api_key=os.environ["TOKENLAB_API_KEY"],
    base_url="https://api.tokenlab.sh/v1",
)

response = client.chat.completions.create(
    model="claude-sonnet-5",
    messages=[{"role": "user", "content": "Write a short haiku."}],
)

print(response.choices[0].message.content)

Endpoint Notes

Phoenix traces the OpenAI SDK call path. Use this page for Chat Completions style TokenLab calls. Other TokenLab native endpoints can still be traced if your application instrumentation captures the client you use for those requests.