Models and Configuration
Understanding how DBCode selects AI providers and models for inline completion, execution plan analysis, and other features.
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
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
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
If your active provider fails (server unreachable, model error, etc.), DBCode offers to fall back to the next available provider:
- For inline completions, the fallback happens silently with an info notification.
- 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
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
Requirements:
- GitHub Copilot extension installed in VS Code
- Active GitHub Copilot subscription (Individual, Business, or Enterprise)
When available, DBCode uses Copilot’s models to provide schema-aware SQL suggestions and execution plan analysis.
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.
Provide Schema Context to GitHub Copilot
When using Copilot for inline completion, DBCode provides your database schema for more accurate SQL suggestions.
To enable this (recommended):
- Open Settings (Cmd/Ctrl+,)
- Search for
github.copilot.enable - Add
sqlto the object with a value offalse
This tells Copilot to defer to DBCode for SQL file completions, allowing DBCode to provide schema context.
{ "github.copilot.enable": { "*": true, "sql": false }}When you first enable inline completion with Copilot installed, DBCode will prompt you to configure this automatically.
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 routed through the Vercel AI Gateway:
| Feature | Model | Purpose |
|---|---|---|
| Inline Completion | Llama 3.1 8B (Cerebras) | Fast, schema-aware SQL completions |
| Execution Plan Analysis | GPT-oss 120B (Baseten) | Deep analysis of query performance |
Limitations
- Require internet connectivity
- Inline completions are simpler compared to Copilot or larger custom models
- Execution plan analysis quality depends on the complexity of the plan
Inline Completion
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
Different features use different providers depending on your configuration:
| Feature | Provider | Data Shared |
|---|---|---|
| Inline Completion | Custom Model, Copilot, 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
”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
- 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
- Verify inline completion is enabled:
dbcode.ai.inlineCompletion - Ensure the file has a database connection assigned
- Check your internet connection (all providers except local custom models require connectivity)
- If using Copilot, verify it’s configured to let DBCode handle SQL files (see Provide Schema Context)
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