llms.txt
Serve content through your existing docs API and the default public aliases. It is enabled by default.
What is llms.txt?
llms.txt is a standard for making website content accessible to LLMs. Next.js withDocs() and
the generated TanStack Start, SvelteKit, Astro, and Nuxt forwarding layer serve conventional public
aliases that forward to the same docs handler:
/llms.txt— The default concise markdown listing of all pages with titles, URLs, and descriptions/llms-full.txt— The default full stripped content of every page, ready for LLM consumption/.well-known/llms.txt— Alias for/llms.txt/.well-known/llms-full.txt— Alias for/llms-full.txt
The shared API handler remains the source of truth:
/api/docs?format=llms— A concise markdown listing of all pages with titles, URLs, and descriptions/api/docs?format=llms-full— The full stripped content of every page, ready for LLM consumption
Quick Start
No config is required for the default routes. Add llmsTxt only when you want to customize the
public base URL, title, description, or explicitly opt out.
llmsTxt: {
baseUrl: "https://docs.example.com",
}That's it. The existing API handler serves the content automatically. Next.js adds rewrites with
withDocs(); TanStack Start, SvelteKit, Astro, and Nuxt add one public forwarder each so the public
aliases do not need one route file per URL.
Custom Static Files
You do not need a config flag to replace the generated files. If your app already ships a native static file at the same public route, that file wins and the generated route is only used as the fallback.
| Framework | Static file location |
|---|---|
| Next.js, Astro, Nuxt, TanStack Start | public/llms.txt, public/llms-full.txt |
| SvelteKit | static/llms.txt, static/llms-full.txt |
The same convention applies to /.well-known/llms.txt and /.well-known/llms-full.txt when you
publish those files in the framework's static directory. Keep llmsTxt configured only when you
want generated fallback metadata such as baseUrl, siteTitle, sections, or a size budget.
Configuration Reference
All options go inside the optional llmsTxt object in docs.config.ts:
export default defineDocs({
llmsTxt: {
// ... options
},
});llmsTxt.enabled
Enable or disable llms.txt generation.
| Type | Default |
|---|---|
boolean | true |
llmsTxt.baseUrl
Base URL prepended to all page links in the generated files.
| Type | Default |
|---|---|
string | "" |
llmsTxt: {
baseUrl: "https://docs.example.com",
}llmsTxt.siteTitle
Title shown at the top of the generated files. Falls back to nav.title if not set.
| Type | Default |
|---|---|
string | nav.title |
llmsTxt.siteDescription
Description shown below the title.
| Type | Default |
|---|---|
string | undefined |
llmsTxt.maxChars
Character budget for generated compact llms.txt files. The default warns when a root or section
file grows past 50,000 characters. llms-full.txt is intentionally not budgeted because it is the
full-content fallback.
| Type | Default |
|---|---|
{ mode?: "warn" | "error" | "off"; chars?: number } | { mode: "warn", chars: 50000 } |
llmsTxt: {
maxChars: {
mode: "warn",
chars: 50_000,
},
}llmsTxt.sections
Optional section-level llms.txt files for larger docs. Each matcher is a public URL pattern.
The framework derives both routes from match.
llmsTxt: {
sections: [
{
title: "API",
description: "Endpoint, SDK, and integration reference pages.",
match: "/docs/api/**",
maxChars: {
mode: "warn",
chars: 25_000,
},
},
{
title: "Guides",
description: "Task-based implementation walkthroughs.",
match: "/docs/guides/**",
},
],
}Derived routes:
/docs/api/llms.txt/docs/api/llms-full.txt/docs/guides/llms.txt/docs/guides/llms-full.txt
This docs site dogfoods the section feature with Guides, Customization, and Themes sections.
For example, the generated compact Guides section file is
/docs/guides/llms.txt, and the full-content sibling is
/docs/guides/llms-full.txt. Those routes are not UI pages; they are
machine-readable text responses served by the same docs API.
How It Works
The existing API handler serves the llms.txt content when you pass the format query parameter:
GET /api/docs?format=llms— concise page listingGET /api/docs?format=llms-full— full page content
Next.js withDocs() and the generated TanStack Start, SvelteKit, Astro, and Nuxt forwarding layer
also expose the crawler-friendly public aliases:
GET /llms.txt— default concise routeGET /llms-full.txt— default full-content routeGET /.well-known/llms.txtGET /.well-known/llms-full.txtGET /.well-known/agent.jsonfor the preferred agent discovery spec that references thosellms.txtroutes, theAGENTS.mdroutes, therobots.txtroute, and the sitemap routes when enabledGET /.well-known/agentas the fallback agent discovery alias
Those aliases rewrite to the same shared API output, so there is still only one content pipeline.
The agent discovery spec also advertises defaultTxt: "/llms.txt" and
defaultFull: "/llms-full.txt" so integrations can use the intended defaults without adding their
own framework-specific routes. TanStack Start, SvelteKit, Astro, and Nuxt can use the shared API
query routes directly when they do not want to add the public aliases.
The compact llms.txt listing links to each page's markdown route by default, for example
/docs/installation.md instead of /docs/installation. That gives agents a direct path to the
machine-readable page and keeps the root index aligned with AFDocs-style checks. llms-full.txt
still includes the canonical page URL in its URL: line because the content is already embedded in
that file.
If apiReference is enabled, root llms.txt also includes an API Schemas section that links to
/api/docs?format=openapi. Agents can fetch the schema before reading rendered endpoint docs.
When llmsTxt.sections is configured, root /llms.txt lists those section files first and only
keeps unmatched pages in the root page list. Each section route serves the matching pages, and its
llms-full.txt sibling serves the full matching content. No UI is added; this only changes the
machine-readable route layer.
When you also want crawlers and AI agents to see an explicit access policy, publish
/robots.txt with docs robots generate. The generated policy allows the public llms.txt
aliases along with docs, markdown, sitemap, skill, MCP, and agent discovery routes.
Output Example
/api/docs?format=llms
# My Documentation
> A modern docs framework
## API Schemas
- [OpenAPI schema](https://docs.example.com/api/docs?format=openapi): Machine-readable API schema for tool use and API clients; rendered API reference at https://docs.example.com/api-reference
## Pages
- [Introduction](https://docs.example.com/docs.md): Getting started guide
- [Installation](https://docs.example.com/docs/installation.md): How to install
- [Configuration](https://docs.example.com/docs/configuration.md): Config reference/api/docs?format=llms-full
# My Documentation
> A modern docs framework
## Introduction
URL: https://docs.example.com/docs
Getting started guide
Full page content here...
---
## Installation
URL: https://docs.example.com/docs/installation
How to install
Full page content here...Footer Links
Because llms.txt is enabled by default, llms.txt and llms-full.txt links automatically appear in the page footer next to "Edit on GitHub", pointing to the public /llms.txt and /llms-full.txt routes.
Full Example
export default defineDocs({
entry: "docs",
llmsTxt: {
baseUrl: "https://docs.example.com",
siteTitle: "My Project Docs",
siteDescription: "Comprehensive documentation for My Project",
},
});How is this guide?