Text analysis
Full text analysis - word/sentence stats, keyword extraction, and token count in one pass.
3 tools run server-side in one request. You pay once, settle once, and get a single response - no orchestration, no per-step payments, and a partial-success envelope if any step fails. USDC over x402 on any supported chain.
When to use this pack
An agent evaluating text content needs the complete picture: how long is it (words, sentences, paragraphs), what are the key topics (keyword extraction), and how many LLM tokens would it consume? Useful for content pipelines, RAG prep, and prompt budgeting.
Tools in this pack
All 3 run inside the single $0.004 call above. Each is also callable on its own if you only need one part.
- Text statistics POST /api/text-stats 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. Use it to budget a prompt or size a document before sending it; for an exact count on one model's tokenizer use a tokenizer tool.
- Keyword extraction POST /api/keywords Top keywords and two-word phrases by frequency (stopwords removed). Cheap, deterministic signal for routing, tagging, and dedup.
- Token count POST /api/token-count Count exact LLM tokens for a string using the real OpenAI BPE (o200k_base for gpt-4o/o-series, cl100k_base for gpt-4/gpt-3.5). Deterministic, offline - budget context windows without calling a model.
Bought one at a time, these 3 tools cost $0.004 together; the pack is that sum less a 10% bundle discount, rounded up to the $0.001 settlement floor, which is $0.004.
Workflow
- Call text-stats to get word count, sentence count, paragraph count, and reading time.
- Call keywords to extract the top terms and their frequency.
- Call token-count to estimate the LLM token consumption (useful for prompt budgeting).
Arguments
| Name | Required | Description | Example |
|---|---|---|---|
text | yes | Text to analyze | The x402 protocol enables pay-per-call API payments using USDC stablecoins on Base and other chains. |
What one call returns
A JSON object with pack, args, steps, summary; steps holds one entry per tool (text-stats, keywords, token-count), each with its own result or error. Full example on the API page.
Call it directly
Any x402 client pays the 402 and gets the whole workflow back in one response. With the agent402-client SDK (npm i agent402-client, an ES module):
import { Agent402 } from "agent402-client";
// payFetch: an x402-wrapped fetch your wallet signs (@x402/fetch).
// Tools on the free tier need no options: new Agent402() pays them by proof-of-work.
// an existing prepaid credits key also works: new Agent402({ creditsKey })
const client = new Agent402({ fetch: payFetch });
const result = await client.call("skill-text-analyze", {"text":"The x402 protocol enables pay-per-call API payments using USDC stablecoins on Base and other chains."});
Run it in Claude
claude mcp add agent402 -s user -- npx -y agent402-mcp@latest
Then paste this prompt into Claude:
Analyze this text using Agent402's text-analyze skill pack: 'The x402 protocol enables pay-per-call API payments using USDC stablecoins on Base and other chains.' (1) Text stats, (2) keywords, (3) token count. Report the full analysis.