HTTP/1.1 402 PAYMENT REQUIRED agent402.base.eth · BASE · SOLANA · POLYGON · ARBITRUM · MONAD · CELO · AVALANCHE · SEI · OPTIMISM · STELLAR · ALGORAND · ROBINHOOD · USDC · USDG
Agent402 / tools / pdf-summarize

Summarize a PDF

$0.030 per call · USDC via x402 · POST /api/pdf-summarize

Fetch a PDF from a URL, extract its text, and return a concise AI-generated summary - factual, no information added beyond what's in the document. Body: {"url":"https://…/file.pdf","maxWords":200?}. Uses the same OpenAI-compatible gateway as /v1/chat/completions internally; the model that actually served is disclosed in the response.

TRY IN PLAYGROUND →

Input

FieldTypeDescription
url *stringPublic http(s) URL of a PDF
maxWordsnumberTarget summary length in words, 50-500 (default 200)

Example output

{
  "url": "https://bitcoin.org/bitcoin.pdf",
  "pages": 9,
  "wordCount": 3604,
  "summary": "The paper proposes a peer-to-peer electronic cash system that lets online payments move directly between parties without a financial institution, using a proof-of-work chain as a timestamp server to prevent double-spending…",
  "summaryWordCount": 148,
  "model": "openai/gpt-4o-mini",
  "truncatedInput": false
}

Try it - see the 402 challenge (free)

curl -i -X POST https://agent402.tools/api/pdf-summarize \
  -H "Content-Type: application/json" \
  -d '{"url":"https://bitcoin.org/bitcoin.pdf","maxWords":150}'

The response is HTTP 402 Payment Required with exact payment requirements. Any x402 v2 client pays automatically and retries:

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/pdf-summarize", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "url": "https://bitcoin.org/bitcoin.pdf",
    "maxWords": 150
  }),
});
Wallet-only. This tool reaches the network/browser/storage, so it is paid in USDC via x402 (no proof-of-work tier).

Related tools

Extract article

$0.010 · POST /api/extract

Extract the main article content from any public URL as clean markdown. Returns title, byline, excerpt, word count, and …

try in playground →

Page metadata

$0.002 · GET /api/meta

Fetch page metadata for a URL: title, description, OpenGraph, Twitter cards, canonical URL, favicon.

try in playground →

Browser render

$0.02 · POST /api/render

Render a page in a real headless Chromium browser (JavaScript executed), then extract the main content as clean markdown…

try in playground →