eca icon indicating copy to clipboard operation
eca copied to clipboard

Refactor Provider Configuration

Open zikajk opened this issue 1 year ago • 2 comments

To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.

The Problem The current configuration is inconsistent. Provider-specific keys like openaiApiKey and anthropicApiKey are at the top level, while custom providers are defined in a separate customProviders map. This fractured approach makes it difficult to understand how to configure different providers and correctly format a default-model string.

Proposed Solution I propose we consolidate all provider configurations into a single, unified providers map at the top level. This creates a predictable structure where all providers, whether built-in or custom, are treated as first-class citizens. Thedefault-modelat the root level would then clearly follow a provider-key/model-name format.

What This Refactor Involves This change will move and merge several existing configuration keys:

The entire customProviders map will be removed. Its contents will be moved into the new providers map.

Top-level keys openaiApiKey, openaiApiUrl, anthropicApiKey, anthropicApiUrl, and ollamaApiUrl will be moved into their corresponding provider objects (e.g., inside providers.openai).

The separate top-level ollama configuration object will also be merged into providers.ollama.

Example of New Structure

{
  // ... other top-level config
  "providers": {
    "openai": {
      "apiKey": "...", 
    },
    "anthropic": {
      "apiKey": "..." 
    },
    "ollama": {
      "url": "..."
    },
    "openrouter": { 
      "api": "openai-chat",
      "url": "...."
      "apiKey": "...",
      "models": {"openai/gpt5": {"extraPayload": {"reasoning": {"effort": "high"}}}, ....} \\ we might want tp support vector as well when extraPayload isn't needed.
      
    }
  },
  defaultModel: "openrouter/openai/gpt5"
  // ... rest of config
}

zikajk avatar Aug 20 '25 16:08 zikajk

Looks great, I agree. We can work on that as soon I finish a refactor regarding built-in providers model naming.

ericdallo avatar Aug 20 '25 16:08 ericdallo

Done! the suggested config is now live

ericdallo avatar Aug 21 '25 20:08 ericdallo