Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /BerriAI_litellm /litellm /proxy /custom_auth_auto.py
| """ | |
| Example custom auth function. | |
| This will allow all keys starting with "my-custom-key" to pass through. | |
| """ | |
| from fastapi import Request | |
| from litellm.proxy._types import ProxyException, UserAPIKeyAuth | |
| async def user_api_key_auth(request: Request, api_key: str) -> UserAPIKeyAuth | str: | |
| try: | |
| if api_key.startswith("my-custom-key"): | |
| return "sk-P1zJMdsqCPNN54alZd_ETw" | |
| if api_key == "invalid-api-key": | |
| # raise a custom exception back to the client | |
| raise ProxyException( | |
| message="Invalid API key", | |
| type="invalid_request_error", | |
| param="api_key", | |
| code=401, | |
| ) | |
| else: | |
| raise Exception("Invalid API key") | |
| except Exception: | |
| raise Exception("Invalid API key") | |
Xet Storage Details
- Size:
- 817 Bytes
- Xet hash:
- c7b6ddc92975edab08180502e66f9d651d214690b8eccdffec9a4c9c09d9b6d5
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.