🧬 PromptAnalyzer
Git for prompts — local-first LLM observability & prompt versioning
One decorator. Zero config. No Docker, no cloud, no npm.
PromptAnalyzer gives any LLM-powered Python function automatic prompt versioning,
inference logging, token & cost tracking, and a local dashboard — by adding
a single @track decorator. Everything runs on your machine against SQLite. Nothing
leaves your laptop.
from promptanalyzer import track
@track("medical-chatbot")
def ask(message):
return client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "system", "content": "You are a doctor's assistant."},
{"role": "user", "content": message},
],
)
promptanalyzer dashboard # → http://localhost:4001
✨ Features
| 🔖 Prompt versioning | Every system prompt is SHA-256 hashed and versioned automatically — like Git commits for prompts. |
| 🧾 Full inference logs | User input, system prompt, response, model, provider, timing — all captured. |
| ⚡ Zero overhead | Sub-millisecond hot path; writes happen on a background thread. |
| 💸 Token & cost tracking | Built-in pricing for OpenAI, Anthropic, Google, Mistral, Groq and more. |
| 🔌 Provider agnostic | Auto-detects OpenAI, Claude, Gemini, Ollama, vLLM, LiteLLM, OpenRouter, Groq, Mistral, Azure — or bring your own. |
| 🪝 Auto-instrumentation | Captures the real request & response from the SDK call inside your function — even if you only return the answer string. |
| 📊 Local dashboard | Server-side rendered (FastAPI + HTMX + Alpine). No React, no build step. |
| 🔍 Search & diff | Full-text search across prompts/responses and GitHub-style version diffs. |
| 🛟 Never crashes your app | Logging failures are swallowed and logged — your application keeps running. |
🚀 Quick start
pip install "promptanalyzer[dashboard]"
- Decorate an LLM function with
@track("project-name"). - Run your application as usual.
- Open the dashboard:
promptanalyzer dashboard
# http://localhost:4001
That's it. PromptAnalyzer creates ~/.promptanalyzer/promptanalyzer.db on first use.
Advanced decorator
@track(
name="medical-assistant",
tags=["production"],
metadata={"team": "AI"},
)
def chatbot(message): ...
Any library (generic adapter)
@track(
name="custom-model",
system=lambda args, kwargs: kwargs["system"],
user=lambda args, kwargs: kwargs["prompt"],
response=lambda result: result,
)
def my_llm(system, prompt): ...
🖥️ Dashboard
| Overview | Prompt versions | Diff viewer | Run detail |
|---|---|---|---|
| Totals + runs/tokens/cost/latency charts | Every version with per-version metrics | GitHub-style added/removed lines | System prompt, messages, timing, tokens, cost |
The images above are placeholders. To capture real screenshots, follow
docs/screenshots.md.
📚 Documentation
Full guides live in docs/: Quickstart ·
Configuration · Providers & adapters ·
Dashboard · CLI ·
Prompt versioning · Database & migrations ·
Performance · FAQ.
🔌 Supported providers
OpenAI · Anthropic Claude · Google Gemini · Ollama · vLLM · LiteLLM · OpenRouter · Groq · Mistral · Azure OpenAI · any custom library via the generic adapter.
See examples/ for a runnable script per provider.
⚙️ Configuration
Zero config by default. Override via environment variables:
PROMPTANALYZER_DB=sqlite
PROMPTANALYZER_SQLITE_PATH=~/.promptanalyzer/promptanalyzer.db
PROMPTANALYZER_DATABASE_URL=postgresql://user:password@localhost/dbname
PROMPTANALYZER_HOST=127.0.0.1
PROMPTANALYZER_PORT=4001
PROMPTANALYZER_AUTO_START=true # start dashboard on import
PROMPTANALYZER_OPEN_BROWSER=true
PROMPTANALYZER_LOG_TOKENS=true
PROMPTANALYZER_LOG_COST=true
PROMPTANALYZER_SAVE_RESPONSES=true
PROMPTANALYZER_PROJECT=default
PROMPTANALYZER_ENV=development
Priority: decorator arguments → environment variables → defaults.
Legacy PROMPTLOG_* variables are also accepted.
🛠️ CLI
promptanalyzer init # create ~/.promptanalyzer and the database
promptanalyzer dashboard # launch the dashboard
promptanalyzer migrate # create/upgrade the schema
promptanalyzer export csv # export runs (json | csv | markdown)
promptanalyzer doctor # diagnose your installation
promptanalyzer reset # wipe all local data
🧱 Architecture
@track → adapter (normalizes any provider) → background writer → SQLite → FastAPI dashboard.
See ARCHITECTURE.md for the full design.
🗺️ Roadmap
- OpenTelemetry export
- Prompt evaluation & A/B testing
- Dataset management & prompt playground
- Cloud sync + team collaboration
- Authentication & multi-user
- Plugin marketplace
🤝 Contributing
Contributions welcome! See CONTRIBUTING.md.
📄 License
MIT © PromptAnalyzer Contributors
Release files for promptanalyzer 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| promptanalyzer-0.1.1.tar.gz | 48.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| promptanalyzer-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 107.3 kB
Release files / promptanalyzer-0.1.1.tar.gz
| Download URL | promptanalyzer-0.1.1.tar.gz |
|---|---|
| Size | 48.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4524df0347be5ac041d719a57be631676014edf6d58ec9075af11bbb8b9af223
|
|
BLAKE2b-256 checksum How to use checksums |
3aa60724f2ada20a229c98c349ac962582fb29fec3e826a900b82b98870d834f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 30, 2026.
Transparency logRelease files / promptanalyzer-0.1.1-py3-none-any.whl
| Download URL | promptanalyzer-0.1.1-py3-none-any.whl |
|---|---|
| Size | 59.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c0f75ae5f4623d7da8522161a6e8e891589e478b15103d3527e0f50fa857b87b
|
|
BLAKE2b-256 checksum How to use checksums |
1511c37b51f6d77239a8f2c188e60e11c68c6d3910eee59b466c2fb726961ab5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 30, 2026.
Transparency log