Skip to content

Conversation

@hdnh2006
Copy link

Add Support for Custom OpenAI-Compatible Providers

Description

This PR adds the ability to use any OpenAI-compatible API provider with Dexter, including providers like Groq, Together AI, OpenRouter or self deployed models using vLLM or llama.cpp

Previously, Dexter only supported hardcoded providers (OpenAI, Anthropic, Google, xAI, Ollama). Now users can configure custom providers through an interactive CLI flow without modifying code.

Changes

Core Implementation

  • src/utils/config.ts: Added CustomProviderConfig interface and functions to save/load custom provider configurations
  • src/model/llm.ts: Added custom: prefix handler that loads provider settings from config and creates ChatOpenAI client with custom base URL
  • src/utils/env.ts: Added custom provider to provider registry
  • src/components/CustomProviderPrompt.tsx: New component - interactive 4-step wizard for configuring custom providers
  • src/components/ModelSelector.tsx: Added "Custom (OpenAI-compatible)" option to provider list
  • src/hooks/useModelSelection.ts: Added custom_provider_config state and handleCustomProviderSubmit handler
  • src/cli.tsx: Added rendering for custom provider configuration screen

User Experience

  1. User types /model command
  2. Selects "Custom (OpenAI-compatible)" from provider list
  3. Enters provider details through guided prompts:
    • Provider name (display name)
    • Base URL (API endpoint)
    • API key
    • Model ID
  4. Configuration persists in .dexter/settings.json
image

Configuration Storage

Custom provider settings are stored locally in .dexter/settings.json:

{
  "provider": "custom",
  "modelId": "custom:mixtral-8x7b-32768",
  "customProviderConfig": {
    "name": "Groq",
    "baseUrl": "https://api.groq.com/openai/v1",
    "apiKey": "gsk_...",
    "modelId": "mixtral-8x7b-32768"
  }
}

Related Issues

Closes #49

@virattt virattt added the run-ci Runs CI label Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci Runs CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How do we set the base url?

2 participants