# Docs & llms.txt to Markdown + LLM RAG Chunks

**Use case:** 

Crawl public technical documentation sites using llms.txt indexes and same-origin links, strip nav/footer boilerplate, convert HTML into clean GitHub-Flavored Markdown with heading outlines, and output overlapping RAG chunks sized by characters or tokens at 256MB RAM. $0 start, $0.001/page.

## Input

```json
{
  "startUrls": [
    "https://modelcontextprotocol.io/llms.txt"
  ],
  "discoverLlmsTxt": true,
  "discoverSitemap": false,
  "crawlLinks": true,
  "samePathPrefixOnly": false,
  "includeUrlPatterns": [],
  "excludeUrlPatterns": [],
  "maxPages": 10,
  "maxDepth": 1,
  "mainContentOnly": true,
  "includeChunks": true,
  "chunkMaxChars": 1500,
  "chunkMaxTokens": 0,
  "chunkOverlapChars": 200,
  "maxMarkdownChars": 50000,
  "concurrency": 4,
  "requestTimeoutSecs": 12,
  "maxResponseSizeKb": 1024
}
```

## Output

```json
{
  "title": {
    "label": "Title",
    "format": "string"
  },
  "domain": {
    "label": "Domain",
    "format": "string"
  },
  "discoverySource": {
    "label": "Discovery Source",
    "format": "string"
  },
  "depth": {
    "label": "Depth",
    "format": "integer"
  },
  "contentFormat": {
    "label": "Format",
    "format": "string"
  },
  "wordCount": {
    "label": "Words",
    "format": "integer"
  },
  "estimatedTokens": {
    "label": "Est. Tokens",
    "format": "integer"
  },
  "chunkCount": {
    "label": "RAG Chunks",
    "format": "integer"
  },
  "headingsCount": {
    "label": "Headings",
    "format": "integer"
  },
  "url": {
    "label": "Page URL",
    "format": "string"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The Website to Markdown Crawler: Docs, Sitemaps & LLM RAG Actor is ready to run with the inputs already set for "Docs & llms.txt to Markdown + LLM RAG Chunks". [Sign up or log in](https://console.apify.com/create-task-from-example/wJpbdrma5zk9y82xk) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Docs & llms.txt to Markdown + LLM RAG Chunks" task

The Website to Markdown Crawler: Docs, Sitemaps & LLM RAG Actor will start running based on the input automatically. You can also change all the input fields, like start urls, discover llms.txt, and more, to match your specific use case.

### 3. Receive the "Docs & llms.txt to Markdown + LLM RAG Chunks" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as title, domain, discovery source, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Docs & llms.txt to Markdown + LLM RAG Chunks" task via API](https://apify.com/salmon_chaparral/website-markdown-rag-crawler.md).

## FAQ

### How does llms.txt discovery work for documentation sites?

Pass a direct /llms.txt URL or enable discoverLlmsTxt to auto-probe /llms.txt on each seed origin and enqueue its Markdown link index.

### Can I size RAG chunks by approximate tokens instead of characters?

Yes. Set chunkMaxTokens above 0 (up to 4000 tokens at ~4 chars/token) to override chunkMaxChars and emit heading-aware overlapping chunks.

### Are failed fetches, 404s, or SSRF-blocked URLs billed?

No. Pay-Per-Event charges $0.001 only per successfully crawled page pushed to the dataset, with $0 Actor start fee.

## About this Actor

This example demonstrates how to use [Website to Markdown Crawler: Docs, Sitemaps & LLM RAG](https://apify.com/salmon_chaparral/website-markdown-rag-crawler.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/salmon_chaparral/website-markdown-rag-crawler.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/salmon_chaparral/website-markdown-rag-crawler.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
