@@ -196,16 +196,29 @@ func setDefaults(debug bool) {
196
196
}
197
197
198
198
// setProviderDefaults configures LLM provider defaults based on environment variables.
199
- // the default model priority is:
200
- // 1. Anthropic
201
- // 2. OpenAI
202
- // 3. Google Gemini
203
- // 4. Groq
204
- // 5. AWS Bedrock
205
199
func setProviderDefaults () {
206
- // Anthropic configuration
200
+ // Set all API keys we can find in the environment
207
201
if apiKey := os .Getenv ("ANTHROPIC_API_KEY" ); apiKey != "" {
208
202
viper .SetDefault ("providers.anthropic.apiKey" , apiKey )
203
+ }
204
+ if apiKey := os .Getenv ("OPENAI_API_KEY" ); apiKey != "" {
205
+ viper .SetDefault ("providers.openai.apiKey" , apiKey )
206
+ }
207
+ if apiKey := os .Getenv ("GEMINI_API_KEY" ); apiKey != "" {
208
+ viper .SetDefault ("providers.gemini.apiKey" , apiKey )
209
+ }
210
+ if apiKey := os .Getenv ("GROQ_API_KEY" ); apiKey != "" {
211
+ viper .SetDefault ("providers.groq.apiKey" , apiKey )
212
+ }
213
+
214
+ // Use this order to set the default models
215
+ // 1. Anthropic
216
+ // 2. OpenAI
217
+ // 3. Google Gemini
218
+ // 4. Groq
219
+ // 5. AWS Bedrock
220
+ // Anthropic configuration
221
+ if apiKey := os .Getenv ("ANTHROPIC_API_KEY" ); apiKey != "" {
209
222
viper .SetDefault ("agents.coder.model" , models .Claude37Sonnet )
210
223
viper .SetDefault ("agents.task.model" , models .Claude37Sonnet )
211
224
viper .SetDefault ("agents.title.model" , models .Claude37Sonnet )
@@ -214,7 +227,6 @@ func setProviderDefaults() {
214
227
215
228
// OpenAI configuration
216
229
if apiKey := os .Getenv ("OPENAI_API_KEY" ); apiKey != "" {
217
- viper .SetDefault ("providers.openai.apiKey" , apiKey )
218
230
viper .SetDefault ("agents.coder.model" , models .GPT41 )
219
231
viper .SetDefault ("agents.task.model" , models .GPT41Mini )
220
232
viper .SetDefault ("agents.title.model" , models .GPT41Mini )
@@ -223,7 +235,6 @@ func setProviderDefaults() {
223
235
224
236
// Google Gemini configuration
225
237
if apiKey := os .Getenv ("GEMINI_API_KEY" ); apiKey != "" {
226
- viper .SetDefault ("providers.gemini.apiKey" , apiKey )
227
238
viper .SetDefault ("agents.coder.model" , models .Gemini25 )
228
239
viper .SetDefault ("agents.task.model" , models .Gemini25Flash )
229
240
viper .SetDefault ("agents.title.model" , models .Gemini25Flash )
@@ -232,7 +243,6 @@ func setProviderDefaults() {
232
243
233
244
// Groq configuration
234
245
if apiKey := os .Getenv ("GROQ_API_KEY" ); apiKey != "" {
235
- viper .SetDefault ("providers.groq.apiKey" , apiKey )
236
246
viper .SetDefault ("agents.coder.model" , models .QWENQwq )
237
247
viper .SetDefault ("agents.task.model" , models .QWENQwq )
238
248
viper .SetDefault ("agents.title.model" , models .QWENQwq )
0 commit comments