Skip to main content

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 (success or error)
  • Exception details (if error)
  • Model name (if passed as model kwarg)
  • Prompt size (characters, if arg named prompt)
  • Output size (characters, if return is string)
  • Retry count (if function has retries attribute)

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

Metadata

Release files for llmtrace-lite 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llmtrace-lite 0.0.1
File Size Uploaded
llmtrace_lite-0.0.1.tar.gz 3.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llmtrace-lite 0.0.1
File Interpreter ABI Platform
llmtrace_lite-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.2 kB

Release files / llmtrace_lite-0.0.1.tar.gz

Download URL llmtrace_lite-0.0.1.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cfd674e924b1ddd3533ad3ef71aa7a770e27dfffbb1f6e8e538dbd08a05de149
BLAKE2b-256 checksum
How to use checksums
122154a32a3c9cda5f4c30a38d5066f09231d170b0ab5e8e5ff6cc7336e20cad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 12, 2025.

Transparency log

Release files / llmtrace_lite-0.0.1-py3-none-any.whl

Download URL llmtrace_lite-0.0.1-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
650fd77e3d860a2df52930df48724f9181473cb8b8cdcc9712e004df88b00fd5
BLAKE2b-256 checksum
How to use checksums
bfea4e48fb7e215dbd56aacd02afc10edfa93a573e6f1bb5ab08d05bf0b229ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 12, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page