Token optimizer
Less repetition. More useful context.
Try reversible tool-output compression on your own data. See exactly what changes before enabling it for an agent.
Every record and repeated line is retained in a reversible representation. JSON formatting may change; row values, order and repeat counts remain available. A smaller representation can change model behavior. Compare task quality before enabling it.
From inspection to protection
Automatic. Still under your control.
The local CLI can inspect files and the proxy can compress eligible tool results before the next request. Compression is on automatically. Existing spend admission and kill controls stay in place.
Read the optimization guide →leash optimize tool-output.json --json
# Start with automatic compression:
leash start
# Explicitly disable compression:
LEASH_TOOL_COMPRESSION=off leash startCheck the whole task
Compare cost. Keep the outcome.
Bring two CSV exports for the same set of tasks. Leash matches every case, compares total costs and flags any task that passed before but failed after. Your files stay in this browser.
CSV format and a labeled example
Use one unique case ID per task and the exact same tasks in each file. cost_usd includes all attempts and retries for that task; passed is your true/false outcome check; source is provider or estimate. The optional tokens field is a nonnegative integer.
case_id,cost_usd,passed,source,tokens
example-task,0.12,true,estimate,8000This row is an example, not a customer result. “Provider” means you supplied provider figures; Leash does not independently verify the source or execute the task checks.
What a savings number means
Measure first. Make the claim second.
These numbers measure one tool output. They are not a reduction in your entire bill, a tokenizer measurement, or proof that a model completes the same task. Highly repetitive inputs can shrink dramatically; short or unique outputs may not shrink at all.
A claim such as “30× lower cost” requires the same workload, verified outcomes and before/after provider usage. Start with our full reproducible fixture results, then use invoice reconciliation to check a real run. We do not claim 30× savings for every customer.