개요
OpenLIT은 공식 OpenAI SDK를 계측하므로, SDK 클라이언트를 TokenLab의/v1 베이스 URL로 구성하여 TokenLab 요청을 모니터링할 수 있습니다.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
OpenLIT을 사용하여 TokenLab OpenAI 호환 요청 모니터링하기
/v1 베이스 URL로 구성하여 TokenLab 요청을 모니터링할 수 있습니다.
pip install openlit openai
export TOKENLAB_API_KEY="sk-your-tokenlab-key"
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"}],
)