DEV Community

Cover image for Kitesurf vs Chromium: Saving 98% on tokens for web agents
Andrey Altrouter
Andrey Altrouter

Posted on Originally published at altrouter.ai

Kitesurf vs Chromium: Saving 98% on tokens for web agents

Web agents are becoming a financial burden. The standard workflow using headless Chromium and Puppeteer involves feeding raw DOM to a model. This drives up API bills because modern SPA sites serve junk tags, ad scripts, and nested styles.

A new Wasm engine filters out the noise during processing. It turns page chaos into clean data before it reaches the model context window. This architecture changes the economics of scraping.

The hidden cost of parsing modern sites

The data extraction process is predictable. An agent requests HTML, and with metadata, the page weighs in at up to 182,000 tokens https://vc.ru/id3365744/2841019-kak-content-proksi-ekonomit-tokeny-dlya-ai-agentov. At $2.50 per 1 million input tokens for gpt-4o, a single page costs $0.45. When processing data from thousands of URLs, the price becomes unsustainable.

Using cleaned Markdown via Kitesurf reduces the data volume to 3,800 tokens. At the same gpt-4o rate, the request costs $0.0095. This is a 97.9% reduction, or roughly 48 times cheaper. The model avoids spending attention resources on decorative CSS classes and JavaScript libraries, which make up 95% of a page's volume.

If you calculate this against claude-sonnet-4-6 pricing, where an input token costs $3.00, the gap grows. One page of raw HTML reaches $0.546, while the cleaned result is $0.011. For high-load agents, this delta defines infrastructure profitability. Cleaning happens before the LLM call, so inference costs drop automatically.

Architecture: how Kitesurf saves resources

The Kitesurf project https://blog.cloudflare.com/kitesurf-open-source/ is written in Rust. It assembles a browser engine from modules optimized for machines rather than humans. The Blitz module handles the DOM, Stylo processes CSS, the Boa engine executes JavaScript, and Linebender renders graphics https://habr.com/ru/articles/1107996/.

A metal anchor on a scale balanced by a light paper boat

The engine runs in V8 isolates within Cloudflare Workers https://developers.cloudflare.com/browser-run/kitesurf/. Unlike classic Chromium, which requires Linux containers or virtual machines, Kitesurf runs as a collection of compiled WebAssembly modules.

The system isolates permissions at the component level: the Engine coordinator manages the flow, PageScript handles execution, PageRenderer manages rendering, and SandboxOutbound handles network calls https://www.unite.ai/cloudflare-open-sources-kitesurf-browser-engine-for-ai-agents/. This eliminates memory leaks common in browser sessions that clog RAM during long operations.

When extracting HTML, Kitesurf consumes 39.4 MiB of RAM, while Chromium uses 273.7 MiB https://note.com/ai_render/n/nbce2b0cc9d27. This means you can run 207 Kitesurf sessions on a server with 8 GB of RAM instead of 29 Chromium sessions. Agent density increases by 7 times. The same applies to CPU: parsing takes 229 ms compared to 877 ms for Chromium, providing a 3.8x performance gain per core.

Direct calls vs visual clicks

Screenshots and Computer Use are an antipattern for agent tasks. Analyzing PNGs via Vision models requires massive image processing costs and often fails when searching for small buttons. Kitesurf implements the WebMCP protocol https://developers.cloudflare.com/browser-run/features/webmcp/.

Via the document.modelContext object, the site provides a structure of functions. The agent calls a method instead of trying to land a cursor on screen pixels. This transforms site interaction from a guessing game into a standard function call.

Scissors cutting a tangled cable and turning it into a straight beam of light

Developers deliberately stripped away functionality useless to agents: tabs, extensions, visual themes, and 60 fps video rendering https://blog.cloudflare.com/kitesurf/. When taking a screenshot, Kitesurf requires 57.8 MiB of RAM against 271.0 MiB for Chromium https://note.com/ai_render/n/nbce2b0cc9d27. Saving resources allows scaling of scraping without a proportional increase in server infrastructure bills.

Scale vs load speed

There is a myth that a lightweight engine must be faster than a heavy one. In reality, Kitesurf loses in wall-clock time. Page rendering takes 1.51 seconds, while Chromium manages it in 1.21 seconds https://habr.com/ru/articles/1107996/. This is 25% slower.

Metric Kitesurf Chromium Advantage
RAM (HTML) 39.4 MiB 273.7 MiB 7x
CPU (HTML) 229 ms 877 ms 3.8x
RAM (Screenshot) 57.8 MiB 271.0 MiB 4.7x
CPU (Screenshot) 380 ms 1173 ms 3.1x

However, throughput matters more than single-page load time for agent tasks. The Workers Paid plan at $5 per month https://developers.cloudflare.com/changelog/post/2026-11-12-kitesurf-open-source/ provides 30 million ms of CPU time. At 229 ms per request, you can process 131,000 pages. This makes Kitesurf efficient for large-scale scraping where Chromium would hit server RAM limits.

Integration without pain

You do not need to rewrite your integrations. Kitesurf supports the Chrome DevTools Protocol https://kitesurf.dev/. You can use your existing Puppeteer setup by changing one line when connecting to the WebSocket.

const puppeteer = require('puppeteer-core');

async function runAgent() {
  // Use the endpoint to connect to Kitesurf
  const browser = await puppeteer.connect({
    browserWSEndpoint: 'wss://browser.cloudflare.com?browser=kitesurf'
  });

  const page = await browser.newPage();
  await page.goto('https://example.com');
  const content = await page.content();

  console.log(content.length);
  await browser.close();
}
runAgent();
Enter fullscreen mode Exit fullscreen mode

The engine passes 98.3% of tests in the Web Platform Tests suite https://kitesurf.dev/wpt, ensuring DOM parsing accuracy.

When Kitesurf becomes a burden

The engine is not a universal tool. It cannot bypass anti-bot protections https://developers.cloudflare.com/browser-run/kitesurf/. It lacks TLS fingerprint emulation and specific GPU profiles. Protected sites will identify Kitesurf and serve a block page.

Long-running sessions are also unsuitable. Kitesurf operates in stateless mode, and sessions are capped at 20 minutes even with keep_alive. If an agent needs to live in the browser for hours, you must return to Chromium. The engine does not reproduce video or WebGL, which limits its use for media content analysis.

Evaluate the risks before implementation. The Boa engine is in active development, so hydration errors may occur on specific SPAs. Managed Browser Run is currently free in beta, but rules may change after the GA release. Start with tests on public data where captcha bypass is not required to determine how many tokens you will save per month.

Top comments (0)