diff --git a/crates/webclaw-cli/src/main.rs b/crates/webclaw-cli/src/main.rs index 480af3b..3076e5e 100644 --- a/crates/webclaw-cli/src/main.rs +++ b/crates/webclaw-cli/src/main.rs @@ -2242,6 +2242,7 @@ async fn build_llm_provider(cli: &Cli) -> Result, String> { "atlascloud" => { let provider = webclaw_llm::providers::atlascloud::AtlasCloudProvider::new( None, + cli.llm_base_url.clone(), cli.llm_model.clone(), ) .ok_or("ATLASCLOUD_API_KEY not set")?; diff --git a/crates/webclaw-llm/src/chain.rs b/crates/webclaw-llm/src/chain.rs index ecdbb16..4b6e9db 100644 --- a/crates/webclaw-llm/src/chain.rs +++ b/crates/webclaw-llm/src/chain.rs @@ -37,7 +37,7 @@ impl ProviderChain { providers.push(Box::new(openai)); } - if let Some(atlascloud) = AtlasCloudProvider::new(None, None) { + if let Some(atlascloud) = AtlasCloudProvider::new(None, None, None) { debug!("atlascloud configured, adding to chain"); providers.push(Box::new(atlascloud)); } diff --git a/crates/webclaw-llm/src/providers/atlascloud.rs b/crates/webclaw-llm/src/providers/atlascloud.rs index 5753014..01e680c 100644 --- a/crates/webclaw-llm/src/providers/atlascloud.rs +++ b/crates/webclaw-llm/src/providers/atlascloud.rs @@ -12,10 +12,14 @@ pub struct AtlasCloudProvider { impl AtlasCloudProvider { /// Returns `None` if no Atlas Cloud API key is available (param or env). - pub fn new(key_override: Option, model: Option) -> Option { + pub fn new( + key_override: Option, + base_url: Option, + model: Option, + ) -> Option { let key = super::load_api_key(key_override, "ATLASCLOUD_API_KEY")?; - let base_url = std::env::var("ATLASCLOUD_BASE_URL") - .ok() + let base_url = base_url + .or_else(|| std::env::var("ATLASCLOUD_BASE_URL").ok()) .unwrap_or_else(|| "https://api.atlascloud.ai/v1".into()); let model = model.unwrap_or_else(|| "qwen/qwen3.5-flash".into()); let inner = OpenAiProvider::new(Some(key), Some(base_url), Some(model))?; @@ -48,12 +52,12 @@ mod tests { #[test] fn empty_key_returns_none() { - assert!(AtlasCloudProvider::new(Some(String::new()), None).is_none()); + assert!(AtlasCloudProvider::new(Some(String::new()), None, None).is_none()); } #[test] fn explicit_key_constructs_with_atlas_defaults() { - let provider = AtlasCloudProvider::new(Some("test-key".into()), None) + let provider = AtlasCloudProvider::new(Some("test-key".into()), None, None) .expect("should construct"); assert_eq!(provider.name(), "atlascloud"); assert_eq!(provider.default_model(), "qwen/qwen3.5-flash"); @@ -63,6 +67,7 @@ mod tests { fn explicit_model_override() { let provider = AtlasCloudProvider::new( Some("test-key".into()), + Some("https://proxy.example.com/v1".into()), Some("deepseek-ai/deepseek-v4-pro".into()), ) .expect("should construct");