langfuse-client-base 0.25.0

Auto-generated Langfuse API client from OpenAPI specification
Documentation

langfuse-client-base

crates.io docs.rs MSRV dependencies CI license

A low-level async Rust client for the Langfuse API: one function per operation and a type per schema of Langfuse's published OpenAPI specification. The code is generated by timvw-rust from the upstream spec; nothing is patched afterwards. Requests go through timvw-rust-runtime, a tower service (reqwest unless you replace it) with retries.

Most applications want langfuse-ergonomic, built on this crate, with batching, environment-based configuration and OpenTelemetry integration. Use this crate directly for raw access to every endpoint.

Quick start

cargo add langfuse-client-base
use langfuse_client_base::apis::{configuration::Configuration, health_api};

# async fn run() -> Result<(), Box<dyn std::error::Error>> {
let mut configuration = Configuration::new();
configuration.base_path = "https://cloud.langfuse.com".to_owned();
configuration.basic_auth = Some((
    std::env::var("LANGFUSE_PUBLIC_KEY")?,
    Some(std::env::var("LANGFUSE_SECRET_KEY")?.into()),
));

let health = health_api::health_health()
    .configuration(&configuration)
    .call()
    .await?;
println!("Langfuse {} is {}", health.version, health.status);
# Ok(())
# }

Key features

  • Every endpoint of the spec, plus the published v3 bindings for self-hosted servers that still serve them (usage).
  • Typed models and errors: unions decode by their tag, enums accept values the spec does not list yet, and error responses decode into a typed error per operation (usage).
  • A tower client: retries of 429, 408, 5xx and failed connections honouring Retry-After, timeouts, logging, your own middleware, and per-call headers, query parameters or base URL (HTTP client).
  • rustls or native TLS, and WebAssembly (wasm32-unknown-unknown) (platforms).

Documentation

Page What it covers
API reference (docs.rs) Every operation and model
Usage Configuration, self-hosted instances, legacy v3 bindings, errors
HTTP client Retries, timeouts, middleware, per-call options
Platforms Cargo features, TLS backends, musl and static builds, WebAssembly
Upgrading What each breaking release changed, with migration notes
Generation How the crate is generated and checked, and how to change it
Contributing Where changes belong

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.