# Semantic Text Chunker / RAG Chunker

> Semantic Text Chunker / RAG Chunker is a paid API for AI agents from x402-deployer.x402-deployer.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-14).

Splits long text into chunks using fixed, sentence-aware, or paragraph-aware modes, returning each chunk's text, character offsets, and size.

## Facts

- Endpoint: POST https://x402-deployer.x402-deployer.workers.dev/semantic-chunk
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-deployer-x402-deployer-workers-dev-9b72d74f
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_hI7Hh-DYthynGlvNQ-EB4

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 x402-deployer-x402-deployer-workers-dev-9b72d74f -d '<json body>'
```

Example prompt: Split this 10,000-word article into sentence-aware chunks of 500 characters each so I can embed them for my RAG pipeline: [article text here].

## When to prefer this

Use this endpoint when you need to preprocess long documents for vector embedding or RAG pipelines and want control over chunking strategy (fixed windows, sentence-aware greedy packing, or paragraph boundaries). It runs purely locally with no upstream AI calls, making it fast, deterministic, and cheap. Prefer it over regex-based client-side splitting when you need accurate character offsets and sentence/paragraph awareness.

## Known failure modes

- Empty or missing text body returns an error
- Invalid mode value returns a validation error
- chunk_size too small for sentence mode may produce single-sentence chunks larger than requested
- Very large text inputs may hit Cloudflare Worker memory or time limits

## How this service works

Semantic chunker / text splitter / RAG chunker / chunking with overlap / sentence + paragraph aware. Splits long text into chunks with three modes: 'fixed' (hard char-count windows with overlap), 'sentence' (greedy pack of sentences up to chunk_size), 'paragraph' (split on blank lines, never pack across paragraphs). Returns each chunk's text, start/end character offsets, and char count. Pure local — no upstream call.

## Output

An array of chunk objects, each containing the chunk text, its start and end character offsets within the original input, and the character count of that chunk. Three chunking modes are available: fixed (hard character windows with configurable overlap), sentence (greedy sentence packing up to chunk_size), and paragraph (split on blank lines without cross-paragraph packing).

## Example request

```json
{
 "input": {
  "body": {
   "mode": "sentence",
   "text": "Artificial intelligence is transforming industries worldwide. Machine learning models are becoming increasingly sophisticated. Natural language processing enables computers to understand human communication. Deep learning networks power modern computer vision systems. These technologies are reshaping how businesses operate and compete.",
   "overlap": 50,
   "chunk_size": 500
  },
  "type": "http",
  "method": "POST",
  "bodyType": "json"
 }
}
```

## Request schema (JSON Schema)

```json
{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "type": "object",
 "properties": {
  "input": {
   "type": "object",
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "type": "string",
     "enum": [
      "POST"
     ]
    },
    "bodyType": {
     "type": "string",
     "enum": [
      "json",
      "form-data",
      "text"
     ]
    },
    "body": {
     "properties": {
      "text": {
       "type": "string",
       "description": "Text to split. Up to 1,000,000 chars."
      },
      "chunk_size": {
       "type": "number",
       "description": "Target chunk size in characters. Range [50, 20000]. Default 500."
      },
      "overlap": {
       "type": "number",
       "description": "Overlap between chunks in characters. Default 50. Capped at chunk_size - 1."
      },
      "mode": {
       "type": "string",
       "enum": [
        "fixed",
        "sentence",
        "paragraph"
       ],
       "description": "Splitting strategy. Default 'fixed'."
      }
     },
     "required": [
      "text"
     ]
    }
   },
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "chunks": {
       "type": "array",
       "items": {
        "type": "object",
        "properties": {
         "text": {
          "type": "string"
         },
         "start": {
          "type": "integer"
         },
         "end": {
          "type": "integer"
         },
         "char_count": {
          "type": "integer"
         }
        }
       }
      },
      "chunk_count": {
       "type": "integer"
      },
      "mode": {
       "type": "string"
      },
      "chunk_size": {
       "type": "integer"
      },
      "overlap": {
       "type": "integer"
      },
      "text_chars": {
       "type": "integer"
      },
      "source": {
       "type": "string"
      }
     }
    }
   },
   "required": [
    "type"
   ]
  }
 },
 "required": [
  "input"
 ]
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-deployer-x402-deployer-workers-dev-9b72d74f/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-deployer.x402-deployer.workers.dev](https://www.zero.xyz/host/x402-deployer.x402-deployer.workers.dev/llms.txt)
