Nothing in the dashboard
No traces showing up? Check init order, the API key, the collector URL, and the provider client.
Your app runs, the LLM calls work — but the dashboard stays empty. Because TokenPolice is fail-open, a wiring problem never crashes your app: it just goes quiet. So the fix is almost always one of a short list. Work down it in order.
Is init the very first thing your app does?
tp.init(...) must run before you import or construct any LLM client. In Python this usually
just works; in native ESM (Next.js, Vite, Bun) an import resolved before init is silently left
un-instrumented. If you're on ESM, this is almost certainly it — see
ESM / instrumentation order.
Is the collector URL right?
base_url must be your collector, https://collect.tokenpolice.ai, unless you self-host:
import token_police as tp
tp.init(
api_key=os.environ["TOKENPOLICE_API_KEY"],
base_url="https://collect.tokenpolice.ai",
)import { init } from "token-police";
init({
apiKey: process.env.TOKENPOLICE_API_KEY!,
baseUrl: "https://collect.tokenpolice.ai",
});Is the API key present and spelled right?
The key looks like tp_sk_… and lives in the TOKENPOLICE_API_KEY env var — one word, no
underscore between TOKEN and POLICE. A missing or malformed key is swallowed silently by
design. Grab a fresh one from the API Keys page if unsure.
Does the process live long enough to send?
Usage ships in the background, after your call returns. A script or serverless function that exits immediately can freeze before anything is sent. If that's you, drain first — see Serverless flush.
Is the client actually supported?
Most providers are metered on the base install, but an unusual or gateway-wrapped client may need
a manual wrap. See protect() and the
support matrix.
Still nothing?
Turn on error logging and watch stderr — TokenPolice will print what it swallowed:
tp.init(
api_key=os.environ["TOKENPOLICE_API_KEY"],
base_url="https://collect.tokenpolice.ai",
log_errors=True, # off by default
)init({
apiKey: process.env.TOKENPOLICE_API_KEY!,
baseUrl: "https://collect.tokenpolice.ai",
logErrors: true, // off by default
});Only one provider missing?
If everything else meters but a single provider goes quiet, check the boot log.
Node + openai 7 or newer. If auto-discovery prints that the installed version is not yet
supported, chat-completion calls are recorded with 0 input / 0 output tokens — so budgets
never accumulate, even though the calls run and are still checked against your rules. The fix is
not to downgrade: pass the module to init().
import OpenAI from "openai";
init({ /* … */ instrumentModules: { openAI: OpenAI } });That patches the module directly and meters chat completions normally. Responses-API, image, audio and embedding calls were never affected. See Node & ESM.
Any other provider. The same warning on another library means TokenPolice can't tap the
installed version. Check Supported versions, and pass the module
via instrumentModules if it's a Node app.
If the warning instead says instrumentation stopped after re-initialization, the process called
uninstrument() and then init() again — restart the process and call
init() once per process.

