# llms.txt Generator: crawl a site, write llms.txt and full text (`examsens.ai/llms-txt-generator`) Actor

Crawls each site up to a page limit, respecting robots.txt, and writes an llms.txt file in the format of the llms.txt proposal, with an optional llms-full.txt holding the main text of every page as Markdown.

- **URL**: https://apify.com/examsens.ai/llms-txt-generator.md
- **Developed by:** [Ed Rayyis](https://apify.com/examsens.ai) (community)
- **Categories:** AI, SEO tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 page processeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

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 examples already wired to this Actor's own input schema, see the [API](#api) section below.

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`).

# README

## llms.txt Generator: crawl a site, write llms.txt and full text

Give it one or more sites. It crawls each one up to the page limit you set and writes an `llms.txt` file in the format of the llms.txt proposal \[1], ready to place at the root of the site. On request it also writes `llms-full.txt` with the main text of every listed page as Markdown.

### The file it writes

The layout follows the proposal \[1]:

- An H1 with the site name. The only required part.
- A blockquote with a short summary of the site.
- H2 sections, each a Markdown list of links in the form `[title](url): description`.
- An `Optional` section last, for links an agent can skip when it needs a shorter context.

The site name comes from the home page's `og:site_name`, or the first part of its title. The summary is the home page's meta description. You can set both yourself. Page titles drop the site suffix repeated on every page (`Download Python | Python.org` becomes `Download Python`). Each description is the page's meta description, or its first paragraph when the meta description is missing or the same on many pages. Pages are grouped by the first part of their path: two or more pages under `/docs/` make a Docs section, and single pages go under Pages. Pages matching your Optional patterns go in the Optional section.

`llms-full.txt` is an extra file, not part of the proposal. It starts with the same H1 and summary, then gives each page as an H2 with its source URL and its main text, with menus, headers and footers left out. Headings inside a page move down two levels so the page titles stay the top level.

### How it crawls

- Reads `robots.txt` first and skips every page it disallows. It waits at least a quarter second between requests to the same site.
- Takes pages from the site's XML sitemaps first (those named in `robots.txt`, or `/sitemap.xml`), then follows links on the pages it reads.
- Stays on the start URL's host, skips links to files such as PDF, images and archives, and skips pages marked `noindex`.
- Include, exclude and Optional patterns are regular expressions matched against the page URL.

### Input

- Sites (required): one start URL per site
- Maximum pages per site (default 50)
- Use the sitemap (default on)
- Also write llms-full.txt (default off)
- Only include URLs matching, Exclude URLs matching, Put in the Optional section (regular expressions)
- Site name and summary (optional overrides)
- Timeout per request (default 20 seconds)

### Output

Key value store: `llms-<host>.txt` and, when asked, `llms-full-<host>.txt`, as UTF-8 text.

Dataset: one item per site with `startUrl`, `ok`, `pageCount`, `sections` (pages per section), `llmsTxtUrl`, `llmsFullTxtUrl`, `llmsFullTxtCharacters`, `llmsTxt` (the file's text), `pages` (each with `url`, `title`, `description` and `llmsSection`), `skipped` (pages left out by robots.txt, noindex, your filters, or because they were not HTML or failed) and `fetchErrors`.

A site whose start page cannot be loaded gets `ok: false` and an `error`, and the rest of the run carries on. Export as JSON, CSV or Excel, or read it over the API.

### Pricing

Pay per event: one event per page listed in an llms.txt file. Pages skipped or failed are not charged. Set the maximum pages per site to control cost. When the run reaches the maximum charge you set, the file for that site lists only the pages within it.

### Scope and conduct

Only public pages are read, without a browser, so content that a site builds with JavaScript after loading is not seen. The actor does not log in anywhere and collects no personal data. Generate files for sites you run or have permission to describe.

### Support

Questions and problems: the Issues tab on this page. Replies are written by an AI assistant on behalf of the developer and reviewed by the developer.

### References

\[1] llms-txt, The /llms.txt file, v2. https://llmstxt.org/

# Actor input Schema

## `startUrls` (type: `array`):

The home page (or the section start page) of each site. Each one gets its own llms.txt. The crawl stays on the start URL's host.

## `maxPages` (type: `integer`):

Most pages listed in each llms.txt. Each page included is one billable event.

## `useSitemap` (type: `boolean`):

Take pages from the site's XML sitemaps (named in robots.txt, or /sitemap.xml) before following links.

## `includeFullText` (type: `boolean`):

Write a second file with the main text of every listed page converted to Markdown.

## `includePatterns` (type: `array`):

Regular expressions. When set, only pages whose URL matches one of them are listed, such as /docs/.

## `excludePatterns` (type: `array`):

Regular expressions. Pages whose URL matches one of them are left out, such as /tag/ or ?page=.

## `optionalPatterns` (type: `array`):

Regular expressions. Pages whose URL matches go under the Optional heading, which the llms.txt proposal reserves for links an agent can skip, such as /blog/ or /changelog/.

## `siteName` (type: `string`):

The H1 of the file. Leave empty to take it from the home page.

## `siteSummary` (type: `string`):

The blockquote under the H1. Leave empty to use the home page's meta description.

## `timeoutSecs` (type: `integer`):

Give up on one page after this many seconds.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://docs.apify.com/"
    }
  ],
  "maxPages": 50,
  "useSitemap": true,
  "includeFullText": false,
  "timeoutSecs": 20
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        {
            "url": "https://docs.apify.com/"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("examsens.ai/llms-txt-generator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "startUrls": [{ "url": "https://docs.apify.com/" }] }

# Run the Actor and wait for it to finish
run = client.actor("examsens.ai/llms-txt-generator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://docs.apify.com/"
    }
  ]
}' |
apify call examsens.ai/llms-txt-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,examsens.ai/llms-txt-generator"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/u99MQCflqhuvYPYVS/builds/FQ0VDX9KnPL1S56i1/openapi.json
