denk.halowerk.com/v1/token-budget-trim
Cut a document down to a token budget by dropping the lowest-priority sections first and truncating the last one at a sentence boundary; exact count of the result. Accepts explicit sections with priorities (or Markdown that is split at headings, with optional priorities by heading text). Required sections are never dropped.
POST
https://denk.halowerk.com/v1/token-budget-trimUptime100% of 2 checks in 30 days
30 days agoToday
Try it
Pays from your browser wallet in USDC on Base or USDG on Robinhood Chain, whichever the endpoint takes. The provider is paid directly; failed calls aren't refunded by Fourohtwo.
The response shows up here.
Call it from an agent
// npm install fourohtwo
import { createPayer } from "fourohtwo";
// One agent key pays USDC on Base or USDG on Robinhood Chain, inside your spending rules.
const pay = createPayer({ privateKey: process.env.AGENT_KEY, maxPerCallUsd: "0.05" });
const res = await pay("https://denk.halowerk.com/v1/token-budget-trim", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({"budget_tokens":12,"sections":[{"id":"a","priority":90,"text":"Keep this sentence."},{"id":"b","priority":10,"text":"Drop this one first. It is less important."}]}),
});
console.log(await res.json());Example input
{
"budget_tokens": 12,
"sections": [
{
"id": "a",
"priority": 90,
"text": "Keep this sentence."
},
{
"id": "b",
"priority": 10,
"text": "Drop this one first. It is less important."
}
]
}