TokenPolice
Docs
Sample apps

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.

At a glance

AppShowsLanguage(s)ProvidersSource
Support agentSteady-state enforcement + session threading (one login = one session)Python · NodeOpenAI · Anthropic · GeminiOur GitHub org →
Budget-aware RAGThe firewall blocking a session, with a graceful wind-downPythonOpenAI · Anthropic · Gemini for chat — an OpenAI key is always required, because embeddings are always OpenAIOur 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.