Python SDK for tracing LLM calls (OpenAI, Anthropic, Google Gemini) to AmberTrace observability platform
Project description
AmberTrace Python SDK
Lightweight, zero-code LLM observability for Python. Trace every API call to OpenAI, Anthropic, and Google automatically.
Installation
# Core SDK
pip install ambertrace
# With specific provider support
pip install ambertrace[openai]
pip install ambertrace[anthropic]
pip install ambertrace[gemini]
# All providers
pip install ambertrace[all]
Requirements: Python 3.8+
Quick Start
import ambertrace
from openai import OpenAI
# Initialize once at startup
ambertrace.init(api_key="at_...")
# Use your LLM SDK as normal — tracing happens automatically
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Hello!"}]
)
# Flush before exit
ambertrace.flush()
Supported Providers
| Provider | Models | SDK |
|---|---|---|
| OpenAI | GPT-5, GPT-4, GPT-4o, GPT-4o-mini, o1, o3 | openai>=1.0.0 |
| Anthropic | Claude Opus 4.5/4.6, Sonnet 4.5, Haiku | anthropic>=0.18.0 |
| Gemini Pro, Flash, 2.0, Gemma | google-generativeai>=0.3.0 |
Async Support
import asyncio
import openai
import ambertrace
async def main():
ambertrace.init(api_key="at_...")
client = openai.AsyncOpenAI()
response = await client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Hello!"}]
)
await ambertrace.flush_async()
asyncio.run(main())
Configuration
ambertrace.init(
api_key="at_...", # Required (or AMBERTRACE_API_KEY env var)
environment="production", # Environment tag for filtering
debug=False, # Enable debug logging
timeout=5.0, # Network timeout in seconds
enabled=True, # Enable/disable tracing
)
API Reference
ambertrace.init()— Initialize SDK and start tracingambertrace.enable()/ambertrace.disable()— Toggle tracing at runtimeambertrace.is_enabled()— Check if tracing is activeambertrace.flush()— Block until pending traces are sentambertrace.flush_async()— Async version of flushambertrace.shutdown()— Flush, disable, and clean up
Links
License
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 ambertrace-0.1.0.tar.gz.
File metadata
- Download URL: ambertrace-0.1.0.tar.gz
- Upload date:
- Size: 41.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28aae3e2465baaaf9743772423f350c3659ad1eb6ceb29be7ae033503a55eef2
|
|
| MD5 |
b3564a02cdc42c3fb5839d4ce4e982f3
|
|
| BLAKE2b-256 |
640103776cceaf8aedfa9fc7d05eb0deaa375a7804f98e2165869eec015c3c97
|
Provenance
The following attestation bundles were made for ambertrace-0.1.0.tar.gz:
Publisher:
publish-python.yml on ambertrace/ambertrace-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ambertrace-0.1.0.tar.gz -
Subject digest:
28aae3e2465baaaf9743772423f350c3659ad1eb6ceb29be7ae033503a55eef2 - Sigstore transparency entry: 940719613
- Sigstore integration time:
-
Permalink:
ambertrace/ambertrace-sdk@6fd8626b760b320eca018d6cd44bf30c63795414 -
Branch / Tag:
refs/tags/python-v0.1.0 - Owner: https://github.com/ambertrace
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@6fd8626b760b320eca018d6cd44bf30c63795414 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ambertrace-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ambertrace-0.1.0-py3-none-any.whl
- Upload date:
- Size: 32.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 |
10ba876540721e5aa0b86aad39463d7895c663249419c7826f9046cd63ac236c
|
|
| MD5 |
431c88fc1fef3db16f8ef5c3342b9fef
|
|
| BLAKE2b-256 |
54fa13890ff2daafb2a3907d3a5554484c98e31c685c6471aa57db306c0baf59
|
Provenance
The following attestation bundles were made for ambertrace-0.1.0-py3-none-any.whl:
Publisher:
publish-python.yml on ambertrace/ambertrace-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ambertrace-0.1.0-py3-none-any.whl -
Subject digest:
10ba876540721e5aa0b86aad39463d7895c663249419c7826f9046cd63ac236c - Sigstore transparency entry: 940719622
- Sigstore integration time:
-
Permalink:
ambertrace/ambertrace-sdk@6fd8626b760b320eca018d6cd44bf30c63795414 -
Branch / Tag:
refs/tags/python-v0.1.0 - Owner: https://github.com/ambertrace
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@6fd8626b760b320eca018d6cd44bf30c63795414 -
Trigger Event:
push
-
Statement type: