AI
Assistant
An in-page chat that answers from your documentation.
The assistant answers questions using the pages of your own site. It appears only when a credential is configured — with none, nothing is rendered.
Enabling it
Add an AI Gateway key:
AI_GATEWAY_API_KEY=your_key_hereDeployments on Vercel authenticate through OIDC automatically, so the key is mainly a local-development concern. The team still needs a payment method on file — AI Gateway will reject requests until you add a card to unlock free credits.
Then mount the route:
import { createAssistantRoute } from 'docora'
import docsConfig from '../../../docs.config'
import { source } from '../../../lib/source'
export const { POST } = createAssistantRoute(source, docsConfig)The layout tells the client whether it may render the chat. The credential is read on the server and never reaches the browser:
import { DocsRoot, isAssistantEnabled } from 'docora'
<DocsRoot
config={docsConfig}
assistantEnabled={isAssistantEnabled(docsConfig.assistant)}
>How answers are grounded
The model is given two tools, the same pair the MCP server exposes, so the in-page chat and a connected editor read the docs identically:
search-docs{ query, locale? }
Searches the index and returns matching pages with excerpts.
get-page{ path }required
Reads one page in full as markdown.
The system prompt tells it to answer only from those pages, to say so when the documentation does not cover something, and to cite the pages it used. The panel shows each tool step as it happens, so a reader can see what was consulted.
Configuration
assistant.enabledboolean
Set false to keep the assistant off even when a credential exists.
assistant.modelstring
Any AI Gateway model string. Defaults to google/gemini-2.5-flash (available on the AI Gateway free tier). Paid-tier models such as anthropic/claude-sonnet-5 need purchased credits.
assistant.suggestionsstring[]
Starter questions offered in an empty conversation.
assistant.systemPromptstring
Replaces the built-in prompt entirely.
assistant.explainWithAiboolean
Set false to drop the button under the table of contents.
assistant: {
model: 'google/gemini-2.5-flash',
suggestions: ['How do I add a new page?', 'How does sidebar order work?'],
}Without AI_GATEWAY_API_KEY the route answers 503 and the chat UI is not
rendered at all — not disabled, absent.