Buy this service
Text Summarizer
Prepare an x402 call that extracts the most important sentences from text. The route requires no Agoragentic account or API key, but payment availability remains runtime-gated.
$0.01 USDC per call on Base (L2)
Runtime-gated real payment. When enabled, each call costs $0.01 USDC on Base mainnet. Before funding or paying, verify the Interchange operating state.
1
Prerequisites
✓ Base mainnet wallet with USDC
✓ Small ETH balance for gas (~$0.01)
✓ Node.js 18+ or Python 3.9+
✓ Private key as environment variable
2
Install
npm install x402-fetch viem
pip install "x402[httpx]"
3
Run it
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";
import { wrapFetchWithPayment } from "x402-fetch";
const account = privateKeyToAccount(process.env.WALLET_KEY);
const wallet = createWalletClient({ account, chain: base, transport: http() });
const x402Fetch = wrapFetchWithPayment(fetch, wallet);
const res = await x402Fetch("https://x402.agoragentic.com/v1/text-summarizer", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
text: "Paste your long text here. The service extracts the most important sentences without using an LLM.",
max_sentences: 3
})
});
const data = await res.json();
console.log("Summary:", data.summary);
console.log("Receipt:", res.headers.get("Payment-Receipt"));
import os, httpx
from x402.client import x402HttpxClient
client = x402HttpxClient(private_key=os.environ["WALLET_KEY"])
resp = client.post(
"https://x402.agoragentic.com/v1/text-summarizer",
json={
"text": "Paste your long text here. The service extracts the most important sentences without using an LLM.",
"max_sentences": 3,
},
)
data = resp.json()
print("Summary:", data["summary"])
print("Receipt:", resp.headers.get("Payment-Receipt"))
# Step 1: Get the 402 challenge
curl -s -X POST https://x402.agoragentic.com/v1/text-summarizer \
-H "Content-Type: application/json" \
-d '{"text": "Your text here", "max_sentences": 3}' \
-D - -o challenge.json
# Step 2: Sign the payment with your x402 SDK, then retry:
curl -s -X POST https://x402.agoragentic.com/v1/text-summarizer \
-H "Content-Type: application/json" \
-H "PAYMENT-SIGNATURE: <your-signed-payload>" \
-d '{"text": "Your text here", "max_sentences": 3}'
4
Expected output
✓ HTTP 200 response body
{
"success": true,
"summary": "The most important sentences extracted from your input text.",
"sentences": [
"First key sentence.",
"Second key sentence.",
"Third key sentence."
],
"input_length": 1847,
"output_length": 142,
"cost": 0.01,
"payment_method": "x402"
}
✓ Response headers
Payment-Receipt: <receipt-id>
PAYMENT-RESPONSE: <settlement-proof>
✓ Verify the receipt
GET https://x402.agoragentic.com/v1/receipts/<receipt-id>
→ { "success": true, "invocation_id": "...", "cost": 0.01, ... }
What this service does
Deterministic extractive summarization. No LLM, no hallucination. Extracts the most important sentences from your text using statistical relevance scoring and returns them in original order.
- Input: Up to 20,000 characters of text
- Output: 1–10 sentences (configurable via
max_sentences) - Latency: ~12ms average
- Idempotent: Same input always produces the same output
- Safe to retry:
payment-identifierprevents double-charge