#openapi #langfuse #openapi-client #llm #api-client

langfuse-client-base

Auto-generated Langfuse API client from OpenAPI specification

19 releases (8 breaking)

new 0.9.0 Feb 9, 2026
0.7.1 Dec 17, 2025
0.6.1 Nov 18, 2025

#46 in HTTP client

Download history 73/week @ 2025-10-20 125/week @ 2025-10-27 75/week @ 2025-11-03 10/week @ 2025-11-10 44/week @ 2025-11-17 96/week @ 2025-11-24 93/week @ 2025-12-01 56/week @ 2025-12-08 203/week @ 2025-12-15 135/week @ 2025-12-22 48/week @ 2025-12-29 73/week @ 2026-01-05 56/week @ 2026-01-12 104/week @ 2026-01-19 60/week @ 2026-01-26 79/week @ 2026-02-02

303 downloads per month
Used in 2 crates (via langfuse-ergonomic)

MIT/Apache

1MB
17K SLoC

langfuse-client-base

Crates.io Documentation CI MSRV License

Auto-generated Rust client for the Langfuse API, based on the official OpenAPI specification.

[!WARNING] Important: most users should use langfuse-ergonomic instead.

This is a low-level, auto-generated client intended as a building block for higher-level abstractions. The ergonomic wrapper provides:

  • Simplified APIs with builder patterns
  • Automatic batching and retries
  • Environment-based configuration
  • Improved error handling
  • Built-in OpenTelemetry integration

Only use this crate directly if you need:

  • Raw access to all OpenAPI endpoints
  • Custom retry/batching logic
  • Minimal dependencies

Features

  • Complete API coverage from OpenAPI specification
  • Async/await support with Tokio
  • Choice of TLS backend (rustls or native-tls)
  • Strong typing with serde

Installation

[dependencies]
langfuse-client-base = "*" # See https://crates.io/crates/langfuse-client-base for latest version

Usage

This crate provides low-level API bindings. Most users should use the ergonomic wrapper instead.

Basic Configuration

use langfuse_client_base::apis::configuration::Configuration;
use langfuse_client_base::apis::ingestion_api;

let config = Configuration {
    base_path: "https://cloud.langfuse.com".to_string(),
    basic_auth: Some(("your-public-key".to_string(), Some("your-secret-key".to_string()))),
    ..Default::default()
};

// Use the API...

Using Environment Variables

use std::env;
use langfuse_client_base::apis::configuration::Configuration;

let config = Configuration {
    base_path: env::var("LANGFUSE_HOST").unwrap_or_else(|_| "https://cloud.langfuse.com".to_string()),
    basic_auth: Some((
        env::var("LANGFUSE_PUBLIC_KEY").expect("LANGFUSE_PUBLIC_KEY not set"),
        Some(env::var("LANGFUSE_SECRET_KEY").expect("LANGFUSE_SECRET_KEY not set"))
    )),
    ..Default::default()
};

Self-Hosted Instances

For self-hosted Langfuse instances:

use langfuse_client_base::apis::configuration::Configuration;

let config = Configuration {
    base_path: "https://your-domain.com/langfuse".to_string(),  // Custom base path
    basic_auth: Some(("your-public-key".to_string(), Some("your-secret-key".to_string()))),
    ..Default::default()
};

Platform Notes

TLS Backend

By default, this crate uses rustls for TLS, which provides:

  • A pure Rust implementation
  • Smaller binary size
  • Better cross-platform compatibility

For native TLS (OpenSSL on Linux, Schannel on Windows, Security Framework on macOS):

[dependencies]
langfuse-client-base = { version = "*", default-features = false, features = ["native-tls"] }

Alpine Linux / musl

When building for Alpine Linux or other musl-based systems with native-tls:

RUN apk add --no-cache openssl-dev musl-dev

Static Linking

For fully static binaries with rustls:

RUSTFLAGS="-C target-feature=+crt-static" cargo build --release --target x86_64-unknown-linux-musl

Generation

This client is generated from the OpenAPI specification using Docker for reproducible builds.

# Generate client (always uses Docker)
./scripts/generate-openapi-client.sh

# Update to latest OpenAPI spec and regenerate
UPDATE_SPEC=true ./scripts/generate-openapi-client.sh

License

Licensed under either of:

Contributing

This is auto-generated code. To make changes, please update the generation process or contribute to the main repository.

Dependencies

~9–27MB
~341K SLoC