Skip to main content

Local-first observability for LLM applications

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tracellm-0.2.2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tracellm-0.2.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file tracellm-0.2.2.tar.gz.

File metadata

  • Download URL: tracellm-0.2.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for tracellm-0.2.2.tar.gz
Algorithm Hash digest
SHA256 52c46abbf24a0d855b64b954139ba7b788db17a4d4a1f3157ec0ec044eee52be
MD5 443dc98f4d4bddd84cd6ae18ceac0da6
BLAKE2b-256 6afb0691662eef8a7da717e20c1cb08f3fb5f2de8edd2796fdef38ae4c5a28cb

See more details on using hashes here.

File details

Details for the file tracellm-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: tracellm-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for tracellm-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d1bc0b925476406849dd105a14747b21d5383a89fb5ade4954896e48d6f85aa3
MD5 5d5521514423d90b1adb117aeb145f3a
BLAKE2b-256 412a5583c4f88d42d4cd791a0947f533ebeda30f58364946c876caaf0015dc50

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page