- HuggingFace Transformers Python SDK client
>= 4.48.0 - HuggingFace Inference TypeScript SDK (
@huggingface/inference)>= 2.0.0 - Transformers.js (
@huggingface/transformers>= 3or@xenova/transformers) for local inference
Supported APIs
| SDK | Instrumented surface | Inference type |
|---|---|---|
| Python | TextGenerationPipeline.__call__ | Local (transformers) |
| TypeScript | @huggingface/inference chat completions | Remote (Inference API) |
| TypeScript | Transformers.js pipeline calls (@huggingface/transformers / @xenova/transformers) | Local |
chat operation to match the Python SDK. Other local Transformers.js pipelines (summarization, translation, fill-mask, question-answering, classification) are reported as text_completion, and feature-extraction / sentence-similarity as embeddings.
Prerequisites
- Install the HuggingFace SDK yourself. OpenLIT does not bundle it as a dependency.
- For TypeScript, call
openlit.init()before the HuggingFace module is first loaded so OpenTelemetry can hook into the SDK at runtime.
TypeScript example (local Transformers.js)
Configuration
| Option | Behavior |
|---|---|
captureMessageContent | Gates gen_ai.input.messages / gen_ai.output.messages on spans and in events |
disableEvents | Suppresses all inference events |
disableMetrics | Global — metrics instruments are not set up |
disabledInstrumentors: ['transformers'] | Disables the local Transformers.js instrumentation |
disabledInstrumentors: ['huggingface'] | Disables the remote Inference API instrumentation |
On the Python SDK, inference events are only emitted when
capture_message_content is enabled. On the TypeScript SDK, inference events are emitted when disableEvents is false, regardless of captureMessageContent (message fields within the event are still gated by content capture).Get started
Initialize OpenLIT in your Application
- Python
- Typescript
- Zero Code Instrumentation
- One-Line Instrumentation
Perfect for existing applications - no code modifications needed:
- Via CLI Arguments
- Via Environment Variables
Perfect for: Legacy applications, production systems where code changes need approval, quick testing, or when you want to add observability without touching existing code.
YOUR_OTEL_ENDPOINT with the URL of your OpenTelemetry backend, such as http://127.0.0.1:4318 if you are using OpenLIT and a local OTel Collector.To send metrics and traces to other Observability tools, refer to the supported destinations.For more advanced configurations and application use cases, visit the OpenLIT Python repository or OpenLIT Typescript repository.Quickstart: LLM Observability
Production-ready AI monitoring setup in 2 simple steps with zero code changes
Configuration
Configure the OpenLIT SDK according to you requirements.
Destinations
Send telemetry to Datadog, Grafana, New Relic, and other observability stacks
Zero-code observability with the OpenLIT Controller
Discover and instrument LLM traffic across Kubernetes, Docker, and Linux using eBPF — no code changes required.

