81trust / 100
Text Chunk
by Text chunk (RAG) in AI models & inference
x402 APIPassing, checked 33 min ago
Split text into overlapping chunks for RAG ingestion - by characters (default) or by exact LLM tokens. Returns the chunks plus offsets. Deterministic, no model needed.
POST https://agent402.tools/api/text-chunk
Last 30 days
All checks passedSome failedAll failedNot checked
- Uptime
- 100%
- Response time
- 194 ms typical, 194 ms slowest 5%
- Last check
- 33 min ago
- Next check
- any minute now
How to call it
# See the payment challenge (nothing is charged)
curl -i -X POST "https://agent402.tools/api/text-chunk" \
-H "content-type: application/json" \
-d '{"overlap":20,"size":120,"text":"The x402 protocol lets an agent pay for a single request. A server answers with payment terms, the agent signs a stablecoin authorization, and the request is retried with the payment attached. Payment settles on chain, so the server needs no account and the agent needs no subscription. The x402 protocol prices each request on its own, and payment terms travel with the request itself.","unit":"chars"}'import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client().register(
"eip155:8453",
new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);
// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fagent402.tools%2Fapi%2Ftext-chunk
const res = await pay("https://agent402.tools/api/text-chunk", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({"overlap":20,"size":120,"text":"The x402 protocol lets an agent pay for a single request. A server answers with payment terms, the agent signs a stablecoin authorization, and the request is retried with the payment attached. Payment settles on chain, so the server needs no account and the agent needs no subscription. The x402 protocol prices each request on its own, and payment terms travel with the request itself.","unit":"chars"}),
});
console.log(await res.json());Example input
{
"overlap": 20,
"size": 120,
"text": "The x402 protocol lets an agent pay for a single request. A server answers with payment terms, the agent signs a stablecoin authorization, and the request is retried with the payment attached. Payment settles on chain, so the server needs no account and the agent needs no subscription. The x402 protocol prices each request on its own, and payment terms travel with the request itself.",
"unit": "chars"
}Example output
{
"chunks": [
"The x402 protocol lets an agent pay for a single request. A server answers with payment terms, the agent signs a stablec",
"gent signs a stablecoin authorization, and the request is retried with the payment attached. Payment settles on chain, s"
],
"count": 4,
"overlap": 20,
"size": 120,
"unit": "chars"
}Security scan
- No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.
Recent checks
| When | Result | HTTP | Time | Price |
|---|---|---|---|---|
| 33 min ago | Passed | 402 | 194 ms | $0.001 |
| 4 h ago | Passed | 402 | 186 ms | $0.001 |
| 9 h ago | Passed | 402 | 220 ms | $0.001 |