diff --git a/src/providers/openrouter.rs b/src/providers/openrouter.rs index b796ff5..e59de49 100644 --- a/src/providers/openrouter.rs +++ b/src/providers/openrouter.rs @@ -54,16 +54,14 @@ impl Provider for OpenRouterProvider { async fn warmup(&self) -> anyhow::Result<()> { // Hit a lightweight endpoint to establish TLS + HTTP/2 connection pool. // This prevents the first real chat request from timing out on cold start. - let api_key = self - .api_key - .as_ref() - .ok_or_else(|| anyhow::anyhow!("No API key for warmup"))?; - let _ = self - .client - .get("https://openrouter.ai/api/v1/auth/key") - .header("Authorization", format!("Bearer {api_key}")) - .send() - .await; + if let Some(api_key) = self.api_key.as_ref() { + self.client + .get("https://openrouter.ai/api/v1/auth/key") + .header("Authorization", format!("Bearer {api_key}")) + .send() + .await? + .error_for_status()?; + } Ok(()) }