SShortSingh.
Back to feed

How serving markdown to AI agents can cut your site's token costs by two-thirds

0
·1 views

When an AI agent visits a webpage to complete a task, it consumes tokens to process the page's content, and heavy HTML loaded with navigation, scripts, and styling inflates that cost significantly. Publishers can reduce this burden through content negotiation, a technique that serves standard HTML to browsers while delivering stripped-down markdown to agents requesting it. On turva.dev, the markdown version of the homepage costs roughly one-third the tokens of its HTML equivalent, and an llms.txt file lets agents map the entire site in a single request. Lighter pages improve accuracy because agents read the full content rather than hitting budget limits midway, reducing the risk of misquoted prices or incorrect terms. The implementation requires only a small piece of edge code that selects the response format based on the request header, leaving the existing site structure unchanged.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Docker Storage Explained: Volumes, Bind Mounts, and tmpfs Compared

Docker containers use a writable layer that is permanently deleted when the container is removed, making external storage essential for data persistence. Docker offers three storage options: named volumes, bind mounts, and tmpfs, each suited to different use cases. Named volumes are managed entirely by Docker, stored under its own directory, and are the recommended choice for databases and persistent application state. Bind mounts link a container directly to a host directory, making them ideal for local development and configuration files, but they reduce portability across machines. Tmpfs mounts store data in RAM only, leaving no trace on disk once the container stops, making them suitable for sensitive or temporary data.

0
ProgrammingDEV Community ·

What Is an API? A Beginner-Friendly Breakdown of How Apps Communicate

An API, or Application Programming Interface, is a software messenger that enables two different computer programs to exchange data over the internet. Much like a waiter relays orders between a restaurant customer and the kitchen, an API carries requests from an app to a server and returns the appropriate response. Everyday examples include social login buttons powered by Google or Facebook, weather apps fetching live data, and e-commerce sites processing payments through services like Stripe or PayPal. Developers and companies rely on APIs because they eliminate the need to build complex systems from scratch, saving significant time and resources. Essentially, APIs function as the invisible connective layer that makes the modern, interconnected internet possible.

0
ProgrammingDEV Community ·

Developer Debugs Broken Image Download Feature in Late-Night Coding Session

A developer encountered a critical bug while working on Vlox, a personal social media app, late at night when a 'Download Card' button began generating empty 0-byte images. Three separate fixes were attempted, including swapping image libraries and adjusting element visibility, but each approach failed for different technical reasons. The root cause was traced to a SweetAlert (Swal) popup that destroyed the relevant DOM elements as soon as it appeared. The issue was ultimately resolved by appending the card preview element directly into the new alert container instead of the original popup. The developer shared the debugging journey on DEV Community and pointed readers to the Vlox GitHub repository for the working code solution.

0
ProgrammingDEV Community ·

Developer Argues AI Chat Cannot Replace Real Human Debate and Collaboration

A software developer has shared a personal reflection on how AI tools, while boosting efficiency, have quietly replaced meaningful peer discussion in their daily workflow. The author notes that AI assistants act as 'yes-men,' lacking the genuine conviction and friction that arise in real debates with colleagues. They argue that developer communities tend toward superficial exchanges, as comment-based formats introduce latency that kills the natural energy of dialogue. The developer proposes 'virtual tables' — real-time, low-barrier spaces where engineers can debate architecture and technical choices conversationally. They identify trust and fear of idea theft as the main obstacles to such collaboration, calling on peers to embrace open, challenge-driven discussion over AI convenience.

How serving markdown to AI agents can cut your site's token costs by two-thirds · ShortSingh