A live meter for your LLM's context window — see exactly what's filling it.
Project description
contextmeter
A live meter for your LLM's context window — see exactly what's filling it.
contextmeter is a tiny local proxy + terminal HUD. Point your LLM app at it and
watch, in real time, how your context window fills up — broken down by system
prompt, tool definitions, chat history, and tool outputs. It makes the
invisible "tool tax" obvious: "34% of your window is tool schemas you never call."
It auto-detects the request format per call, so it works with any OpenAI-compatible API and Anthropic out of the box — no code changes, just a base-URL swap.
Works with
Anything that speaks the OpenAI chat format — OpenAI, OpenRouter, Groq, Together,
Mistral, DeepSeek, Fireworks, and local servers like Ollama, vLLM, and
LM Studio — plus Anthropic (Claude). contextmeter figures out which format
each request uses on its own.
Install
uv pip install contextmeter
Use
Start the meter (provider is auto-detected; defaults to forwarding to OpenAI):
contextmeter
Then point your app's base URL at http://localhost:8765. To forward somewhere else
(Anthropic, a local server, OpenRouter, …), just set --upstream:
contextmeter --upstream https://api.anthropic.com
contextmeter --upstream http://localhost:11434
--provider is optional — pass openai or anthropic only if you want to pin the
format instead of letting it auto-detect.
Note: pass the host root as
--upstream, not the/v1endpoint. Your LLM client already appends the path (e.g./v1/chat/completions), so usehttp://localhost:11434— nothttp://localhost:11434/v1(which would double the path to/v1/v1/...).
Why
Most developers have no idea what's eating their context window. Tool definitions
alone can consume 40–60% before the first message. contextmeter shows you, live,
in your terminal.
Status
Early. Supports OpenAI-compatible + Anthropic request analysis with automatic
per-request provider detection. Token counts are approximate (tiktoken-based; Anthropic
is approximated). Responses are currently buffered (no token-by-token streaming
pass-through yet), and the breakdown counts message text but not yet the model's emitted
tool_calls/tool_use argument payloads.
Roadmap: native Google Gemini schema; streaming pass-through; count tool-call argument payloads in History; Python wrapper entry point (no proxy); pricing/limits auto-refresh; richer Textual UI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file contextmeter-0.1.0.tar.gz.
File metadata
- Download URL: contextmeter-0.1.0.tar.gz
- Upload date:
- Size: 58.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9eb62ada4a259df2dfba33297c75eda8464a3a42fd97c3a89ba570dc0838c59
|
|
| MD5 |
e4f508b3a889ac5e148793bbbdd440b9
|
|
| BLAKE2b-256 |
001833003c3836ad8cffa65dda961ea6ecd5e53e6a1cbe26d6ad8d65a6916edf
|
File details
Details for the file contextmeter-0.1.0-py3-none-any.whl.
File metadata
- Download URL: contextmeter-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5789d07a8d9a9eed5663252aaac26977b63c3a0ef7dfbfe5dda21b8011dd1272
|
|
| MD5 |
aca9756a0b4e7ed03d4631de13d61e78
|
|
| BLAKE2b-256 |
2a4e3a4a71ac910253e3f0d9673d2a94d0f83a73a31ac34f69a28b87e54d0f61
|