Skip to main content

📡 LLM Radar

PyPI Python Version License: MIT

Real-time observability dashboard for LLM applications. Track every prompt, token count, cost, and latency across OpenAI and Anthropic — with one line of code.

from llm_radar import LLMRadar
radar = LLMRadar(app)  # that's it

Dashboard → http://localhost:8000/__llm_radar


Installation

pip install llm-radar

With provider SDKs:

pip install "llm-radar[openai]"       # + openai
pip install "llm-radar[anthropic]"    # + anthropic
pip install "llm-radar[all]"          # + both

Quick Start

OpenAI

from fastapi import FastAPI
from llm_radar import LLMRadar
import openai

app = FastAPI()
radar = LLMRadar(app)          # intercepts all openai calls automatically

client = openai.OpenAI()

@app.get("/chat")
async def chat(message: str):
    response = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[{"role": "user", "content": message}],
    )
    return {"reply": response.choices[0].message.content}

Anthropic

from fastapi import FastAPI
from llm_radar import LLMRadar
import anthropic

app = FastAPI()
radar = LLMRadar(app)

client = anthropic.Anthropic()

@app.get("/summarize")
async def summarize(text: str):
    response = client.messages.create(
        model="claude-haiku-4-5-20251001",
        max_tokens=256,
        messages=[{"role": "user", "content": text}],
    )
    return {"summary": response.content[0].text}

Use with fastapi-radar

llm-radar works alongside fastapi-radar — one app, two dashboards.

from fastapi import FastAPI
from fastapi_radar import Radar
from llm_radar import LLMRadarPlugin

app = FastAPI()

radar = Radar(app)               # HTTP + SQL monitoring → /__radar/
llm   = LLMRadarPlugin(app)      # LLM monitoring       → /__llm_radar

What Gets Tracked

Signal Captured
Prompt preview ✅ First 500 chars of last user message
Response preview ✅ First 500 chars of response
Input tokens ✅
Output tokens ✅
Cost (USD) ✅ Auto-calculated from current pricing
Latency (ms) ✅ End-to-end wall time
Model name ✅
Provider ✅ openai / anthropic
Errors ✅ With message
Async calls ✅

Configuration

radar = LLMRadar(
    app,
    dashboard_path="/__llm_radar",   # Custom path
    max_calls=1000,                   # Max records to keep
    retention_hours=24,               # Data retention window
    db_path="/var/data/llm",          # Custom DB location
    auth_dependency=my_auth_fn,       # Optional FastAPI dependency
    track_openai=True,
    track_anthropic=True,
)

Securing the Dashboard

from fastapi import Depends, HTTPException
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials

security = HTTPBearer()

def verify_token(creds: HTTPAuthorizationCredentials = Depends(security)):
    if creds.credentials != "your-secret-token":
        raise HTTPException(status_code=401, detail="Unauthorized")

radar = LLMRadar(app, auth_dependency=verify_token)

Supported Models & Pricing

Auto-detects cost for:

  • OpenAI: gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-3.5-turbo, o1, o3-mini, o4-mini
  • Anthropic: claude-opus-4, claude-sonnet-4, claude-haiku-4, claude-3.5-sonnet, claude-3-opus

Unrecognized models record 0 cost (no crash).


Contributing

git clone https://github.com/ganeshmandakapu/llm-radar
cd llm-radar
pip install -e ".[dev]"

License

MIT — Ganesh Mandakapu

Metadata

Release files for llm-radar 0.3.0

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

Source distribution (sdist)

Source distribution for llm-radar 0.3.0
File Size Uploaded
llm_radar-0.3.0.tar.gz 21.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-radar 0.3.0
File Interpreter ABI Platform
llm_radar-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 49.4 kB

Release files / llm_radar-0.3.0.tar.gz

Download URL llm_radar-0.3.0.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
281bde4f21234a250cb532416ddfbe3a00e837cb5f126f804dbf25ea9653cdd0
BLAKE2b-256 checksum
How to use checksums
013a116dac718201b7030cc56224c86163ac0abdfa2a5685459e970c2c2caa02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 4, 2026.

Transparency log

Release files / llm_radar-0.3.0-py3-none-any.whl

Download URL llm_radar-0.3.0-py3-none-any.whl
Size 28.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0b031756be98cb3091bc0315db801b8560b1541383d998a4f61eb2d710eab5b
BLAKE2b-256 checksum
How to use checksums
47e9abbc1a52f3cfadf092241c69bdeebc46345764169f4dbd619e19796b98a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

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