{"uid":"cap_RqsgBWueY4dgbf-9_D0yd","slug":"agent-prep-text-chunking-8805b4cb","name":"Agent Prep – Text Chunking","description":"Pre-LLM utilities for AI agents: structural JSON diff, JSON path listing, token estimation, text chunking, and truncation. Pay with USDC via x402 — no API keys.","url":"https://agent-prep.annushka1190.workers.dev/v1/tokens/chunk","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"body":{"type":"object"},"type":{"const":"http"},"method":{"enum":["POST"]},"bodyType":{"const":"json"}}}}},"responseSchema":{"type":"json","example":{"count":1,"chunks":[{"text":"…","tokens":10}]}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","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.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_cUXrNI-Fv17VZ-Ne7azOv","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Splits text into token-aware chunks of configurable size, returning each chunk with its text and token count.","exampleAgentPrompt":"Can you chunk this article text into pieces of no more than 512 tokens each so I can send them to my embedding model? Here's the text: 'The history of artificial intelligence dates back to...'","exampleUseCases":[{"title":"RAG pipeline document ingestion","prompt":"I need to split this 10,000-word research paper into 512-token chunks with 50-token overlap so I can embed them and store them in my vector database — can you chunk it for me?"},{"title":"LLM context window management","prompt":"This customer support transcript is way too long to fit in one LLM call. Can you break it into chunks of 1024 tokens so I can process each one separately?"},{"title":"Batch embedding preparation","prompt":"I have a big block of product description text and I want to generate embeddings for it. Can you split it into 256-token chunks first so each piece fits cleanly into the embedding model?"}],"resultDescription":"Returns a JSON object containing the total number of chunks produced and an array of chunk objects, each with the chunk's text and its token count. Example: {\"count\": 1, \"chunks\": [{\"text\": \"…\", \"tokens\": 10}]}.","failureModes":["Missing required 'input' field returns a 400 validation error","Excessively large text bodies may hit worker memory or timeout limits","Invalid chunk size or overlap parameters may return a 422 or default to service defaults","Payment not provided or insufficient USDC triggers a 402 Payment Required response","Malformed JSON body returns a 400 parse error"],"whenToPreferThis":"Choose this endpoint when you need a lightweight, pay-per-call text chunking utility with no API key setup — ideal for AI agent pipelines that need to preprocess text before embedding or LLM inference. Prefer it over rolling your own chunking logic when you need token-accurate splits (not character-based) and want a simple HTTP call with USDC micropayment billing via x402.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T06:35:42.528Z","isFirstParty":false}