Unified LLM Observability & Multi-Model AI Integration Framework - Deploy to GPT, Claude, Gemini, Copilot with full telemetry
Project description
Kalibr Python SDK
Production-grade observability for LLM applications. Automatically instrument OpenAI, Anthropic, and Google AI SDKs with zero code changes.
Features
- Zero-code instrumentation - Automatic tracing for OpenAI, Anthropic, and Google AI
- Cost tracking - Real-time cost calculation for all LLM calls
- Token monitoring - Track input/output tokens across providers
- Parent-child traces - Automatic trace relationship management
- Multi-provider support - Works with GPT-4, Claude, Gemini, and more
Installation
pip install kalibr
Quick Start
Auto-instrumentation (Recommended)
Simply import kalibr at the start of your application - all LLM calls are automatically traced:
import kalibr # Enable auto-instrumentation
import openai
# Set your Kalibr API key
import os
os.environ["KALIBR_API_KEY"] = "your-kalibr-api-key"
# All OpenAI calls are now automatically traced
client = openai.OpenAI()
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}]
)
Manual Tracing with Decorator
For more control, use the @trace decorator:
from kalibr import trace
import openai
@trace(operation="summarize", provider="openai", model="gpt-4o")
def summarize_text(text: str) -> str:
client = openai.OpenAI()
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": "Summarize the following text."},
{"role": "user", "content": text}
]
)
return response.choices[0].message.content
result = summarize_text("Your long text here...")
Multi-Provider Example
import kalibr
import openai
import anthropic
# OpenAI call - automatically traced
openai_client = openai.OpenAI()
gpt_response = openai_client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Explain quantum computing"}]
)
# Anthropic call - automatically traced
anthropic_client = anthropic.Anthropic()
claude_response = anthropic_client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[{"role": "user", "content": "Explain machine learning"}]
)
Configuration
Configure the SDK using environment variables:
| Variable | Description | Default |
|---|---|---|
KALIBR_API_KEY |
API key for authentication | Required |
KALIBR_COLLECTOR_URL |
Collector endpoint URL | http://localhost:8001/api/ingest |
KALIBR_TENANT_ID |
Tenant identifier for multi-tenant setups | default |
KALIBR_WORKFLOW_ID |
Workflow identifier for grouping traces | default |
KALIBR_SERVICE_NAME |
Service name for OpenTelemetry spans | kalibr-app |
KALIBR_ENVIRONMENT |
Environment (prod, staging, dev) | prod |
KALIBR_AUTO_INSTRUMENT |
Enable/disable auto-instrumentation | true |
KALIBR_CONSOLE_EXPORT |
Enable console span export for debugging | false |
CLI Tools
The SDK includes command-line tools for running and deploying applications:
# Run your app locally with tracing
kalibr serve myapp.py
# Run with managed runtime lifecycle
kalibr run myapp.py --port 8000
# Deploy to cloud platforms
kalibr deploy myapp.py --runtime fly.io
# Fetch trace data by ID
kalibr capsule <trace-id>
Supported Providers
| Provider | Models | Auto-Instrumentation |
|---|---|---|
| OpenAI | GPT-4, GPT-4o, GPT-3.5 | Yes |
| Anthropic | Claude 3 Opus, Sonnet, Haiku | Yes |
| Gemini Pro, Gemini Flash | Yes |
Examples
See the examples/ directory for complete examples:
basic_example.py- Simple tracing examplebasic_agent.py- Agent with auto-instrumentationadvanced_example.py- Advanced tracing patternscross_vendor.py- Multi-provider workflowstest_mas.py- Multi-agent system demonstration
Development
# Clone the repository
git clone https://github.com/kalibr-systems/kalibr-sdk-python.git
cd kalibr-sdk-python
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
# Format code
black kalibr/
ruff check kalibr/
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
License
MIT License - see LICENSE for details.
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kalibr-1.1.2a0.tar.gz.
File metadata
- Download URL: kalibr-1.1.2a0.tar.gz
- Upload date:
- Size: 71.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf9fbb82f8ebcd62fd61824a9293484d82cd75fb86ad78a5305a48066ab3c389
|
|
| MD5 |
70de46c0dbbaea8b6df51847ca2cb8fe
|
|
| BLAKE2b-256 |
b4e2279e31723b513d8b428b5328031680dff6948211a9b22ae159c57b9c9737
|
Provenance
The following attestation bundles were made for kalibr-1.1.2a0.tar.gz:
Publisher:
publish.yml on kalibr-ai/kalibr-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kalibr-1.1.2a0.tar.gz -
Subject digest:
cf9fbb82f8ebcd62fd61824a9293484d82cd75fb86ad78a5305a48066ab3c389 - Sigstore transparency entry: 748413372
- Sigstore integration time:
-
Permalink:
kalibr-ai/kalibr-sdk-python@3bd46efff39f7e8c513066d3f0104e615122b2c8 -
Branch / Tag:
refs/tags/v1.1.2-alpha - Owner: https://github.com/kalibr-ai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3bd46efff39f7e8c513066d3f0104e615122b2c8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file kalibr-1.1.2a0-py3-none-any.whl.
File metadata
- Download URL: kalibr-1.1.2a0-py3-none-any.whl
- Upload date:
- Size: 85.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b35b58e002dc9deda6b9a1e33172f7745be64377765b1fe6cd850fa59859d98
|
|
| MD5 |
bd5f7c1017cd3149b72cb2fc2d185912
|
|
| BLAKE2b-256 |
929af566d5f058e84aeead531b589c6473683d498cda28363bf4c469226356bb
|
Provenance
The following attestation bundles were made for kalibr-1.1.2a0-py3-none-any.whl:
Publisher:
publish.yml on kalibr-ai/kalibr-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kalibr-1.1.2a0-py3-none-any.whl -
Subject digest:
4b35b58e002dc9deda6b9a1e33172f7745be64377765b1fe6cd850fa59859d98 - Sigstore transparency entry: 748413374
- Sigstore integration time:
-
Permalink:
kalibr-ai/kalibr-sdk-python@3bd46efff39f7e8c513066d3f0104e615122b2c8 -
Branch / Tag:
refs/tags/v1.1.2-alpha - Owner: https://github.com/kalibr-ai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3bd46efff39f7e8c513066d3f0104e615122b2c8 -
Trigger Event:
push
-
Statement type: