Skip to content

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.

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.

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

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.

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.

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.

  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.

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:

FeatureModelPurpose
Inline CompletionLlama 3.1 8B (Cloudflare Workers AI)Fast, schema-aware SQL completions
Execution Plan AnalysisGPT-oss 120B (Cloudflare Workers AI)Deep analysis of query performance
  • 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 uses your custom model when it is the active provider, otherwise DBCode AI.

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.

Different features use different providers depending on your configuration:

FeatureProviderData Shared
Inline CompletionCustom Model 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.

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.

  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
  1. Verify inline completion is enabled: dbcode.ai.inlineCompletion
  2. Ensure the file has a database connection assigned
  3. Check your internet connection (DBCode AI and cloud custom models require connectivity)
  4. If you use a custom model, check the DBCode output panel for errors from your endpoint