Skip to content
FeedbackDashboard
Customization

AI chat widget

Add a conversational AI assistant to your documentation site to help users find answers.

The Stainless Docs Platform includes an optional AI-powered chat widget that allows users to ask questions in natural language and receive contextual answers based on your documentation content.

The built-in AI chat widget appears as a collapsible input field in the bottom-right corner of your documentation site. When users type a question, the widget:

  1. Sends the query to the Stainless AI backend
  2. Searches your indexed documentation for relevant content
  3. Generates accurate, SDK-aware responses using Retrieval-Augmented Generation (RAG)
  4. Streams the response to the user in real-time

The AI assistant understands your SDK structure, API endpoints, and documentation content, providing answers that are tailored to your specific API.

To enable the Stainless-provided AI chat widget in your astro.config.ts file, add the aiChat configuration:

astro.config.ts
import { defineConfig } from "astro/config";
import { stainlessDocs } from "@stainless-api/docs";
import aiChat from "@stainless-api/docs-ai-chat/plugin";
export default defineConfig({
integrations: [
stainlessDocs({
title: "My API Docs",
experimental: {
aiChat: aiChat(),
},
// ... other options
}),
],
});

After you save the configuration and rebuild your site, the AI chat widget appears in the bottom-right corner of your documentation pages.

The built-in AI chat widget includes:

  • Streaming responses: Answers appear in real-time as they are generated
  • Markdown rendering: Responses include formatted text, code blocks with syntax highlighting, and tables
  • Tool visibility: Users can see when the AI searches your documentation
  • Feedback collection: Thumbs up/down buttons allow users to rate responses
  • Copy to clipboard: Users can copy responses for use elsewhere
  • Keyboard shortcuts: Press Escape to close the chat interface

If you prefer to use your own AI assistant or chatbot instead of the built-in Stainless chat widget, you can implement a custom chat interface. This allows you to use a different AI model, custom backend, or branded chat experience.

For an example of how to build a custom chat widget in Astro, see the AI Chat Bot theme on Astro.

The following documentation sites use the Stainless AI chat widget:

If you have enabled the AI chat but want to disable it, remove or comment out the aiChat configuration from your astro.config.ts file:

astro.config.ts
export default defineConfig({
integrations: [
stainlessDocs({
title: "My API Docs",
experimental: {
aiChat: aiChat(),
},
}),
],
});