diff --git a/crates/goose/src/providers/anthropic.rs b/crates/goose/src/providers/anthropic.rs index 5f2976af4e05..45260c1e65aa 100644 --- a/crates/goose/src/providers/anthropic.rs +++ b/crates/goose/src/providers/anthropic.rs @@ -91,9 +91,20 @@ impl AnthropicProvider { key: api_key, }; - let api_client = ApiClient::new(config.base_url, auth)? + let mut api_client = ApiClient::new(config.base_url, auth)? .with_header("anthropic-version", ANTHROPIC_API_VERSION)?; + // Add custom headers if present + if let Some(headers) = &config.headers { + let mut header_map = reqwest::header::HeaderMap::new(); + for (key, value) in headers { + let header_name = reqwest::header::HeaderName::from_bytes(key.as_bytes())?; + let header_value = reqwest::header::HeaderValue::from_str(value)?; + header_map.insert(header_name, header_value); + } + api_client = api_client.with_headers(header_map)?; + } + Ok(Self { api_client, model,