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:

  1. Custom Model — any OpenAI-compatible API you configure (Ollama, OpenAI, Groq, etc.)
  2. GitHub Copilot — if installed and active in VS Code
  3. 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:

  1. Open the Command Palette (F1 or Cmd/Ctrl+Shift+P)
  2. Run: DBCode: Choose AI Provider
  3. 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

  1. Open the Command Palette (F1 or Cmd/Ctrl+Shift+P)
  2. Run: DBCode: Change AI Model
  3. 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):

  1. Open Settings (Cmd/Ctrl+,)
  2. Search for github.copilot.enable
  3. Add sql to the object with a value of false

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:

FeatureModelPurpose
Inline CompletionLlama 3.1 8B (Cerebras)Fast, schema-aware SQL completions
Execution Plan AnalysisGPT-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:

  1. Open Settings (Cmd/Ctrl+,)
  2. Search for dbcode.ai.inlineCompletion
  3. 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:

FeatureProviderData Shared
Inline CompletionCustom Model, Copilot, or DBCode AISchema only
Execution Plan AnalysisCustom Model, Copilot, or DBCode AIExecution plan, SQL query, and schema
Copilot ToolsGitHub Copilot onlySchema AND actual data
MCPExternal client’s modelSchema 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

  1. Check that GitHub Copilot extension is still installed
  2. Verify your Copilot subscription is active
  3. Try clearing dbcode.ai.modelId in settings to allow automatic selection

Inline Completions Not Working

  1. Verify inline completion is enabled: dbcode.ai.inlineCompletion
  2. Ensure the file has a database connection assigned
  3. Check your internet connection (all providers except local custom models require connectivity)
  4. If using Copilot, verify it’s configured to let DBCode handle SQL files (see Provide Schema Context)