TokenPolice
Docs
SDK reference

Install

The two install commands, the runtimes they need, and where to find provider and framework details.

One install, then tp.init().

Python

pip install token-police

Requires Python 3.10+. OpenAI, Anthropic, Bedrock, and Google Gemini are metered by this install alone; so are Cohere, Mistral, Groq, Together, OpenRouter, Cerebras, Hugging Face and xAI. Frameworks (LangChain, LlamaIndex, CrewAI, …) each add one extra.

Node

npm i token-police

Requires Node 20+; works in ESM and CommonJS. Install the provider package you already use — they're optional peer dependencies — and TokenPolice taps it. LangChain apps add one companion package:

npm i token-police token-police-langchain

Using native ESM, pnpm, a workspace, or openai 7.x? Pass your provider modules to tp.init() — see Node & ESM.

Next

On this page