forked from phoenix/litellm-mirror
add auth for gemini_proxy_route
This commit is contained in:
parent
a517c27d3f
commit
cc161f1853
1 changed files with 4 additions and 2 deletions
|
@ -61,10 +61,12 @@ async def gemini_proxy_route(
|
||||||
fastapi_response: Response,
|
fastapi_response: Response,
|
||||||
):
|
):
|
||||||
## CHECK FOR LITELLM API KEY IN THE QUERY PARAMS - ?..key=LITELLM_API_KEY
|
## CHECK FOR LITELLM API KEY IN THE QUERY PARAMS - ?..key=LITELLM_API_KEY
|
||||||
api_key = request.query_params.get("key")
|
google_ai_studio_api_key = request.query_params.get("key") or request.headers.get(
|
||||||
|
"x-goog-api-key"
|
||||||
|
)
|
||||||
|
|
||||||
user_api_key_dict = await user_api_key_auth(
|
user_api_key_dict = await user_api_key_auth(
|
||||||
request=request, api_key="Bearer {}".format(api_key)
|
request=request, api_key=f"Bearer {google_ai_studio_api_key}"
|
||||||
)
|
)
|
||||||
|
|
||||||
base_target_url = "https://generativelanguage.googleapis.com"
|
base_target_url = "https://generativelanguage.googleapis.com"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue