← Back to changelog
February 5, 2025

Typed public API client in SDKs

Picture Hassieb PakzadHassieb Pakzad

Access all of Langufuse public API resources via a typed client in our SDKs

Both the Langfuse Python SDK and the JS/TS SDK now provide a strongly-typed wrapper around our public REST API for your convenience. The API methods are accessible via the api property on the Langfuse client instance in both SDKs.

When using the decorator-based integration:

from langfuse.decorators import langfuse_context
 
# fetch a trace
langfuse_context.client_instance.api.trace.get(trace_id)
 
# async client via asyncio
await langfuse_context.client_instance.async_api.trace(trace_id)

When using the low-level SDK:

from langfuse import Langfuse
 
langfuse = Langfuse()
...
# fetch a trace
langfuse.api.trace.get(trace_id)
 
# async client via asyncio
await langfuse.async_api.trace(trace_id)

Learn more

Was this page useful?

Questions? We're here to help

Subscribe to updates