← Back to directory

Cut text so it fits a token budget for an LLM context window or a tool output li...

https://agents.204-168-199-108.sslip.io/v1/util/truncate-tokens

Overview

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.

Protocol x402
Price $0.0010
Payment Asset USD Coin
Payment Network Base
Category uncategorized
Provider Truncate text to token limit
Source bazaar
Indexed 2026-12-01 21:27:22

Health

Status healthy
Latency (p50) 112ms
Uptime (30d) 100.0%
Reliability Score 97/100
Last Checked 2026-12-05 01:35:13
Last Healthy 2026-12-05 01:35:13
Consecutive Failures 0

x402 Payment Validation

Payment Requirements Valid
Asset Verified Known USDC
Facilitator —

Input Schema

{ "method": "GET", "queryParams": { "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." }, "type": "http" }

Output Schema

{ "example": { "kept_pct": 32.6, "max_tokens": 30, "note": "tokens are estimates (±15%, GPT/Claude-style BPE); leave headroom", "original_chars": 313, "original_tokens": 71, "result_chars": 102, "result_tokens": 28, "strategy": "middle", "text": "Agents pay per call with USDC on Base. The\n…[truncated]…\nfind them. Prices start at a tenth of a cent.", "truncated": true }, "type": "json" }

Recent Health Checks

Time Status HTTP Latency Error
2026-12-05 01:35:13 healthy 402 112ms
2026-12-05 00:58:22 healthy 402 111ms
2026-12-04 18:28:56 healthy 402 2060ms