{"uid":"cap_MoSSK6U1u6-AD3pGBBDso","slug":"web2markdown-text-normalizer-whitespace-collapse-7d04f2b8","name":"Web2Markdown Text Normalizer (Whitespace Collapse)","description":"Pay-per-call API for AI agents: turn any public web page or PDF into clean, LLM-ready Markdown. $0.002 per call in USDC on Base via x402. No API key, no signup.","url":"https://lin-desk-x402.lindesk.workers.dev/v1/texttools/normalize?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET","HEAD","DELETE"],"type":"string"},"queryParams":{"type":"object","required":["input"],"properties":{"input":{"type":"string","description":"Input text; max 100 KiB"},"collapse_whitespace":{"enum":["true","false"],"type":"string","description":"Collapse runs of whitespace"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"op":{"type":"string"},"meta":{"type":"object","properties":{"chars_in":{"type":"integer"},"chars_out":{"type":"integer"},"elapsed_ms":{"type":"integer"}}},"result":{}}}}}}},"responseSchema":{"type":"json","example":{"op":"normalize","meta":{"chars_in":13,"chars_out":11,"elapsed_ms":0},"result":"Hello World"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_8xkLUa1rymHWAWPsBtuMs","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Normalizes and cleans raw text by collapsing whitespace and standardizing formatting, returning LLM-ready plain text.","exampleAgentPrompt":"Clean up this scraped text by collapsing all the extra whitespace and newlines so it's ready to pass to an LLM: 'Hello   World\\n\\n\\n  This   is   messy   text.'","exampleUseCases":[{"title":"Clean scraped article before summarization","prompt":"I just extracted text from a news article and it's full of extra spaces and blank lines — can you normalize it so it's clean enough to summarize with an LLM? Here's the raw text: 'Breaking News:   Economy   grows\\n\\n\\n  sharply   in   Q2  ...'"},{"title":"Prep PDF extract for embedding pipeline","prompt":"I pulled text out of a PDF and it came out with tons of weird whitespace. Can you collapse all those extra spaces and line breaks so the text is clean before I embed it?"},{"title":"Tidy LLM prompt context before injection","prompt":"Before I inject this user-supplied content into my prompt, I want to normalize it — collapse all the whitespace runs so it doesn't waste tokens. Can you run this through the normalizer: 'User said:    I   want   to   know   about   climate   change  .'"}],"resultDescription":"A JSON object containing the operation name ('normalize'), metadata with input character count, output character count, and elapsed milliseconds, and the cleaned result string with whitespace normalized.","failureModes":["Input text exceeds 100 KiB limit — request rejected","Missing required 'input' query parameter — API returns error","Payment not fulfilled via x402 protocol — 402 Payment Required response","Invalid 'collapse_whitespace' enum value (must be 'true' or 'false') — validation error","Empty input string — may return empty result with zero chars_out"],"whenToPreferThis":"Choose this endpoint when you need a lightweight, pay-per-call text normalization step with no API key or signup overhead, especially in agentic pipelines where you need to clean up scraped or extracted text before passing it to an LLM. Ideal when whitespace collapse is the primary cleaning operation needed and you want a fast, stateless transformation with measurable char-in/char-out metrics.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-11T00:43:51.782Z","isFirstParty":false,"canonicalSlug":"web2markdown-text-normalizer-whitespace-collapse-7d04f2b8"}