REAL PAYMENTSBase (chain id 8453) · USDC payments have real value. Paid upstream failures are not automatically refunded.
Guide · RAG

Chunks that still know where they came from.

Fixed-size splitting cuts code blocks in half and throws away the heading a paragraph belongs to, so retrieval returns "Run the build command" with no idea which product or step it is. This guide chunks a short deploy guide and shows the result.

The example, run through the real engine

This is the exact input and an excerpt of the report Markdown Chunker for RAG returns for it. The full report also carries input and report SHA-256 hashes for verification.

Input
{
  "markdown": "# Deploy guide\n\nThis guide covers deploys.\n\n## Requirements\n\nNode 24 and a Cloudflare account.\n\n## Steps\n\n### Build\n\nRun the build command. It writes the worker bundle to dist/.\n\n```bash\nnpm run build\nnpx wrangler deploy\n```\n\n### Roll back\n\nUse the dashboard to promote the previous version.",
  "maxChars": 200
}
Report excerpt: chunkCount, chunks
{
  "chunkCount": 4,
  "chunks": [
    {
      "index": 0,
      "id": "58b8558248327aaa",
      "headingPath": [
        "Deploy guide"
      ],
      "startLine": 1,
      "endLine": 3,
      "charCount": 42,
      "text": "# Deploy guide\n\nThis guide covers deploys."
    },
    {
      "index": 1,
      "id": "b086e21106d00566",
      "headingPath": [
        "Deploy guide",
        "Requirements"
      ],
      "startLine": 5,
      "endLine": 7,
      "charCount": 50,
      "text": "## Requirements\n\nNode 24 and a Cloudflare account."
    },
    {
      "index": 2,
      "id": "eaf69e8f6df672ff",
      "headingPath": [
        "Deploy guide",
        "Steps",
        "Build"
      ],
      "startLine": 9,
      "endLine": 18,
      "charCount": 128,
      "text": "## Steps\n\n### Build\n\nRun the build command. It writes the worker bundle to dist/.\n\n```bash\nnpm run build\nnpx wrangler deploy\n```"
    },
    {
      "index": 3,
      "id": "b8849db643db29be",
      "headingPath": [
        "Deploy guide",
        "Steps",
        "Roll back"
      ],
      "startLine": 20,
      "endLine": 22,
      "charCount": 65,
      "text": "### Roll back\n\nUse the dashboard to promote the previous version."
    }
  ]
}
0.011112 USDC per call · paid with x402 on Base

No account is needed to pay: an agent with its own wallet answers the HTTP 402 quote, or a human approves each payment through the local Agent Spend bridge. Payment settles before delivery; there is no automatic refund.

01Every chunk carries its heading path

The four chunks come back with paths such as ["Deploy guide", "Steps", "Build"]. Prepend the path to the text you embed, or store it as metadata, and a query for "how do I roll back a deploy" can match the right section even though the paragraph never says "deploy".

02Code blocks stay whole

The bash block with npm run build and npx wrangler deploy lands in one chunk together with the sentence that explains it. A fenced block is only split if it alone is larger than maxChars.

A heading with no text of its own — "## Steps" directly followed by "### Build" — is carried into the next chunk instead of becoming a chunk that only contains a title.

03Ids and line ranges for citations

Each chunk has a 16-character id derived from its position, heading path and text, plus startLine and endLine in the source. Re-chunking the same document with the same settings gives the same ids, so you can upsert into a vector store instead of duplicating.

Budgets are in characters, not tokens: about four characters per English token. Optional overlap repeats the end of the previous chunk and is added on top of maxChars.

Questions

How large can the document be?

Up to 65,536 characters per call, with maxChars between 200 and 8,000 and overlap up to a quarter of maxChars.

Does it fetch pages or render HTML?

No. It works on the Markdown you send. Convert saved HTML with HTML → Clean Markdown first.

Are ids stable across edits?

Ids are stable for identical input and settings. Editing a section changes the ids of chunks from that point on.

What does it cost?

0.011112 USDC per call on Base mainnet, including the platform fee. The exact 402 quote is authoritative.

Next steps