# Source: https://content.nuxt.com/raw/docs/integrations/llms.md

# Nuxt LLMs module

> Learn how to generate AI-ready content files using Nuxt Content and the Nuxt LLMs module.

The Nuxt Content module integrates `nuxt-llms` to prepare your content for Large Language Models (LLMs). When `nuxt-llms` is detected, Content module automatically extends the LLMs module and inject collections of type [page](https://content.nuxt.com/docs/collections/types#page-type) to the LLMs module.🚀

## Setup

<prose-steps>

### Install the required module

```bash [terminal]
npm install nuxt-llms
```

### Configure your `nuxt.config.ts`

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  modules: ['@nuxt/content', 'nuxt-llms'],
  llms: {
    domain: 'https://your-site.com',
    title: 'Your Site Name',
    description: 'A brief description of your site',
  },
})
```

</prose-steps>

That's it 🚀 `/llms.txt` file is automatically generated and pre-rendered.

## Raw markdown access

When `nuxt-llms` is enabled, Nuxt Content also exposes a raw markdown endpoint so you can stream LLM-ready source files without going through the full rendering pipeline.

- **Endpoint**: `/raw/<content-path>.md` (use the same path as the page URL, drop trailing `/index`, and keep the `.md` extension), returning `text/markdown; charset=utf-8`.
- **Scope**: only `page` collections are included; exclude specific collections with `llms.contentRawMarkdown.excludeCollections`. Set `llms.contentRawMarkdown = false` to disable the endpoint entirely.
- **Output**: if the requested document is missing a top-level heading or description, the route prepends the title and description to the markdown body before returning it.
- **llms.txt links**: document links generated in `llms.txt` are automatically rewritten to the `/raw/...md` endpoint (unless the collection is excluded or the feature is disabled) so agents fetch compact markdown instead of full HTML, reducing token usage and improving response speed. Control this with `llms.contentRawMarkdown.rewriteLLMSTxt` (defaults to `true`).

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  modules: ['@nuxt/content', 'nuxt-llms'],
  llms: {
    contentRawMarkdown: {
      // Optional: prevent specific page collections from being exposed
      excludeCollections: ['blog'],
      // Optional: keep llms.txt links pointing to rendered pages
      rewriteLLMSTxt: false,
    },
  },
})
```

## Sections

When generating content, you can create custom sections to process your content into LLM-friendly formats.

You can create custom sections to the `llms.sections` array and define the `contentCollection` and `contentFilters` option for each section.

<prose-warning>

If there is no section defined in the `contentCollection` option, the module will only add [page](https://content.nuxt.com/docs/collections/types#page-type) collections to the LLMs module.

</prose-warning>

### `contentCollection`

This option specifies which content collection to use as source.

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  llms: {
    sections: [
      {
        title: 'Documentation',
        description: 'Technical documentation and guides',
        contentCollection: 'docs',
       },
    ],
  },
})
```

### `contentFilters`

This options defines filters to select specific content within the collection.

You precisely control which content is included. Each filter consists of:

- `field`: The content property to check
- `operator`: Comparison operator (`=`, `<>`, `>`, `<`, `LIKE`, `IN`, `NOT IN`, `IS NULL`, `IS NOT NULL`, etc.)
- `value`: The value to compare against

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  llms: {
    sections: [
      {
        title: 'Documentation',
        description: 'Technical documentation and guides',
        contentCollection: 'docs',
        contentFilters: [
            // Only include markdown files
            { field: 'extension', operator: '=', value: 'md' },
            // Only include published content
            { field: 'draft', operator: '<>', value: true },
            // Filter by directory
            { field: 'path', operator: 'LIKE', value: '/guide%' },
        ]
      },
    ],
  },
})
```

<tip to="https://github.com/nuxtlabs/nuxt-llms">

Checkout the nuxt-llms documentation for more information about the module.

</tip>