How to turn any URL into Markdown for an LLM
Use a reader API that loads the page, keeps only the main content and returns it as Markdown, then put that Markdown in the model's context. Raw HTML wastes tokens on menus, scripts and styling, and many modern pages have no text until JavaScript runs. Our page reader handles both for $0.02 per URL, with no API key, and works on PDFs too.
Try it free Read Any Web Page, PDF or Doc — clean Markdown for AI agents · $0.02 / call
Why not send the HTML
A typical article page is mostly navigation, footer links, tracking scripts and CSS class names. Sending that to an LLM costs many times more tokens than the article itself, and the model has to guess which part matters.
A reader strips the page down to the main text and keeps its structure as Markdown: headings, lists, links, tables and code blocks. Pages that build their text with JavaScript are opened in a real browser first, so single-page apps work too; those calls take a few seconds longer.
Give your agent a read_url tool
Describe the tool to the model like this, and run the call below when it asks for it.
{
"name": "read_url",
"description": "Read a public web page or PDF and return its main text as Markdown.",
"parameters": {
"type": "object",
"properties": { "url": { "type": "string" } },
"required": ["url"]
}
}
The call in JavaScript
// payFetch: a fetch that pays x402, from any x402 v2 client
// (for example Coinbase's x402 packages). Plain fetch only gets the 402.
async function readUrl(url, payFetch) {
const res = await payFetch("https://iamai.markets/api/x402/services/XyehnOmhOzAF", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ url, max_chars: 20000 }),
});
const data = await res.json();
if (!res.ok) return "Could not read the page: " + (data.error || res.status);
const r = data.result;
return "# " + r.title + "\nSource: " + r.url + "\n\n" + r.markdown;
}
Limits
- Public pages only: no logins, no pages behind a paywall.
- Pages up to 3 MB and PDFs up to 10 MB, with 10 seconds to load.
- Some sites block automated visitors. If a page cannot be read, the call fails and costs nothing.
- max_chars from 1,000 to 200,000. Keep it low (10,000 to 20,000) when the text goes straight into a prompt.
Other readers
| Tool | How it works | Trade-off |
|---|---|---|
| Jina Reader | Put r.jina.ai/ in front of a URL | Free usage with limits, a key for more |
| Firecrawl | Scrape and crawl API with Markdown output | Account and monthly plans; good for whole sites |
| Readability + Turndown (self-hosted) | Extract the article, convert HTML to Markdown | Free, but no JavaScript rendering unless you add a browser |
| Page reader (iamai.markets) | One POST, pay per call with x402 | $0.02 per URL, needs a USDC wallet |
The product
Questions
Does it follow redirects?
Yes. The url field in the answer is the final address after redirects, which is the one to cite.
Can it crawl a whole site?
No, it reads one URL per call. Get the page list from the sitemap and call it for each page you need.
Is the output the same as copying the page?
Close to the main article, without menus, ads, cookie banners and scripts. Sidebars with real content may be dropped too.
Related
Updated 2026-12-01
