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

# Phoenix

> Theo dõi các yêu cầu tương thích với OpenAI của TokenLab bằng Arize Phoenix

## Tổng quan

Phoenix có thể theo dõi các yêu cầu TokenLab bằng cách tự động đo lường (auto-instrument) client Python của OpenAI được cấu hình với base URL tương thích với OpenAI của TokenLab.

<Note>
  **Loại**: Khả năng quan sát (Observability)

  **Đường dẫn chính**: Đo lường OpenAI SDK

  **Độ tin cậy hỗ trợ**: Đường dẫn theo dõi tương thích với OpenAI được hỗ trợ
</Note>

## Cài đặt

```bash theme={null}
pip install arize-phoenix openinference-instrumentation-openai openai
```

## Môi trường

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

## Đăng ký Phoenix

```python theme={null}
from phoenix.otel import register

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

## Gọi TokenLab

```python theme={null}
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)
```

## Lưu ý về Endpoint

Phoenix theo dõi đường dẫn gọi OpenAI SDK. Hãy sử dụng trang này cho các lệnh gọi TokenLab theo kiểu Chat Completions. Các endpoint gốc khác của TokenLab vẫn có thể được theo dõi nếu việc đo lường ứng dụng của bạn nắm bắt được client mà bạn sử dụng cho các yêu cầu đó.
