URL to Markdown API for LLMs, plus scanned PDFs and images
AIVAX Fetch turns a URL into Markdown and reads scanned PDFs and images with OCR, with per-item errors, processing-unit costs and optional JSON by schema. Measured results included.
I sent one request to AIVAX Fetch for the English Wikipedia article on Markdown. It came back in about a second with 66,821 characters of Markdown (headings, nested lists, links and a pipe table) and a charge of 5 processing units. The article is in there, along with the site navigation, a list of other-language editions and the footer: 590 links in all. That shape matters for an LLM pipeline, so I ran the rest of the endpoint's inputs as well: a page built by JavaScript, a scanned PDF, a photographed receipt and several broken URLs.
POST https://inference.aivax.net/api/v1/web/fetch takes a list of public URLs or base64 data URIs. For each item it returns the extracted text, the processing units charged, an error message if that item failed, and optionally a JSON object shaped by a schema you send. The same call reads a web page into Markdown, a scanned PDF or an image through OCR, and Office documents, spreadsheets and e-books. I would pick it over a service that only converts URLs because a pipeline rarely stays URL-only for long.
Trim navigation and footer from the Markdown before chunking
A request needs a contents array and an API key:
curl -s https://inference.aivax.net/api/v1/web/fetch \
-H "Authorization: Bearer $AIVAX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contents":["https://en.wikipedia.org/wiki/Markdown"]}'
The body is {"data":{"results":[...]}}, one result per input, each with index, extractedText, extractedObject, processingUnits, jsonProcessingUnits and error. The Fetch and OCR page has the full contract.
Markdown syntax survives intact. quotes.toscrape.com came back with its title as a level-one heading and 55 working links to authors and tags, and the Wikipedia article returned 20 headings and about 250 list lines. Fetch keeps the whole page, so the article title, the first level-one heading, appears 4,196 characters into the text, after the sidebar menus, and the footer closes it. I cut everything before the first heading and after the last content section before chunking, whichever reader produced the text. Readers differ in how much they trim: Jina Reader returned 47,160 characters and 399 links for the same page. What Fetch adds is that the same call also reads scanned PDFs and images, and reports a result or an error for every item in the list.
Send the URL when the page is built by JavaScript
https://quotes.toscrape.com/js/ writes every quote with a script. Fetch returned all ten quotes in 1.3 seconds for 7 processing units, the same count as the static version of the site. The tag links on the rendered page arrive without their targets, so take links from a static version of the page when you need them. A page that needs a login, a click or an infinite scroll to show its content still comes back without that content.
HTML you pass inline as a data URI takes another path. The markup is parsed as written and scripts never run: I sent a small page whose script appends a paragraph, and the paragraph was absent from the output. That path also formats differently. Lists and tables came out as Markdown, but headings were marked with plus signs (+++ Title) and a link appeared as link [1]. For the Markdown described above, send the URL.
Scanned PDFs and images return the printed lines
To test OCR I built a one-page invoice as an image-only PDF with ImageMagick, with no text layer, slightly rotated and with noise, plus the same image as a PNG, and sent both as data URIs. Both returned the same seven lines with every figure correct. The PDF cost 25 processing units and took about 1.5 seconds; the PNG cost 16 and took the same. The text arrives as lines without Markdown structure, and a line item like Hammer 16oz 2 x 14.50 29.00 lost its column spacing, so a scanned table is rebuilt from lines. My invoice is clean printed type, so test your own faint scans and dense tables before relying on the output.
A digital PDF returns structure. The 24-page Technology Acceptance Model review in the pdf.js test files came back as 56,121 characters with four headings and a table in 9.2 seconds, charged 1,292 processing units. The docs say that scanned pages, images and images embedded in a page go through OCR and drive the total, which fits a paper with 52 embedded images.
Beyond web pages, PDFs and the image formats (PNG, JPEG, WebP, TIFF, BMP), Fetch reads DOC, DOCX, ODT, RTF, PPT, PPTX, ODP, XLSX, ODS, CSV, EPUB, TXT and Markdown. The limit is 50 MB per item, and for a data URI it applies to the decoded bytes.
Make every JSON field nullable and check totals
Add responseSchema when downstream code needs fields. One schema applies to every item in the request, and a successful result keeps extractedText next to extractedObject. The optional instructions key inside the schema is an AIVAX extension for guidance such as "use null for missing values." This script, saved as extract-receipt.mjs and run with Bun, an AIVAX_API_KEY variable and a public image URL, prints the whole result:
const source = process.argv[2];
const apiKey = process.env.AIVAX_API_KEY;
if (!source || !apiKey) {
throw new Error("Set AIVAX_API_KEY and run: bun extract-receipt.mjs <public-receipt-url>");
}
const response = await fetch(
"https://inference.aivax.net/api/v1/web/fetch",
{
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
contents: [source],
returnErrors: true,
responseSchema: {
type: "object",
instructions: "Extract only information printed on the receipt. Use null for missing values.",
properties: {
merchant: { type: ["string", "null"] },
total: { type: ["number", "null"] },
date: { type: ["string", "null"] },
},
required: ["merchant", "total", "date"],
},
}),
},
);
if (!response.ok) {
throw new Error(`Fetch request failed: HTTP ${response.status}`);
}
const item = (await response.json()).data.results[0];
if (item.error) {
throw new Error(`Item ${item.index} failed: ${item.error}`);
}
console.log(JSON.stringify(item, null, 2));
I ran it against the receipt photo ReceiptSwiss.jpg on Wikimedia Commons. OCR cost 54 processing units and the JSON step 95. The merchant came out right, but total was null even though the extracted text contains the line Total : CHF 54.50. The JSON is generated from the text, so a miss like that is a model miss. When I pointed a vendor, date and total schema at a "Not Found" page, it returned a vendor name that appears nowhere on the page. I make every field nullable, treat null as unknown, and compare totals against the line items before writing anywhere. For a workflow built around fields, turning PDFs and images into JSON with one API call uses the dedicated extraction endpoint.
Read each item's error and check for Not Found pages before extracting
The HTTP status is 200 even when items fail, so read each item's error and match it by index. An invalid URL or a localhost address returns "The provided URL is not valid or not safe." An unresolvable host returns the DNS message, malformed base64 returns "Data URI contains invalid base64 content," and a missing PDF returns "does not indicate an success status code (Not Found)." Each of those reports 0 units, so a failed item costs nothing and you can retry only the failed sources. With returnErrors: false, failed items are left out of the array and index is the only way to tell which one is missing.
One message needs a note. Four bytes of base64 sent as a PDF came back as "The Document OCR service is temporarily unavailable." The file was not a valid PDF and the OCR service rejected it; the API uses this wording for that rejection while the service is up, and retrying the same bytes fails the same way.
An HTML page that returns 404 comes back as a success. https://quotes.toscrape.com/nope-404 returned the text # Not Found and a charge of 5 units, because the HTML path does not check the status code, while a missing PDF is an error. Login walls and access-denied pages behave the same way, and Fetch does not bypass either. I check titles for "Not Found" and "Access denied" before any schema step.
Billing follows processing units per item, and a request is one daily action
Plain text and Markdown files cost no units. HTML pages are metered at 10 units per second of rendering, rounded up, and documents and images report their own. What I measured: 2 for a small inline HTML page, 5 for the Wikipedia article, 7 for the script-built page, 16 for the PNG invoice, 25 for the one-page scanned PDF, 54 for the receipt photo and 1,292 for the 24-page paper.
An extraction that the plan's daily allowance does not cover is billed in full at $0.15 per 1,000 units on Free, $0.05 on Pro, $0.03 on Max and $0.02 on Ultimate; coverage is not split within one extraction. The allowances are 8×, 25× and 50× Free's. The 24-page paper would cost about $0.19 on Free and $0.065 on Pro if uncovered, and the scanned invoice page under half a cent on Free. jsonProcessingUnits is a separate counter with a variable, inference-based price and no daily allowance, so each counter is priced on its own. Pricing and Plans and limits hold the current figures.
Each request counts as one general service action against a daily quota of 30 on Free, 2,500 on Pro, 30,000 on Max and 100,000 on Ultimate, and going over returns a 429. A list of 50 URLs uses one action, so send URLs in batches. The items are read one after another, which means a long list takes about as long as its parts add up to.
Search finds sources and Fetch reads them
Finding URLs is a separate step: search discovers sources and Fetch reads them. When the model should decide which URL to open during AIVAX inference, enable the OpenUrl built-in tool, whose function is open_url. For RAG, the text from a PDF goes to chunking next, as in PDF to Markdown for RAG: extract, chunk, and import JSONL. Treat fetched text as untrusted, since a page can carry instructions written for your model.
Ran against the live AIVAX API on November 12, 2026, with the pages, PDFs and receipt described above. Prices, limits, request fields and error messages were checked against the docs and the implementation the same day.