diff --git a/crates/goose-server/src/routes/providers_and_keys.json b/crates/goose-server/src/routes/providers_and_keys.json index fc61c5b91f27..b3a9c8f02885 100644 --- a/crates/goose-server/src/routes/providers_and_keys.json +++ b/crates/goose-server/src/routes/providers_and_keys.json @@ -29,7 +29,7 @@ "models": ["gemini-1.5-flash"], "required_keys": ["GOOGLE_API_KEY"] }, - "grok": { + "groq": { "name": "Groq", "description": "Lorem ipsum", "models": ["llama-3.3-70b-versatile"], @@ -58,5 +58,11 @@ "description": "Connect to LLMs via AWS Bedrock", "models": ["us.anthropic.claude-3-7-sonnet-20250219-v1:0"], "required_keys": ["AWS_PROFILE"] - } + }, + "xai": { + "name": "Xai", + "description": "Lorem ipsum", + "models": ["grok-3"], + "required_keys": ["XAI_API_KEY"] + }, } diff --git a/crates/goose/tests/agent.rs b/crates/goose/tests/agent.rs index 8f474ed8dd94..b029e79a330d 100644 --- a/crates/goose/tests/agent.rs +++ b/crates/goose/tests/agent.rs @@ -12,7 +12,7 @@ use goose::providers::{ anthropic::AnthropicProvider, azure::AzureProvider, bedrock::BedrockProvider, databricks::DatabricksProvider, gcpvertexai::GcpVertexAIProvider, google::GoogleProvider, groq::GroqProvider, ollama::OllamaProvider, openai::OpenAiProvider, - openrouter::OpenRouterProvider, + openrouter::OpenRouterProvider, xai::XaiProvider, }; #[derive(Debug, PartialEq)] @@ -27,6 +27,7 @@ enum ProviderType { Groq, Ollama, OpenRouter, + Xai, } impl ProviderType { @@ -46,6 +47,7 @@ impl ProviderType { ProviderType::Ollama => &[], ProviderType::OpenRouter => &["OPENROUTER_API_KEY"], ProviderType::GcpVertexAI => &["GCP_PROJECT_ID", "GCP_LOCATION"], + ProviderType::Xai => &["XAI_API_KEY"], } } @@ -79,6 +81,7 @@ impl ProviderType { ProviderType::Groq => Arc::new(GroqProvider::from_env(model_config)?), ProviderType::Ollama => Arc::new(OllamaProvider::from_env(model_config)?), ProviderType::OpenRouter => Arc::new(OpenRouterProvider::from_env(model_config)?), + ProviderType::Xai => Arc::new(XaiProvider::from_env(model_config)?), }) } } @@ -326,4 +329,14 @@ mod tests { }) .await } + + #[tokio::test] + async fn test_agent_with_xai() -> Result<()> { + run_test_with_config(TestConfig { + provider_type: ProviderType::Xai, + model: "grok-3", + context_window: 9_000, + }) + .await + } } diff --git a/crates/goose/tests/providers.rs b/crates/goose/tests/providers.rs index 842f53789963..94c8bc07975d 100644 --- a/crates/goose/tests/providers.rs +++ b/crates/goose/tests/providers.rs @@ -4,7 +4,7 @@ use goose::message::{Message, MessageContent}; use goose::providers::base::Provider; use goose::providers::errors::ProviderError; use goose::providers::{ - anthropic, azure, bedrock, databricks, google, groq, ollama, openai, openrouter, snowflake, + anthropic, azure, bedrock, databricks, google, groq, ollama, openai, openrouter, snowflake, xai, }; use mcp_core::content::Content; use mcp_core::tool::Tool; @@ -501,6 +501,17 @@ async fn test_sagemaker_tgi_provider() -> Result<()> { .await } +#[tokio::test] +async fn test_xai_provider() -> Result<()> { + test_provider( + "Xai", + &["XAI_API_KEY"], + None, + xai::XaiProvider::default, + ) + .await +} + // Print the final test report #[ctor::dtor] fn print_test_report() {