Disclosure: I’m publishing on behalf of Oddbench, which makes the GimmePage API used below.
A docs collector hits two kinds of pages. On some, the first HTML response already contains the article. On others, it contains navigation and an empty element that JavaScript fills in. Running a browser for every URL can work, but it pays the rendering cost even for ordinary static pages.
I use a content check to choose. The example below expects a known section heading from a public documentation page. If the first response has a successful origin status and is missing that heading, it asks for one rendered copy. If the origin returned a 404, or the API request failed, the job surfaces that error. Rendering is reserved for a page the fetch succeeded in retrieving but whose content is incomplete.
Test for the content you came for
The check should come from the job. A minimum length can work for a fixed template, but a long navigation menu or an error banner can satisfy it. A known heading, a documentation section ID, or a marker in a page you control is more specific. Avoid using a marker that also appears in global navigation.
Here’s a Node.js example with a single rendering fallback. It uses GimmePage’s plain response mode and reads the origin status and charged credits from response headers. Set the API key as an environment variable and use a URL and heading from a public page you expect to collect.
function hasHeading(markdown, heading) { return markdown.split(/\r?\n/).some((line) => { const match = line.match(/^#{1,6}\s+(.+?)\s*$/); return match?.[1] === heading; }); } async function fetchPage(url, render, apiKey, request = fetch) { const endpoint = new URL("https://gimmepage.com/v1/fetch"); endpoint.search = new URLSearchParams({ url, output: "markdown", render: String(render), }); const response = await request(endpoint, { headers: { Authorization: `Bearer ${apiKey}` }, signal: AbortSignal.timeout(90_000), }); if (!response.ok) { throw new Error(`Fetch API returned HTTP ${response.status}`); } const siteStatus = Number(response.headers.get("Gimmepage-Site-Status")); if (siteStatus < 200 || siteStatus >= 300) { throw new Error(`Unexpected source HTTP status: ${siteStatus || "missing"}`); } return { markdown: await response.text(), credits: Number(response.headers.get("Gimmepage-Cost") ?? 0), render, }; } async function collectPage(url, heading, apiKey, request = fetch) { const first = await fetchPage(url, false, apiKey, request); if (hasHeading(first.markdown, heading)) return first; const rendered = await fetchPage(url, true, apiKey, request); if (!hasHeading(rendered.markdown, heading)) { throw new Error("Expected heading missing after rendering"); } return { ...rendered, credits: first.credits + rendered.credits }; } For example, call collectPage("https://example.com/", "Example Domain", process.env.GIMMEPAGE_API_KEY). The final object reports whether rendering was used and how many credits the successful path consumed. If the job throws, record charges per attempt in your request metrics. A successful fetch can cost credits even when its content fails your application’s check.
Measure how often you fall back
At the standard rate, a successful fetch without rendering costs one credit. A successful rendered fetch costs five. A job that gets two successful responses therefore costs six credits. If 10% of pages need both attempts, the average is 1.5 credits per page. For a known client-rendered template, it can make sense to render upfront and save the first request. The break-even point is an 80% fallback rate under these assumptions.
I’d track fallback rate and cost by source hostname or template. If a batch starts rendering most pages from one source, check whether the template changed or the marker drifted before changing the default.
See the Markdown output guide for what the converter preserves and the pricing table for current request costs.

