Zero-config decorator for tracing LLM calls
Project description
llmtrace-lite
Zero-config decorator for tracing LLM calls. Print-debugging for language model functions, nothing more.
What this is
A tiny Python decorator that logs basic metadata about LLM function calls: timing, model name, prompt/output sizes, and success/failure status. No dependencies, no configuration files, no dashboards. Just readable logs.
Installation
pip install llmtrace-lite
Usage
from llmtrace_lite import trace
@trace
def call_llm(prompt, model="gpt-4o"):
# Your LLM call here
response = some_llm_client.complete(prompt, model=model)
return response
# Use it normally
result = call_llm("Explain quantum computing", model="gpt-4o")
Output:
[llmtrace] call_llm
model: gpt-4o
latency_ms: 842
prompt_chars: 312
output_chars: 1187
status: success
File logging
Set LLMTRACE_FILE to append JSON lines instead:
export LLMTRACE_FILE=traces.jsonl
python your_script.py
Each line is a JSON object with trace metadata.
What this captures
- Function name
- Start/end timestamps
- Latency (milliseconds)
- Status (
successorerror) - Exception details (if error)
- Model name (if passed as
modelkwarg) - Prompt size (characters, if arg named
prompt) - Output size (characters, if return is string)
- Retry count (if function has
retriesattribute)
What this is NOT
This is not:
- An observability platform
- A provider-specific SDK integration
- An async framework
- A monitoring dashboard
- A production tracing system
- Extensible middleware
If you need those things, use LangSmith, Phoenix, or OpenTelemetry.
This is for local debugging and quick sanity checks. That's it.
Requirements
- Python 3.9+
- Standard library only
- No external dependencies
License
MIT
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 llmtrace_lite-0.0.1.tar.gz.
File metadata
- Download URL: llmtrace_lite-0.0.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfd674e924b1ddd3533ad3ef71aa7a770e27dfffbb1f6e8e538dbd08a05de149
|
|
| MD5 |
f09a2ba061c81cd27378f3d522acadc1
|
|
| BLAKE2b-256 |
122154a32a3c9cda5f4c30a38d5066f09231d170b0ab5e8e5ff6cc7336e20cad
|
Provenance
The following attestation bundles were made for llmtrace_lite-0.0.1.tar.gz:
Publisher:
publish.yml on achintya-p/llm-trace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llmtrace_lite-0.0.1.tar.gz -
Subject digest:
cfd674e924b1ddd3533ad3ef71aa7a770e27dfffbb1f6e8e538dbd08a05de149 - Sigstore transparency entry: 761150094
- Sigstore integration time:
-
Permalink:
achintya-p/llm-trace@15442185c4aff62bfbda3e8c71569ba195f8ca49 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/achintya-p
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@15442185c4aff62bfbda3e8c71569ba195f8ca49 -
Trigger Event:
release
-
Statement type:
File details
Details for the file llmtrace_lite-0.0.1-py3-none-any.whl.
File metadata
- Download URL: llmtrace_lite-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.8 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 |
650fd77e3d860a2df52930df48724f9181473cb8b8cdcc9712e004df88b00fd5
|
|
| MD5 |
c498ba41ab0ea6e0f076e817b32c0167
|
|
| BLAKE2b-256 |
bfea4e48fb7e215dbd56aacd02afc10edfa93a573e6f1bb5ab08d05bf0b229ae
|
Provenance
The following attestation bundles were made for llmtrace_lite-0.0.1-py3-none-any.whl:
Publisher:
publish.yml on achintya-p/llm-trace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llmtrace_lite-0.0.1-py3-none-any.whl -
Subject digest:
650fd77e3d860a2df52930df48724f9181473cb8b8cdcc9712e004df88b00fd5 - Sigstore transparency entry: 761150109
- Sigstore integration time:
-
Permalink:
achintya-p/llm-trace@15442185c4aff62bfbda3e8c71569ba195f8ca49 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/achintya-p
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@15442185c4aff62bfbda3e8c71569ba195f8ca49 -
Trigger Event:
release
-
Statement type: