AI

AI Assistant

Add AI-powered chat to your docs that answers questions, cites sources, and generates code examples.

About the Assistant

The AI Assistant answers questions about your documentation through natural language queries. It is embedded directly in your documentation site, so users can find answers quickly and succeed with your product.

When users ask questions, the assistant:

  • Searches and retrieves relevant content from your documentation using an MCP server.
  • Cites sources with navigable links to take users directly to referenced pages.
  • Generates copyable code examples to help users implement solutions from your documentation.
The AI Assistant requires an AI Gateway API key to function.

How It Works

The AI Assistant uses a multi-agent architecture:

  1. Main Agent - Receives user questions and decides when to search documentation
  2. Search Agent - Uses MCP server tools to find relevant content
  3. Response Generation - Synthesizes information into helpful, conversational answers

By default, the assistant connects to your documentation's built-in MCP server at /mcp, giving it access to all your pages without additional configuration. You can also connect to an external MCP server if needed.

Quick Start

1. Get an API Key

Get an API key from Vercel AI Gateway. AI Gateway works with multiple AI providers (OpenAI, Anthropic, Google, and more) through a unified API.

2. Set Environment Variable

Add your API key to your environment:

.env
AI_GATEWAY_API_KEY=your-api-key

3. Deploy

That's it! The assistant is automatically enabled when an API key is detected. Deploy your documentation and the assistant will be available to your users.

Using the Assistant

Users can interact with the assistant in multiple ways:

Floating Input

On documentation pages, a floating input appears at the bottom of the screen. Users can type their questions directly and press Enter to get answers.

Use the keyboard shortcut I to focus the floating input.

Explain with AI

Each documentation page includes an Explain with AI button in the table of contents sidebar. Clicking this button opens the assistant with the current page as context, asking it to explain the content.

Slideover Chat

When a conversation starts, a slideover panel opens on the right side of the screen. This panel displays the conversation history and allows users to continue asking questions.

Configuration

Configure the assistant through app.config.ts:

app.config.ts
export default defineAppConfig({
  aiChat: {
    // Show the floating input on documentation pages
    floatingInput: true,

    // Show the "Explain with AI" button in the sidebar
    explainWithAi: true,

    // FAQ questions to display when chat is empty
    faqQuestions: [],

    // Keyboard shortcuts
    shortcuts: {
      focusInput: 'meta_i'
    },

    // Custom icons
    icons: {
      trigger: 'i-lucide-sparkles',
      explain: 'i-lucide-brain'
    }
  }
})

FAQ Questions

Display suggested questions when the chat is empty. This helps users discover what they can ask.

Simple Format

app.config.ts
export default defineAppConfig({
  aiChat: {
    faqQuestions: [
      'How do I install Docus?',
      'How do I customize the theme?',
      'How do I add components to my pages?'
    ]
  }
})

Category Format

Organize questions into categories:

app.config.ts
export default defineAppConfig({
  aiChat: {
    faqQuestions: [
      {
        category: 'Getting Started',
        items: [
          'How do I install Docus?',
          'What is the project structure?'
        ]
      },
      {
        category: 'Customization',
        items: [
          'How do I change the theme colors?',
          'How do I add a custom logo?'
        ]
      }
    ]
  }
})

Localized Format

For multi-language documentation, provide FAQ questions per locale:

app.config.ts
export default defineAppConfig({
  aiChat: {
    faqQuestions: {
      en: [
        { category: 'Getting Started', items: ['How do I install?'] }
      ],
      fr: [
        { category: 'Démarrage', items: ['Comment installer ?'] }
      ]
    }
  }
})

Keyboard Shortcuts

Configure the keyboard shortcut for focusing the floating input:

app.config.ts
export default defineAppConfig({
  aiChat: {
    shortcuts: {
      // Default: 'meta_i' (Cmd+I on Mac, Ctrl+I on Windows)
      focusInput: 'meta_k' // Change to Cmd/Ctrl+K
    }
  }
})

The shortcut format uses underscores to separate keys. Common examples:

  • meta_i - Cmd+I (Mac) / Ctrl+I (Windows)
  • meta_k - Cmd+K (Mac) / Ctrl+K (Windows)
  • ctrl_shift_p - Ctrl+Shift+P

Custom Icons

Customize the icons used by the AI assistant:

app.config.ts
export default defineAppConfig({
  aiChat: {
    icons: {
      // Icon for the trigger button and slideover header
      trigger: 'i-lucide-bot',

      // Icon for the "Explain with AI" button
      explain: 'i-lucide-lightbulb'
    }
  }
})

Icons use the Iconify format (e.g., i-lucide-sparkles, i-heroicons-sparkles).

Internationalization

All UI texts are automatically translated based on the user's locale. Docus includes built-in translations for English and French.

The following texts are translated:

  • Slideover title and placeholder
  • Tooltip texts
  • Button labels ("Clear chat", "Close", "Explain with AI")
  • Status messages ("Thinking...", "Chat is cleared on refresh")

Disable Features

Disable the Floating Input

Hide the floating input at the bottom of documentation pages:

app.config.ts
export default defineAppConfig({
  aiChat: {
    floatingInput: false
  }
})

Disable "Explain with AI"

Hide the "Explain with AI" button in the documentation sidebar:

app.config.ts
export default defineAppConfig({
  aiChat: {
    explainWithAi: false
  }
})

Disable the Assistant Entirely

The assistant is automatically disabled when no API key is set. To explicitly disable it, simply remove the environment variable:

.env
# Comment out or remove the API key
# AI_GATEWAY_API_KEY=your-api-key

Advanced Configuration

Configure advanced options in nuxt.config.ts:

nuxt.config.ts
export default defineNuxtConfig({
  aiChat: {
    // AI model (uses AI SDK Gateway format)
    model: 'moonshotai/kimi-k2-turbo',

    // MCP server (path or URL)
    mcpServer: '/mcp',

    // API endpoint path
    apiPath: '/api/ai-chat'
  }
})

MCP Server Configuration

The assistant uses an MCP server to access your documentation. You have two options:

Use the Built-in MCP Server (Default)

By default, the assistant uses Docus's built-in MCP server at /mcp:

nuxt.config.ts
export default defineNuxtConfig({
  aiChat: {
    mcpServer: '/mcp'
  }
})
Make sure the MCP server is enabled in your configuration. If you've customized the MCP path, update mcpServer accordingly.

Use an External MCP Server

Connect to any external MCP server by providing a full URL:

nuxt.config.ts
export default defineNuxtConfig({
  aiChat: {
    mcpServer: 'https://other-docs.example.com/mcp'
  }
})

This is useful when you want the assistant to answer questions from a different documentation source, or when connecting to a centralized knowledge base.

Custom AI Model

The assistant uses moonshotai/kimi-k2-turbo by default. You can change this to any model supported by the AI SDK Gateway:

nuxt.config.ts
export default defineNuxtConfig({
  aiChat: {
    model: 'anthropic/claude-sonnet-4-20250514'
  }
})

Site Name in Responses

The assistant automatically uses your site name in its responses. Configure the site name in nuxt.config.ts:

nuxt.config.ts
export default defineNuxtConfig({
  site: {
    name: 'My Documentation'
  }
})

This makes the assistant respond as "the My Documentation assistant" and speak with authority about your specific product.

Programmatic Access

Use the useAIChat composable to control the assistant programmatically:

<script setup>
const { isEnabled, isOpen, open, close, toggle } = useAIChat()

function askQuestion() {
  // Open the assistant with a pre-filled question
  open('How do I configure the theme?', true)
}
</script>

<template>
  <UButton v-if="isEnabled" @click="askQuestion">
    Ask about themes
  </UButton>
</template>

Composable API

PropertyTypeDescription
isEnabledComputedRef<boolean>Whether the assistant is enabled (API key present)
isOpenRef<boolean>Whether the slideover is open
open(message?, clearPrevious?)FunctionOpen the assistant, optionally with a message
close()FunctionClose the assistant slideover
toggle()FunctionToggle the assistant open/closed
clearMessages()FunctionClear the conversation history
Copyright © 2026