Coverage for .venv/lib/python3.13/site-packages/litellm/proxy/auth/model_access_denied.py: 67%

9 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-10 12:01 +0000

1from typing import Final 

2 

3from fastapi import HTTPException 

4 

5MODEL_ACCESS_DENIED_CLIENT_MESSAGE: Final = ( 

6 "The requested model '{model}' is not available for this API key, or the model name is invalid. " 

7 "Check the models available to you and try again." 

8) 

9 

10 

11def model_access_denied_client_message(model: str | list[str]) -> str: 

12 return MODEL_ACCESS_DENIED_CLIENT_MESSAGE.format(model=model) 

13 

14 

15class ModelAccessDeniedHTTPException(HTTPException): 

16 def __init__(self, internal_message: str, status_code: int, detail: str | dict[str, str]) -> None: 

17 super().__init__(status_code=status_code, detail=detail) 

18 self.internal_message: Final = internal_message