mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-02 06:20:29 +00:00
add xai support (#135)
This commit is contained in:
parent
69ade34c2c
commit
a61b2026eb
5 changed files with 88 additions and 12 deletions
|
|
@ -243,6 +243,13 @@ func setProviderDefaults() {
|
|||
if apiKey := os.Getenv("OPENROUTER_API_KEY"); apiKey != "" {
|
||||
viper.SetDefault("providers.openrouter.apiKey", apiKey)
|
||||
}
|
||||
if apiKey := os.Getenv("XAI_API_KEY"); apiKey != "" {
|
||||
viper.SetDefault("providers.xai.apiKey", apiKey)
|
||||
}
|
||||
if apiKey := os.Getenv("AZURE_OPENAI_ENDPOINT"); apiKey != "" {
|
||||
// api-key may be empty when using Entra ID credentials – that's okay
|
||||
viper.SetDefault("providers.azure.apiKey", os.Getenv("AZURE_OPENAI_API_KEY"))
|
||||
}
|
||||
|
||||
// Use this order to set the default models
|
||||
// 1. Anthropic
|
||||
|
|
@ -293,6 +300,13 @@ func setProviderDefaults() {
|
|||
return
|
||||
}
|
||||
|
||||
if viper.Get("providers.xai.apiKey") != "" {
|
||||
viper.SetDefault("agents.coder.model", models.XAIGrok3Beta)
|
||||
viper.SetDefault("agents.task.model", models.XAIGrok3Beta)
|
||||
viper.SetDefault("agents.title.model", models.XAiGrok3MiniFastBeta)
|
||||
return
|
||||
}
|
||||
|
||||
// AWS Bedrock configuration
|
||||
if hasAWSCredentials() {
|
||||
viper.SetDefault("agents.coder.model", models.BedrockClaude37Sonnet)
|
||||
|
|
@ -302,8 +316,6 @@ func setProviderDefaults() {
|
|||
}
|
||||
|
||||
if os.Getenv("AZURE_OPENAI_ENDPOINT") != "" {
|
||||
// api-key may be empty when using Entra ID credentials – that's okay
|
||||
viper.SetDefault("providers.azure.apiKey", os.Getenv("AZURE_OPENAI_API_KEY"))
|
||||
viper.SetDefault("agents.coder.model", models.AzureGPT41)
|
||||
viper.SetDefault("agents.task.model", models.AzureGPT41Mini)
|
||||
viper.SetDefault("agents.title.model", models.AzureGPT41Mini)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue