Summarize a PDF
POST /api/pdf-summarizeFetch 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.
Input
| Field | Type | Description |
|---|---|---|
url * | string | Public http(s) URL of a PDF |
maxWords | number | Target 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
}),
});
Related tools
Extract article
POST /api/extractExtract the main article content from any public URL as clean markdown. Returns title, byline, excerpt, word count, and …
try in playground →Page metadata
GET /api/metaFetch page metadata for a URL: title, description, OpenGraph, Twitter cards, canonical URL, favicon.
try in playground →Browser render
POST /api/renderRender a page in a real headless Chromium browser (JavaScript executed), then extract the main content as clean markdown…
try in playground →