AI
Models and Configuration
DBCode uses AI models to provide inline code completion, natural language query generation, execution plan analysis, and other intelligent features. You can bring your own model, use GitHub Copilot, or rely on DBCode’s hosted models.
AI Providers
Section titled “AI Providers”DBCode supports three AI providers, checked in order on startup:
- Custom Model — any OpenAI-compatible API you configure (Ollama, OpenAI, Groq, etc.)
- GitHub Copilot — if installed and active in VS Code
- DBCode AI — hosted models, always available as fallback
DBCode automatically detects the best available provider. If you’ve configured a custom model endpoint, it becomes the primary provider. Otherwise, GitHub Copilot is used if available, with DBCode AI as the final fallback.
Switching Providers
Section titled “Switching Providers”To change providers at any time:
- Open the Command Palette (F1 or Cmd/Ctrl+Shift+P)
- Run: DBCode: Choose AI Provider
- Select your preferred provider
Provider Fallback
Section titled “Provider Fallback”If your active provider fails (server unreachable, model error, etc.), DBCode offers to fall back to the next available provider:
- For inline completions, custom model errors are written to the DBCode output panel.
- For interactive features like execution plan analysis, a confirmation dialog is shown before switching.
To disable fallback and lock to your custom model, enable dbcode.ai.customModel.only.
Custom Model
Section titled “Custom Model”Use your own AI model — local (Ollama, LM Studio) or cloud (OpenAI, Groq, Together) — via any OpenAI-compatible endpoint. See the dedicated Custom Provider guide for full setup instructions.
Quick setup:
{ "dbcode.ai.customModel.endpoint": "http://localhost:11434", "dbcode.ai.customModel.model": "qwen2.5-coder:7b"}For cloud APIs that require authentication, run DBCode: Set Custom Model API Key from the Command Palette. The key is stored securely in your OS keychain via VS Code’s SecretStorage.
GitHub Copilot
Section titled “GitHub Copilot”Requirements:
- GitHub Copilot extension installed in VS Code
- Active GitHub Copilot subscription (Individual, Business, or Enterprise)
When selected, DBCode uses Copilot’s models for execution plan analysis and other AI features.
Changing the Copilot Model
Section titled “Changing the Copilot Model”- Open the Command Palette (F1 or Cmd/Ctrl+Shift+P)
- Run: DBCode: Change AI Model
- Select from the available Copilot models
Your selection is saved to dbcode.ai.modelId.
DBCode Hosted Models
Section titled “DBCode Hosted Models”When neither a custom model nor GitHub Copilot is available, DBCode uses its own hosted models.
Important: Hosted models are used for inline completion and execution plan analysis only. They are not used for Copilot Tools or MCP.
DBCode uses purpose-specific models running on Cloudflare Workers AI:
| Feature | Model | Purpose |
|---|---|---|
| Inline Completion | Llama 3.1 8B (Cloudflare Workers AI) | Fast, schema-aware SQL completions |
| Execution Plan Analysis | GPT-oss 120B (Cloudflare Workers AI) | Deep analysis of query performance |
Limitations
Section titled “Limitations”- Require internet connectivity
- Inline completions are simpler than those from larger custom models
- Execution plan analysis quality depends on the complexity of the plan
Inline Completion
Section titled “Inline Completion”Inline completion uses your custom model when it is the active provider, otherwise DBCode AI.
Inline completion can be enabled or disabled independently:
- Open Settings (Cmd/Ctrl+,)
- Search for
dbcode.ai.inlineCompletion - Uncheck to disable
When disabled, DBCode won’t provide automatic SQL suggestions as you type. You can still use Copilot Tools and MCP for natural language queries.
AI Features Model Usage
Section titled “AI Features Model Usage”Different features use different providers depending on your configuration:
| Feature | Provider | Data Shared |
|---|---|---|
| Inline Completion | Custom Model or DBCode AI | Schema only |
| Execution Plan Analysis | Custom Model, Copilot, or DBCode AI | Execution plan, SQL query, and schema |
| Copilot Tools | GitHub Copilot only | Schema AND actual data |
| MCP | External client’s model | Schema AND actual data |
When a custom model is configured, it is used for inline completion and execution plan analysis. Copilot Tools and MCP are unaffected — they always use their respective model sources.
See Privacy and Security for detailed information on what data is sent to each provider.
Troubleshooting
Section titled “Troubleshooting””No language models found” Error
Section titled “”No language models found” Error”This may appear when:
- GitHub Copilot is not installed and no custom model is configured
Solution: Configure a Custom Provider, install GitHub Copilot, or DBCode will fall back to its hosted model automatically.
Model Selection Dialog Keeps Appearing
Section titled “Model Selection Dialog Keeps Appearing”- Check that GitHub Copilot extension is still installed
- Verify your Copilot subscription is active
- Try clearing
dbcode.ai.modelIdin settings to allow automatic selection
Inline Completions Not Working
Section titled “Inline Completions Not Working”- Verify inline completion is enabled:
dbcode.ai.inlineCompletion - Ensure the file has a database connection assigned
- Check your internet connection (DBCode AI and cloud custom models require connectivity)
- If you use a custom model, check the DBCode output panel for errors from your endpoint
Related Documentation
Section titled “Related Documentation”- Custom Provider - Use your own AI model
- Privacy and Security - Data handling and privacy considerations
- Inline Completion - Using inline SQL suggestions
- Copilot Tools - Natural language database queries
- MCP - Connecting external AI clients