81trust / 100
Text Stats
by Text statistics in Onchain & crypto
x402 APIPassing, checked 5 h ago
Counts for any text in one call: characters (Unicode code points), words, sentences, paragraphs, avgWordLength, readingTimeMinutes (200 words a minute) and estimatedTokens, a rough LLM token estimate (about 4 characters a token, one per Chinese or Japanese character). Chinese and Japanese text, which has no spaces, is counted a character per word, and 。!? end sentences.
POST https://agent402.tools/api/text-stats
Last 30 days
All checks passedSome failedAll failedNot checked
- Uptime
- 100%
- Response time
- 216 ms typical, 216 ms slowest 5%
- Last check
- 5 h 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-stats" \
-H "content-type: application/json" \
-d '{"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."}'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-stats
const res = await pay("https://agent402.tools/api/text-stats", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({"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."}),
});
console.log(await res.json());Example input
{
"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."
}Example output
{
"avgWordLength": 4.95,
"characters": 386,
"estimatedTokens": 97,
"paragraphs": 1,
"readingTimeMinutes": 0.3,
"sentences": 4,
"words": 65
}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 |
|---|---|---|---|---|
| 5 h ago | Passed | 402 | 216 ms | $0.001 |