measure_tokens
Measure LLM token consumption of any program by routing its API calls through a non-blocking token-counting proxy, reporting input/output/total tokens and call count.
Instructions
Measure how many LLM tokens a program consumes when it runs (works on any machine — no
special hardware). The program must read base_url_env for its LLM endpoint (most SDKs do);
we point that at a non-blocking counting proxy forwarding to upstream, run the program, and
report real provider usage (input/output/total tokens, call count). For a non-Anthropic
target, pass its provider's base-url env var and upstream (e.g. OPENAI_BASE_URL,
https://api.openai.com). If llm_calls is 0, the target didn't route through base_url_env.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | ||
| upstream | No | https://api.anthropic.com | |
| base_url_env | No | ANTHROPIC_BASE_URL |