Dvara
Tracing, cost tracking and a local dashboard for your LLM calls. One line of code, no server, no account.
Wrap your OpenAI or Anthropic client with dvara.wrap(...) and every call is recorded to a
local SQLite file: model, tokens, cost, latency, errors and your own metadata. Inspect it
from the terminal, from Python (as a list or a pandas DataFrame), or in a dashboard that
runs on your machine.
Status: v0.1, an early release. The API may change before 1.0. Long-term, Dvara aims to be a lightweight AI gateway (one API across providers, fallbacks, caching).
Install
pip install "dvara-ai[all]" # or: uv add "dvara-ai[all]"
The package is dvara-ai; you import it as dvara. The core has only two dependencies
(typer, rich); everything else is an optional extra:
| Extra | Installs | Needed for |
|---|---|---|
openai |
openai |
wrapping openai.OpenAI clients |
anthropic |
anthropic |
wrapping anthropic.Anthropic clients |
ui |
fastapi, uvicorn |
the dvara ui dashboard |
all |
all of the above |
Python 3.10 or newer.
Quickstart
import dvara
from openai import OpenAI
from anthropic import Anthropic
# Wrap once. Your code and the response objects stay exactly the same.
openai_client = dvara.wrap(OpenAI(), metadata={"feature": "support-bot"})
claude = dvara.wrap(Anthropic(), metadata={"feature": "summarizer"})
openai_client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Say hi in five words."}],
)
claude.messages.create(
model="claude-haiku-5-5",
max_tokens=100,
messages=[{"role": "user", "content": "Say hi in five words."}],
)
Then look at what happened:
dvara logs # recent calls
dvara stats # totals and per-model breakdown
dvara ui # dashboard at http://127.0.0.1:4000
Or read traces from Python:
traces = dvara.get_traces(limit=50, model="gpt-4o-mini", status="success")
df = dvara.get_traces(as_dataframe=True) # needs pandas installed
A runnable version is in examples/quickstart.py.
Command line
$ dvara logs -n 5
┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
┃ Time ┃ Provider ┃ Model ┃ In ┃ Out ┃ Cost ┃ Latency ┃ Status ┃
┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━┩
│ 2026-11-29 19:30:05 │ openai │ gpt-6.2-sol │ 3,721 │ 383 │ $0.0113 │ 2.4 s │ success │
│ 2026-11-29 19:08:39 │ anthropic │ claude-haiku-5… │ 1,649 │ 169 │ $0.000249 │ 521 ms │ success │
│ 2026-11-29 18:46:33 │ openai │ gpt-5-mini │ 737 │ 482 │ $0.001148 │ 870 ms │ success │
│ 2026-11-29 18:20:30 │ anthropic │ claude-sonnet-… │ 1,786 │ 815 │ $0.0117 │ 2.1 s │ success │
│ 2026-11-29 18:02:27 │ anthropic │ claude-opus-5-5 │ 2,321 │ 1,142 │ $0.0321 │ 3.5 s │ success │
└─────────────────────┴───────────┴─────────────────┴───────┴───────┴───────────┴─────────┴─────────┘
| Command | What it does | Options |
|---|---|---|
dvara logs |
Table of the most recent calls | -n/--limit (default 20), --model, --status success|error |
dvara stats |
Total calls, tokens, cost, average latency and error rate, plus a per-model table | --model |
dvara clear |
Delete all traces (asks first) | -y/--yes to skip the question |
dvara ui |
Start the local dashboard and open it in your browser | --port (default 4000), --no-browser |
Dashboard
dvara ui (needs the ui extra) serves a single page with summary cards, cost over time
(hourly for the last 48 hours or daily for the last 30 days), cost by model, and a
filterable table of calls. Click a row to see its metadata, error and, if you logged them,
the prompt and response. New calls appear automatically every 5 seconds. Light and dark
mode follow your system setting.
The dashboard only listens on 127.0.0.1 and only answers requests addressed to
127.0.0.1 or localhost, so it isn't reachable from your network. It is read-only, and
works offline (Chart.js ships inside the package).
What gets recorded
Each call becomes one row in the traces table:
| Field | Notes |
|---|---|
id, timestamp |
Random hex ID; UTC ISO-8601 time the call started |
provider, model |
openai or anthropic; the model the API reports (e.g. gpt-4o-mini-2024-07-18) |
input_tokens, output_tokens, total_tokens |
Normalized across providers |
cost_usd |
NULL if the model's price is unknown |
latency_ms |
Time around the API call only |
status, error_type, error_message |
success or error, with the exception's class and message |
metadata |
Whatever you passed to wrap(..., metadata=...), as JSON |
prompt, response |
NULL unless you pass log_content=True |
fallback_used |
Always 0 (reserved for v0.3) |
Privacy: prompt and response text are not stored unless you opt in with
dvara.wrap(client, log_content=True). Nothing ever leaves your machine; Dvara makes no
network calls of its own.
Location: ~/.dvara/traces.db. Set DVARA_DB_PATH to use a different file, for
example one per project.
Open the database yourself
It's a plain SQLite file, so any SQLite tool works:
- DB Browser for SQLite: open
~/.dvara/traces.db. - Datasette:
datasette ~/.dvara/traces.dbfor a browsable web UI with SQL. sqlite3 ~/.dvara/traces.db "SELECT model, SUM(cost_usd) FROM traces GROUP BY model"
Cost tracking
Costs come from a built-in price table (USD per million input and output tokens) taken
from the official OpenAI and
Anthropic pricing pages. The
date it was last checked is in dvara.pricing.PRICES_UPDATED.
- Dated model names find their base model:
gpt-4o-mini-2024-07-18uses thegpt-4o-miniprice. The longest matching name wins. - Models that charge more for long prompts (Claude Haiku 5.5 above 100K input tokens, newer GPT models above 272K) use the higher price for those calls.
- Unknown models get
cost_usd = NULL, never a guess and never an error. Add or override prices yourself:
dvara.set_price("my-finetuned-model", input_per_1m=0.30, output_per_1m=1.20)
Not included in v0.1: prompt-cache read/write rates, batch discounts, fast mode and data-residency surcharges. If you use prompt caching heavily, actual costs will differ.
Overhead
Tracing adds about 27 µs per call. That's measured on a mocked client that returns
instantly, so it's only Dvara's own work: reading usage, looking up the price and one SQLite
write (WAL mode, one reused connection). For comparison, a real LLM call takes hundreds of
milliseconds or more. Measured on an Apple M5, macOS 26.6, Python 3.12; run
uv run pytest tests/test_overhead.py -s to measure on your machine.
Guarantees
- Tracing never breaks your call. If writing a trace fails, Dvara logs a warning on the
dvaralogger and you still get the real response. - Errors are untouched. If the API call raises, Dvara records an error trace and re-raises the original exception unchanged.
- Same objects. You get back the SDK's own response objects, not copies or wrappers.
Limitations in v0.1
- Streaming calls (
stream=True) pass through but aren't traced. - Async clients (
AsyncOpenAI,AsyncAnthropic) aren't supported yet. - Clients created with
client.with_options(...), and.with_raw_responsecalls, aren't traced. - Only
chat.completions.create(OpenAI) andmessages.create(Anthropic) are traced. - Anthropic prompt-cache tokens aren't counted in
input_tokensor cost.
These are planned for future releases.
Development
uv sync --all-extras # install everything
uv run pytest # tests use mocked clients: no keys, no network
uv run python scripts/seed_demo_data.py # fake traces for working on the dashboard
uv run dvara ui
The seed script writes to ~/.dvara/traces.db unless you set DVARA_DB_PATH.
License
Metadata
Release files for dvara-ai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dvara_ai-0.1.0.tar.gz | 105.8 kB | Without provenance | Details for dvara_ai-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dvara_ai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for dvara_ai-0.1.0-py3-none-any.whl |
Total release size: 211.0 kB
Release files / dvara_ai-0.1.0.tar.gz
| Download URL | dvara_ai-0.1.0.tar.gz |
|---|---|
| Size | 105.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8dccffcbeaf1db126fd267426223c399ae6b5e2af5b6ccab062d0dc174099274
|
|
BLAKE2b-256 checksum How to use checksums |
722cf5b377d1974b31e36cf6a2a3a97b45289882fe1c3eda400b903482ef2e34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / dvara_ai-0.1.0-py3-none-any.whl
| Download URL | dvara_ai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 105.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d37a7c919ded97a7c78d0138a6d86b7553039ff7c8162beaa6bcde2f49bd13c
|
|
BLAKE2b-256 checksum How to use checksums |
66132696f36690da72ed1dde882a5676e3a1a48f07b8003f60371f0856cf1c4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for dvara-ai 0.1.0
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.