Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Tracks token usage and cost per NetClaw interaction, enforcing session spending caps and tool-call depth limits.
18% 86%+68 ptsof test cases passed
Passed 19 of 22 test cases with the skill, and 4 of 22 without it.
Which environment variable can an engineer set to force a $2.00 session budget ceiling without modifying openclaw.json?
Identifies NETCLAW_SESSION_BUDGET_USD variable
3 of 3 safety checks passed
Track and display token consumption and cost for every NetClaw interaction. Enforce per-session spending caps and tool-call depth limits to prevent runaway API costs. Serialize MCP server responses in GCF format to reduce token usage by 40-60% on tabular network data.
Without this skill, a single casual phone question can trigger unbounded agentic tool chains that silently burn $10+ in API costs. This skill ensures:
This skill uses the netclaw_tokens shared library (src/netclaw_tokens/):
| Module | Function | Purpose |
|---|---|---|
| counter.py | count_tokens() | Count tokens via Anthropic API (fallback: len/4 estimate) |
| counter.py | count_message_tokens() | Count tokens for full message arrays |
| cost_calculator.py | calculate_cost() | Calculate USD cost with model-aware pricing |
| cost_calculator.py | get_pricing() | Look up model pricing (with env var override) |
| budget_policy.py | BudgetPolicy | Per-session budget configuration |
| budget_policy.py | resolve_session_config() | Load policy from config + interface detection |
| session_ledger.py | SessionLedger | Cumulative tracking + enforcement |
| footer.py | format_footer() | Format mandatory token/cost footer |
| gcf_serializer.py | serialize_response() | Serialize data to GCF with JSON fallback |
| gcf_wrapper.py | wrap_json_response() | Convert JSON responses to GCF |
Next to this one in the catalogue, plus more from the same author.