Serving Markdown Content Directly to AI Agents via Accept Headers

Using HTTP Accept headers to serve Markdown content directly to AI Agents via content negotiation.
A proposal gaining traction on Hacker News suggests using HTTP's built-in Accept header content negotiation to serve Markdown instead of HTML to AI Agents. This approach reduces token consumption, improves information extraction, and reuses existing HTTP standards. The article compares it with llms.txt, discusses implementation details including Vary headers for caching, and examines community concerns around crawler adoption, content sync costs, and standards fragmentation.
Web Pages Now Serve Two Types of Readers
Since the birth of the internet, web content has primarily served human readers—delivering rich visual experiences through browser-rendered HTML, CSS, and JavaScript. But with the explosive growth of AI Agents, large language model crawlers, and automation tools, a new reality has emerged: a significant portion of your website's visitors may now be machines, not humans.
These AI Agents don't care about your CSS animations, navigation layouts, or ad placements. What they need is clean, structured text content. Traditional HTML pages are full of noise for them—tags, scripts, and style code that require additional parsing to extract genuinely valuable information.
A technical proposal recently discussed on Hacker News offers an elegant solution: use HTTP Accept headers (Content Negotiation) to serve Markdown-formatted content directly to AI Agents. The post received 81 upvotes and 44 comments, reflecting strong developer community interest in this topic.

Core Idea: Dual-Format Serving via Content Negotiation
What Are Accept Headers
The Accept request header in HTTP is a long-standing standard mechanism that allows clients to tell the server what content format they expect to receive. For example, browsers typically send Accept: text/html, indicating they want an HTML page. This mechanism is known as Content Negotiation.
The technical foundation of content negotiation comes from RFC 7231 and is a core component of the HTTP/1.1 protocol. It supports multiple negotiation approaches: Server-Driven Negotiation, where the server autonomously decides the response format based on preference information in request headers; and Agent-Driven Negotiation, where the client selects from multiple representations offered by the server. Beyond the Accept header, HTTP also defines Accept-Language (language preference), Accept-Encoding (compression preference), Accept-Charset (character set preference), and other similar mechanisms, forming a complete content adaptation system. This design deeply embodies the core principle of REST architecture—a single Resource can have multiple Representations, and the client and server coordinate the optimal content form through standardized metadata exchange.
The core logic of this proposal is simple: when a request includes Accept: text/markdown, the server returns the Markdown version of the content; when it receives the standard Accept: text/html, it returns the full HTML page. Same URL, different representations based on who's asking and what they need.
Why Markdown Is the Ideal Format for AI Agents
Markdown has become the ideal content format for AI Agents for several reasons:
- High signal-to-noise ratio: Strips away redundant HTML tags, preserving only content and basic structure
- Preserves semantic structure: Headings, lists, links, code blocks, and other structural information remain intact, helping models understand document hierarchy
- Token efficiency: For LLMs that charge by token, Markdown saves significant tokens compared to HTML, directly reducing inference costs
- Model-friendly: Major LLMs have been extensively exposed to Markdown during training, giving them a natural understanding of the format
At the token economics level, this format choice becomes even more significant. During inference, LLMs first split input text into token sequences using a tokenizer. Taking GPT-4's tokenizer as an example, an average English word consumes 1-2 tokens, while an HTML tag like <div class="container"> might consume 5-8 tokens without carrying any semantic information. Real-world testing shows that the full HTML version of an article typically consumes 40%-70% more tokens than its Markdown equivalent. Given that models like GPT-4 charge per token via API (approximately $30-60 per million input tokens), format optimization delivers substantial cost savings at scale for content crawling and analysis scenarios. This also explains why AI-focused web scraping tools like Jina Reader and Firecrawl have built-in HTML-to-Markdown conversion—they're essentially performing on the client side what the server could provide directly.
By contrast, having AI parse raw HTML not only wastes compute but also increases the risk of information extraction errors due to mixed style and script code.
Technical Implementation and Ecosystem Context
Comparison with the llms.txt Approach
This idea didn't emerge in isolation—it's part of the broader "optimize websites for AI" wave. The industry has already seen the llms.txt proposal—similar to robots.txt, websites place a dedicated Markdown file in their root directory, listing key content and links specifically prepared for LLMs.
llms.txt was formally proposed in 2024 by Jeremy Howard (founder of fast.ai and a prominent figure in deep learning education). Its design philosophy draws directly from robots.txt and sitemap.xml—using a conventional file path to enable standardized communication between websites and automated systems. Specifically, websites place a Markdown-formatted file at /.well-known/llms.txt that describes the site's core content summary, important page links, API documentation entry points, and content usage terms in a structured manner. Unlike robots.txt, which focuses on controlling crawler behavior ("what not to crawl"), llms.txt aims to proactively guide AI systems to efficiently access the most valuable information ("this is worth reading"). Companies including Cloudflare, Anthropic, and Stripe have already deployed llms.txt files on their websites. The proposal has also spawned variants like llms-full.txt (a complete Markdown export of site content).
Unlike llms.txt, which requires maintaining a separate file, the Accept header approach is more "native": it doesn't change URL structure but lets the same resource address dynamically adapt its format based on the requester. This means AI Agents don't need to know special file path conventions—they simply declare their content preference in a standard HTTP request.
Key Steps for Server-Side Implementation
In practice, this approach typically requires processing at the server or CDN layer:
1. Check the Accept field in the request headers
2. If it matches text/markdown, return pre-generated or dynamically converted Markdown
3. Otherwise, return standard HTML
4. Use the Vary: Accept header to tell caching systems to differentiate cache by format
Notably, the Vary: Accept response header is critical—it ensures CDNs and browser caches don't accidentally return the Markdown version to human users expecting HTML, or vice versa.
The Vary response header is a crucial but often overlooked mechanism in HTTP caching. Its purpose is to inform all intermediate cache nodes (including CDN edge servers, reverse proxies, and browser local caches) that for the same URL, response content will vary based on specific request header values, and therefore separate cache copies must be maintained for different header combinations. In this scenario, Vary: Accept means that responses for Accept: text/html and Accept: text/markdown requests must be cached independently without interference. If the server omits the Vary header, CDNs like Cloudflare or Fastly might incorrectly serve a cached Markdown response to subsequent browser requests, causing users to see raw Markdown text instead of a rendered page. This is why implementing content negotiation at the CDN level requires careful configuration—some CDNs don't even support Accept header-based cache variants by default and require explicit feature enablement.
Community Debate: The Gap Between Ideal and Reality
Among the 44 comments on Hacker News, developers raised several thought-provoking concerns that highlight the real-world challenges this approach faces in practice.
Will AI Crawlers Actually Send the Correct Accept Header?
The most fundamental challenge: most AI crawlers and agents don't actually send Accept: text/markdown. They typically use generic User-Agents and default Accept headers, disguising themselves as regular browsers, or simply grab raw HTML and clean it themselves. Unless a widely adopted industry standard emerges, the carefully prepared Markdown on the server side may go unasked for.
The current AI crawler ecosystem validates this concern. Major AI company crawlers include GPTBot (OpenAI), ClaudeBot (Anthropic), Google-Extended (Google DeepMind), and Bytespider (ByteDance), which typically identify themselves through User-Agent strings. However, extensive independent research and monitoring data shows that a significant portion of AI training data crawling doesn't respect robots.txt protocols or use standardized, identifiable request headers. A 2024 DoubleVerify report showed that AI crawler traffic already accounts for over 30% of total traffic on some content sites, yet many of these requests don't properly identify their source. This means the Accept header approach faces a classic "chicken-and-egg" problem: websites prepare Markdown responses, but AI Agents don't know to request them; AI Agents have no incentive to send special Accept headers because most websites don't support this negotiation. Breaking this bilateral dependency requires some form of industry coordination or standards push.
The Cost of Keeping Dual Content in Sync
Other developers worry about content consistency. If Markdown and HTML are generated separately, there's a risk of them falling out of sync. The ideal approach is to automatically derive both formats from the same content source, but this isn't out-of-the-box for many existing CMS platforms and static site generators.
From a content architecture perspective, separating content from presentation has been the long-term direction of web technology evolution, and modern Headless CMS platforms provide a natural infrastructure for solving this problem. From early CSS separating visual styles from HTML structure, to Headless CMS platforms (like Strapi, Contentful, Sanity) fully decoupling content management from frontend presentation, to now providing dedicated plain-text formats for AI—this technical evolution follows a consistent thread. Modern Headless CMS platforms typically store content as structured data (JSON objects or rich text abstract syntax trees), with frontend applications fetching raw content via API and rendering it into HTML themselves. This architecture naturally supports multi-format output—the same content source can simultaneously generate HTML pages, Markdown documents, RSS feeds, AMP pages, and more, fundamentally eliminating the burden of manually maintaining dual content in sync. For sites still using traditional CMS platforms like WordPress, HTML-to-Markdown conversion libraries can generate Markdown dynamically at request time. While this adds server-side computation overhead, it avoids content inconsistency issues.
MIME Types and Standards Debates
Discussions also pointed out that whether to use text/markdown or a custom MIME type, and whether to coordinate with approaches like llms.txt, remains unresolved. Before standards are unified, each party going its own way may lead to ecosystem fragmentation.
A Deeper Reflection: The Web Is Forking
Beyond the specific technical details, this discussion reflects a grander trend: the consumers of internet content are shifting from "primarily human" to "human-machine coexistence".
Over the past two decades, frontend engineering has continually doubled down on human visual experience—increasingly complex single-page applications, increasingly heavy JavaScript frameworks. Now we must reconsider: when the visitor is AI, all that complexity becomes a burden.
Serving Markdown to AI is essentially opening a "fast lane" for machine readers. This isn't merely a format conversion technical issue—it's a shift in content architecture philosophy: the complete separation of content and presentation, allowing the same knowledge to be accessed in the form best suited to different consumers.
As AI Agents become a significant component of website traffic, similar content negotiation mechanisms and machine-oriented content format standards will become an inescapable new dimension of web development. Whether the winning approach turns out to be Accept headers, llms.txt, or some other standard, optimizing content for machine readers is now inevitable.
Conclusion
"Serving Markdown to AI Agents via Accept headers" is a technically elegant and conceptually forward-looking proposal. It reuses the mature content negotiation mechanism built into HTTP, avoids introducing entirely new specifications, and addresses a real pain point in AI-era content distribution.
Despite practical obstacles in crawler compatibility, content synchronization, and standards unification, the direction it points toward—making the Web gracefully serve both humans and machines—is undoubtedly a technology trend worth watching in the coming years. For developers of content-driven websites, now is the time to start thinking about how to build "AI-friendly" content architectures.
Related articles

Transitioning to AI Agent Development: A Complete Three-Stage Learning Path for Programmers
Why do programmers keep failing at AI Agent development? This guide breaks down a 3-stage learning path: ReAct & Tool Calling fundamentals, LangChain engineering, and production-grade project delivery.

Getting Started with Agent Skills: A Complete Guide from Prompts to Intelligent Skills
Deep dive into AI Agent Skills' four components (skill.md, references, scripts, assets), explaining how Skills differ from prompts and how to build reusable intelligent skill systems.

Codex Beginner's Guide: Installation, Configuration & Connecting Chinese LLM APIs
Complete guide to installing OpenAI Codex, how it differs from Claude Code, and how to connect Chinese LLMs like DeepSeek via API keys with full setup steps and limitations.