Derive routing header policy for a specific resolved route. Most providers only need their provider type. Vertex AI is special because Claude routes should forward `anthropic-beta`, while Gemini/OpenAI-compatible routes should not inherit Anthropic passthrough headers.
(
provider_type: &str,
protocols: &[String],
)
| 287 | /// Claude routes should forward `anthropic-beta`, while Gemini/OpenAI-compatible |
| 288 | /// routes should not inherit Anthropic passthrough headers. |
| 289 | pub fn route_headers_for_route( |
| 290 | provider_type: &str, |
| 291 | protocols: &[String], |
| 292 | ) -> (AuthHeader, Vec<(String, String)>, Vec<String>) { |
| 293 | let (auth, headers, mut passthrough_headers) = route_headers_for_provider_type(provider_type); |
| 294 | if profile_for(provider_type).is_some_and(|profile| profile.provider_type == "google-vertex-ai") |
| 295 | { |
| 296 | let is_vertex_anthropic = protocols |
| 297 | .iter() |
| 298 | .any(|protocol| protocol == "anthropic_messages"); |
| 299 | if is_vertex_anthropic && !passthrough_headers.iter().any(|h| h == "anthropic-beta") { |
| 300 | passthrough_headers.push("anthropic-beta".to_string()); |
| 301 | } |
| 302 | } |
| 303 | (auth, headers, passthrough_headers) |
| 304 | } |
| 305 | |
| 306 | // --------------------------------------------------------------------------- |
| 307 | // Protocol normalization |