Skip to main content

tracellm

Lightweight tracing for LLM applications. One decorator — every API interaction logged locally, queryable from your terminal.

No backend. No signup. Nothing leaves your machine.

Install

pip install tracellm

Usage

from tracellm import trace
import groq

client = groq.Groq(api_key="your-key")

@trace
def ask(model, messages):
    return client.chat.completions.create(model=model, messages=messages)

ask(
    model="llama-3.1-8b-instant",
    messages=[{"role": "user", "content": "Explain black holes in one line"}]
)

Every call is traced automatically. No try/except. No setup.

Query traces

python -m tracellm.cli --Status failed
python -m tracellm.cli --Latency 2.0
python -m tracellm.cli --Model llama-3.1-8b-instant
python -m tracellm.cli --Status failed --Latency 1.5
python -m tracellm.cli --Time "2026-04-03"

Cost tracking

# cost per trace
python -m tracellm.cli --Cost

# full summary by model
python -m tracellm.cli --Cost Summary

Output: === Cost Summary === llama-3.1-8b-instant Calls : 8 Tokens : 405 Cost : $0.000020

Total calls made : 8 Total tokens used: 405 Total cost : $0.000020

What gets captured

  • Model, prompt, response
  • Tokens used, latency, finish reason
  • Error type and message on failures
  • Timestamp for every call

Pricing

Default pricing is bundled. To override, create ~/.tracellm/pricing.json:

{
  "my-custom-model": 0.05
}

Values are per million tokens.

Limitations

Storage is append-only JSON lines. Latency filter supports >=, exact match for everything else. Early days.

Roadmap

  • Binary storage for faster querying at scale
  • Async tracing support
  • Terminal dashboard

Metadata

Release files for tracellm 0.2.2

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

Source distribution (sdist)

Source distribution for tracellm 0.2.2
File Size Uploaded Provenance Actions
tracellm-0.2.2.tar.gz 4.4 kB Without provenance Details for tracellm-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tracellm 0.2.2
File Interpreter ABI Platform Actions
tracellm-0.2.2-py3-none-any.whl Python 3 none any Details for tracellm-0.2.2-py3-none-any.whl

Total release size: 9.8 kB

Release files / tracellm-0.2.2.tar.gz

Download URL tracellm-0.2.2.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
52c46abbf24a0d855b64b954139ba7b788db17a4d4a1f3157ec0ec044eee52be
BLAKE2b-256 checksum
How to use checksums
6afb0691662eef8a7da717e20c1cb08f3fb5f2de8edd2796fdef38ae4c5a28cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / tracellm-0.2.2-py3-none-any.whl

Download URL tracellm-0.2.2-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1bc0b925476406849dd105a14747b21d5383a89fb5ade4954896e48d6f85aa3
BLAKE2b-256 checksum
How to use checksums
412a5583c4f88d42d4cd791a0947f533ebeda30f58364946c876caaf0015dc50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for tracellm 0.2.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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