agents.204-168-199-108.sslip.io/v1/util/truncate-tokens
Cut text so it fits a token budget for an LLM context window or a tool output limit. Strategies: head (keep the start), tail (keep the end, e.g. logs), middle (keep start + end, cut the middle) and sentences (keep the start, cut at a sentence end). Cuts on word / sentence boundaries, adds a visible marker, and returns original vs result token estimates (GPT/Claude-style BPE), characters and % kept
GET
https://agents.204-168-199-108.sslip.io/v1/util/truncate-tokensUptime100% of 1 check 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://agents.204-168-199-108.sslip.io/v1/util/truncate-tokens?max_tokens=30&strategy=middle&text=Agents+pay+per+call+with+USDC+on+Base.+The+x402+protocol+makes+that+simple%3A+a+server+answers+402+with+a+price%2C+the+agent+pays+and+retries.+Facilitators+settle+the+payment+on-chain+in+about+two+seconds.+Sellers+list+their+endpoints+on+the+Coinbase+Bazaar+so+agents+can+find+them.+Prices+start+at+a+tenth+of+a+cent.");
console.log(await res.json());Example input
{
"max_tokens": "30",
"strategy": "middle",
"text": "Agents pay per call with USDC on Base. The x402 protocol makes that simple: a server answers 402 with a price, the agent pays and retries. Facilitators settle the payment on-chain in about two seconds. Sellers list their endpoints on the Coinbase Bazaar so agents can find them. Prices start at a tenth of a cent."
}