Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions config.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,31 @@ providers:
openai:
# API key for OpenAI
# Can also be set via OPENAI_API_KEY environment variable
# api_key: "..."
# api_key: "sk-..."

# Base URL for OpenAI API (can be changed for custom endpoints)
# Can also be set via OPENAI_BASE_URL environment variable
# base_url: "https://api.openai.com"

# Google Gemini configuration
gemini:
# API key for Google Gemini
# Can also be set via GEMINI_API_KEY environment variable
# api_key: "AIza..."

# Base URL for Gemini API
# Can also be set via GEMINI_BASE_URL environment variable
# base_url: "https://generativelanguage.googleapis.com"

# OpenRouter configuration
openrouter:
# API key for OpenRouter
# Can also be set via OPENROUTER_API_KEY environment variable
# api_key: "sk-or-v1-..."

# Base URL for OpenRouter API
# Can also be set via OPENROUTER_BASE_URL environment variable
# base_url: "https://openrouter.ai/api"

# Storage configuration
storage:
Expand All @@ -56,14 +76,17 @@ subagents:
# Maps subagent types to specific models
# Only used when enable: true
mappings:
# Code review specialist (example)
# Code review specialist - routes to OpenAI (example)
# code-reviewer: "gpt-4o"

# Data analysis expert (example)
# data-analyst: "o3"
# Data analysis expert - routes to Gemini (example)
# data-analyst: "gemini-1.5-pro"

# Documentation writer (example)
# doc-writer: "gpt-3.5-turbo"
# Documentation writer - routes to OpenRouter (example)
# doc-writer: "openrouter/claude-3-haiku-20240307"

# Deep reasoning specialist - routes to OpenRouter (example)
# deep-reasoning: "openrouter/o3-mini"

# Environment variable overrides:
# The following environment variables will override the YAML configuration:
Expand All @@ -83,6 +106,14 @@ subagents:
# OPENAI_API_KEY - OpenAI API key
# OPENAI_BASE_URL - OpenAI base URL
#
# Gemini:
# GEMINI_API_KEY - Google Gemini API key
# GEMINI_BASE_URL - Gemini base URL
#
# OpenRouter:
# OPENROUTER_API_KEY - OpenRouter API key
# OPENROUTER_BASE_URL - OpenRouter base URL
#
# Storage:
# DB_PATH - Database file path
#
Expand Down
2 changes: 2 additions & 0 deletions proxy/cmd/proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ func main() {
providers := make(map[string]provider.Provider)
providers["anthropic"] = provider.NewAnthropicProvider(&cfg.Providers.Anthropic)
providers["openai"] = provider.NewOpenAIProvider(&cfg.Providers.OpenAI)
providers["gemini"] = provider.NewGeminiProvider(&cfg.Providers.Gemini)
providers["openrouter"] = provider.NewOpenRouterProvider(&cfg.Providers.OpenRouter)

// Initialize model router
modelRouter := service.NewModelRouter(cfg, providers, logger)
Expand Down
40 changes: 38 additions & 2 deletions proxy/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ type TimeoutsConfig struct {
}

type ProvidersConfig struct {
Anthropic AnthropicProviderConfig `yaml:"anthropic"`
OpenAI OpenAIProviderConfig `yaml:"openai"`
Anthropic AnthropicProviderConfig `yaml:"anthropic"`
OpenAI OpenAIProviderConfig `yaml:"openai"`
Gemini GeminiProviderConfig `yaml:"gemini"`
OpenRouter OpenRouterProviderConfig `yaml:"openrouter"`
}

type AnthropicProviderConfig struct {
Expand All @@ -49,6 +51,16 @@ type OpenAIProviderConfig struct {
APIKey string `yaml:"api_key"`
}

type GeminiProviderConfig struct {
BaseURL string `yaml:"base_url"`
APIKey string `yaml:"api_key"`
}

type OpenRouterProviderConfig struct {
BaseURL string `yaml:"base_url"`
APIKey string `yaml:"api_key"`
}

type AnthropicConfig struct {
BaseURL string
Version string
Expand Down Expand Up @@ -95,6 +107,14 @@ func Load() (*Config, error) {
BaseURL: "https://api.openai.com",
APIKey: "",
},
Gemini: GeminiProviderConfig{
BaseURL: "https://generativelanguage.googleapis.com",
APIKey: "",
},
OpenRouter: OpenRouterProviderConfig{
BaseURL: "https://openrouter.ai/api",
APIKey: "",
},
},
Storage: StorageConfig{
DBPath: "requests.db",
Expand Down Expand Up @@ -154,6 +174,22 @@ func Load() (*Config, error) {
if envKey := os.Getenv("OPENAI_API_KEY"); envKey != "" {
cfg.Providers.OpenAI.APIKey = envKey
}

// Override Gemini settings
if envURL := os.Getenv("GEMINI_BASE_URL"); envURL != "" {
cfg.Providers.Gemini.BaseURL = envURL
}
if envKey := os.Getenv("GEMINI_API_KEY"); envKey != "" {
cfg.Providers.Gemini.APIKey = envKey
}

// Override OpenRouter settings
if envURL := os.Getenv("OPENROUTER_BASE_URL"); envURL != "" {
cfg.Providers.OpenRouter.BaseURL = envURL
}
if envKey := os.Getenv("OPENROUTER_API_KEY"); envKey != "" {
cfg.Providers.OpenRouter.APIKey = envKey
}

// Override storage settings
if envPath := os.Getenv("DB_PATH"); envPath != "" {
Expand Down
Loading