Sample apps
Downloadable, always-running sample apps that show TokenPolice protecting a real LLM app end to end.
Two complete apps — each a persistent web service with a login and a chat UI — that run
TokenPolice in enforce mode the whole time. They are published on our GitHub org; once you
have a copy, add your keys and watch the firewall meter (and, in one of them, block) real
LLM traffic in your dashboard.
The code lives in its own repo — nothing is pasted into these docs. Each page below has the run commands, the exact integration lines, and what to look for once it's running.
Support agent
A support-desk chat that meters every turn. Python (FastAPI) and Node (Express), side by side, both on LangGraph. The steady-state 'firewall always on' pattern.
Budget-aware RAG
A RAG chat that reads its own budget, warns as it runs low, and degrades gracefully when TokenPolice blocks the session. This is the app that shows the firewall bite.
At a glance
| App | Shows | Language(s) | Providers | Source |
|---|---|---|---|---|
| Support agent | Steady-state enforcement + session threading (one login = one session) | Python · Node | OpenAI · Anthropic · Gemini | Our GitHub org → |
| Budget-aware RAG | The firewall blocking a session, with a graceful wind-down | Python | OpenAI · Anthropic · Gemini for chat — an OpenAI key is always required, because embeddings are always OpenAI | Our GitHub org → |
Provider is a startup switch
In both apps you pick the LLM provider with one env var (PROVIDER=openai | anthropic | gemini) — the same app code runs on all three, no changes. The provider is read at startup, so
restart to switch; the active provider and model are shown read-only in the UI header.
Which one first?
- New to TokenPolice? Start with the Support agent — it's the plain "add the firewall, leave it on" integration, in whichever language you work in.
- Want to see a block actually happen? Go to Budget-aware RAG — it deliberately drives a session past a budget so you can watch the enforcement path and the app's graceful fallback.
Both are wired the same way you'd wire your own app — the fastest route is to let your coding agent do it. See Start with your coding agent.

