From d767ae77505c59fb9e744123ded7cc04071722bf Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Wed, 24 Jun 2026 13:03:28 -0700 Subject: [PATCH] feat(ai-gateway): KeyAuthenticator.verify takes model for model-access enforcement --- .../crates/ai-gateway/src/auth/client/mod.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/litellm-rust/crates/ai-gateway/src/auth/client/mod.rs b/litellm-rust/crates/ai-gateway/src/auth/client/mod.rs index ad290b89743..9d4b73a8c64 100644 --- a/litellm-rust/crates/ai-gateway/src/auth/client/mod.rs +++ b/litellm-rust/crates/ai-gateway/src/auth/client/mod.rs @@ -34,7 +34,13 @@ pub enum AuthError { #[axum::async_trait] pub trait KeyAuthenticator: Send + Sync { /// Resolve `key` for the given `route` (the gateway's own request path, e.g. - /// `/v1/realtime`). The route is forwarded so route/model restrictions on the - /// key are evaluated against the route it's actually being used on. - async fn verify(&self, key: &str, route: &str) -> Result; + /// `/v1/realtime`) and the requested `model` (if any). Both are forwarded so + /// the backend enforces the key/team's route AND model permissions against + /// what's actually being requested — not just that the key exists. + async fn verify( + &self, + key: &str, + route: &str, + model: Option<&str>, + ) -> Result; }