Metadata-Version: 2.4
Name: tracellm
Version: 0.2.1
Summary: Local-first observability for LLM applications
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# 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
```bash
pip install tracellm
```

## Usage
```python
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"}]
)
...
```
Output on query:
```
 --- Trace ---
  Model: llama-3.1-8b-instant
  Prompt: Explain black holes in one line
  Response: A black hole is a region where gravity...
  Tokens: 43
  Latency: 0.847
  Status: success
  Timestamp: 2026-04-03 19:46:27
-------------
...
```
That's it. Every call is traced automatically.

## Query traces from terminal
```bash
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
...
```

## What gets captured

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

## Limitations

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

## Roadmap

- Binary storage for faster querying at scale
- Cost calculation per model
- Terminal dashboard
