# Agent Prep – Text Chunking

> Agent Prep – Text Chunking is a paid API for AI agents from agent-prep.annushka1190.workers.dev, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-15).

Splits text into token-aware chunks of configurable size, returning each chunk with its text and token count.

## Facts

- Endpoint: POST https://agent-prep.annushka1190.workers.dev/v1/tokens/chunk
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent-prep-text-chunking-8805b4cb
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_RqsgBWueY4dgbf-9_D0yd

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agent-prep-text-chunking-8805b4cb -d '<json body>'
```

Example prompt: 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...'

## When to prefer this

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.

## Known failure modes

- 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

## How this service works

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.

## Output

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}]}.

## Request schema (JSON Schema)

```json
{
 "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"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "count": 1,
  "chunks": [
   {
    "text": "…",
    "tokens": 10
   }
  ]
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent-prep-text-chunking-8805b4cb/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent-prep.annushka1190.workers.dev](https://www.zero.xyz/host/agent-prep.annushka1190.workers.dev/llms.txt)
