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

# OpenLIT

> Giám sát các yêu cầu tương thích với OpenAI của TokenLab bằng OpenLIT

## Tổng quan

OpenLIT thực hiện instrumentation cho các SDK chính thức của OpenAI, nhờ đó các yêu cầu TokenLab có thể được giám sát bằng cách cấu hình SDK client với base URL `/v1` của TokenLab.

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

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

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

## Cài đặt

```bash theme={null}
pip install openlit openai
```

## Môi trường

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

## Ví dụ

```python theme={null}
import os

import openlit
from openai import OpenAI

openlit.init()

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": "Hello from OpenLIT"}],
)
```

## Lưu ý về Endpoint

OpenLIT tuân theo đường dẫn instrumentation của SDK. Chat Completions là bề mặt tích hợp an toàn nhất; các lệnh gọi native khác của TokenLab phụ thuộc vào việc thiết lập OpenLIT/OpenTelemetry của bạn có nắm bắt được phương thức SDK hoặc HTTP client đó hay không.
