documentation/getting-started/web-console/questdb-ai.md
import Screenshot from "@theme/Screenshot"
The QuestDB AI Assistant provides intelligent query assistance directly within the Web Console. You can generate, explain, and fix SQL queries, and ask questions about your schema and QuestDB using models from OpenAI and Anthropic, all while maintaining complete control over your data and API keys.
<Screenshot alt="AI Assistant chat window in Web Console" src="images/docs/console/ai-assistant-hero.webp" />
Before using the AI Assistant, you need to configure at least one AI provider with your own API key.
Additional providers will be available in future releases.
The AI Assistant follows a Bring Your Own Key (BYOK) model for security and privacy. Currently, OpenAI and Anthropic models are available:
<Screenshot alt="Configuration modal first step" src="images/docs/console/configure.webp" width={420} height={420} />
To add a model provider:
:::info Your API keys are stored only in your browser's local storage and are never transmitted to QuestDB servers. They are sent directly to your chosen AI provider when making requests. :::
After validating your API key, you can configure the provider settings:
<Screenshot alt="Model selection interface with toggle switches" src="images/docs/console/configure-step-2.webp" width={477} height={607} />
:::info Schema access only provides table structure information to the AI. Your actual data records are never sent to AI providers. Granting schema access helps the AI Assistant generate more accurate queries. :::
After initial setup, you can modify settings or remove API keys using the Settings button in the top bar.
<Screenshot alt="Settings modal for configuring the providers after initial setup" src="images/docs/console/settings.webp" width={548} height={621} />
The Chat Window is the primary interface for interacting with the AI Assistant.
Access the AI Assistant through multiple methods:
<Screenshot alt="Sidebar item for opening AI chat window" src="images/docs/console/sidebar-ai.webp" width={138} height={195} shadow={false} />
<Screenshot alt="AI Icons in editor" src="images/docs/console/ai-gutter-icons.webp" width={331} height={277} shadow={false} />
<Screenshot alt="Explain schema with AI" src="images/docs/console/explain-schema.png" width={497} height={166} shadow={false} />
The chat window provides a complete conversation interface:
:::info Chats are connected to a single query to improve response accuracy. The context badge in the input area shows which query or table the conversation is focused on. You can click on the context badge to see the related query in the editor. :::
<Screenshot alt="Chat history view" src="images/docs/console/chat-history.webp" width={315} height={371} />
Chats are displayed in a timeline. You can:
When opening a chat for a query with no conversation history, quick actions are available:
<Screenshot alt="Empty chat window showing Explain Query button" src="images/docs/console/quick-actions.webp" width={468} height={328} />
The AI Assistant can provide query suggestions when you prompt it to generate, refine, or fix a query. A diff editor is shown when a query is suggested:
<Screenshot alt="AI suggestion showing diff view with original and modified SQL" src="images/docs/console/ai-query-suggestion.webp" width={513} height={664} />
The diff editor provides several actions:
The AI Assistant shows its reasoning process in expandable sections. You can investigate the reviewed documentation and tables by expanding individual status indicators.
Click the red stop button during AI operations to cancel the current response. The conversation and message history are preserved, and you can continue the conversation or start a new operation.
Queries and conversation context are sent directly from your browser to your chosen AI provider. QuestDB does not receive, store, or process your conversations.
:::info Web Console does not send any data to a model provider unless a provider is configured explicitly by the user. :::
Your API keys and conversations are stored in your browser. They are never transmitted to QuestDB servers and remain under your complete control.
You can edit or remove your API keys at any time through the Settings modal. Keys are sent only to your chosen AI provider when you make requests.
Schema access grants the AI visibility to your database structure (table names, column names, data types) but never includes actual data records or values from your tables.
You control schema access independently for each provider. Even with schema access enabled, the AI only sees metadata about your database structure, not the data itself.
Different AI providers have different data handling practices. Consult your provider's documentation to understand their data retention, usage, and privacy policies.