Skip to content

VS Code Extension: Add Custom OpenAI-Compatible Provider UI #6163

Description

@markijbema

Problem

The VS Code extension currently lacks a UI for adding custom OpenAI-compatible providers, even though this functionality exists in the web/TUI application (packages/app).

Users must manually edit their opencode.json configuration file to add OpenAI-compatible providers, which creates a poor user experience and friction for users who want to:

  • Connect to local models (Ollama, LM Studio)
  • Use custom API endpoints
  • Connect to enterprise/self-hosted deployments
  • Use lesser-known OpenAI-compatible providers

Current State

Web/TUI App (packages/app) ✅

Has full UI support for custom providers:

  • dialog-custom-provider.tsx - Full form dialog with validation
  • settings-providers.tsx - Settings section with "Custom provider" button (line 212-234)

Features:

  • Provider ID input with validation
  • Provider name input
  • Base URL input with format validation
  • API Key input (supports both direct keys and {env:VAR} format)
  • Multiple model entries (ID + name)
  • Custom headers support
  • Full form validation
  • Integration with global config updates

VS Code Extension (packages/kilo-vscode) ❌

Missing the custom provider UI:

  • ProvidersTab.tsx only shows:
    • Default model selector
    • Small model selector
    • Disabled providers list
    • Enabled providers list
  • No UI to add/configure custom providers

Current Workaround

Users must manually create/edit opencode.json:

{
  "provider": {
    "my-custom-provider": {
      "name": "My Custom Provider",
      "api": "https://api.example.com/v1",
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "apiKey": "key-here",
        "baseURL": "https://api.example.com/v1"
      },
      "models": {
        "model-id": {
          "id": "model-id",
          "name": "Model Name",
          "temperature": true,
          "tool_call": true,
          "cost": {
            "input": 0.0001,
            "output": 0.0002
          },
          "limit": {
            "context": 128000,
            "output": 4096
          }
        }
      }
    }
  }
}

Proposed Solution

Port the custom provider UI from packages/app to packages/kilo-vscode/webview-ui:

  1. Add DialogCustomProvider component - Port from packages/app/src/components/dialog-custom-provider.tsx
  2. Update ProvidersTab - Add a "Custom Provider" section similar to the web app
  3. Add necessary translations - Ensure all i18n keys exist in the VSCode webview translations
  4. Add backend integration - Use existing handleUpdateConfig and auth endpoints

Implementation Notes

  • The VSCode extension already has the necessary backend plumbing via KiloProvider.handleUpdateConfig()
  • The backend /global/config endpoint supports updating provider configurations
  • Auth can be set via the /global/auth/set endpoint
  • The UI should follow the same validation logic as the web app

Related Documentation

  • OpenAI Compatible Providers docs
  • Provider system implementation in packages/opencode/src/provider/provider.ts
  • Config schema in packages/opencode/src/config/config.ts

User Impact

High - This is a frequently requested feature that significantly improves the user experience for developers using:

  • Local LLM setups
  • Custom API gateways
  • Enterprise deployments
  • Self-hosted solutions

Metadata

Metadata

Assignees

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions