Send any content. Get back a trimmer version that does the same job with fewer tokens.
<article class="prose"> <h1>Welcome to our brand new docs</h1> <p>This extensive guide will help you learn about all of the APIs that are available.</p> <ul> <li>Auth</li> <li>Rate limits</li> </ul> </article>
POST to /v1/trim. Same contract whether you're trimming HTML, prompts, or chat history. No migrations. Ever.
Every token leantokn strips is a token you never pay for. The more you use it, the more the math works in your favor.
Payloads are processed in memory and immediately discarded. We never store your content. SOC 2 Type II.
Trained on token-equivalence — keep the meaning your model uses, throw away the rest. No fuzzy compression. No surprises in production.
POST raw HTML, prompt strings, or chat history. We accept up to 1MB per request, stream up to 10MB.
Our model rewrites the payload into a semantically equivalent form, optimized for the model you name.
Pipe the trimmed payload into Claude, GPT, Gemini, Llama. Same intent, fewer tokens billed.
One verb. One contract. Stays the same as we ship more types. Drop it in front of anything that bills per token.
# request curl https://api.leantokn.dev/v1/trim \ -H "authorization: Bearer ltk_••••" \ -H "content-type: application/json" \ -d '{ "input": "<html>…</html>", "type": "html", "target": "claude-opus-4.7" }' # response { "result": "# Welcome\n\nThis guide…", "type": "markdown", "stats": { "input_tokens": 3184, "output_tokens": 937, "tokens_saved": 2247, "savings_percent": 71, "usd_saved": 0.011, "duration_ms": 112 } }
Every capability ships as a new type on the same endpoint. Your integration never changes.
Strip the bytes a model already reads through. Average payload drops 65–75%.
Detect dead weight in prompts — boilerplate, unused examples, duplicated context.
Live, streaming summarization of chat history. Replace the first N turns with a tight digest.
Trim retrieved documents to only the spans that load-bear on the user's question.
1M tokens free, no card. Drop one line in front of any model call. If we don't save you money, the bill is on us.