from langfuse.openai import openai — so you get full call tracing by importing that instead of openai and pointing base_url at https://api.tokios.com/v1 with an sk-tok-… key. Because the wrapper mirrors the OpenAI client’s interface, anything you already send to Tokios (chat completions, streaming, tool calls) gets traced with no change beyond the import and the base URL.
사전 요구 사항
Langfuse 계정 또는 자체 호스팅 환경
Langfuse Cloud에 가입하거나 자체 호스팅 인스턴스를 구축한 뒤 Langfuse 공개/비밀 API 키 쌍을 확보하세요.
커넥터 설치하기
Pair
tokios-connector with your local backend.배포 환경 등록하기
Choose the public name your
model field will use.API 키 생성하기
필요한 배포 환경에 맞게
sk-tok-… API 키를 생성하세요.호출 내역 추적하기
1
두 SDK 모두 설치하기
2
Langfuse 인증 정보를 설정하세요.
Langfuse의 OpenAI 래퍼는 환경 변수에서 인증 정보를 읽어들입니다:
3
래퍼를 임포트한 뒤 원하는 배포 환경을 호출하세요.
Import 이 클라이언트를 통한 모든 호출이 Langfuse에 기록됩니다. 호출 자체를 위해
openai from langfuse.openai instead of the plain openai package, then use it exactly like the standard OpenAI client, with base_url pointed at Tokios and model set to your registered deployment name:langfuse_tokios.py
@observe 데코레이터나 수동으로 스팬을 생성할 필요가 없습니다.model is always the Tokios deployment name you registered in the Models tab, never your backend’s local model id, and the base URL must include /v1.로컬 모델에 대한 비용 추적
Langfuse calculates cost from a model’s per-token price, which it knows for hosted providers like OpenAI and Anthropic. A Tokios deployment fronts your own local model, so Langfuse has no built-in price for it — traces still capture prompts, completions, latency, and token counts, but cost may show as zero or missing until you tell Langfuse how to price that model.이제 어디서든 추적이 가능합니다
위에서 설명한 추적 설정은 Tokios를 호출하는 클라이언트가 사용자의 노트북에 있든 팀원의 기기에 있든 동일하게 작동합니다. 커넥터는 오직 로컬 백엔드에서만 외부로 연결됩니다. 팀원이나 배포된 에이전트가 범위가 지정된sk-tok-… API 키를 보유하게 되면, 동일한 langfuse.openai 래퍼를 통해 전송된 요청들도 같은 Langfuse 프로젝트에 기록됩니다.
호환 가능한 클라이언트
Tokios와 연동 가능한 OpenAI 및 Anthropic 호환 클라이언트 목록을 전체적으로 확인해보세요.
API 키
팀원이나 에이전트마다 별도의 범위 지정 API 키를 생성해주시기 바랍니다.
요청 로깅
전송된 내용만 확인하면 된다면 트레이싱 스택을 구축하는 대신 대시보드에서 요청 로깅 기능을 활성화하시면 됩니다.