diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 8a4e12c80..e63083c93 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -1128,7 +1128,9 @@ async def generate_key_fn(request: Request, data: GenerateKeyRequest, Authorizat - user_id: (str) Unique user id - used for tracking spend across multiple keys for same user id. """ # data = await request.json() - data_json = data.model_dump() # type: ignore + print(f"type of object: {type(data)}") + data_json = json.loads(data.model_dump_json()) # type: ignore + print(f"data_json: {data_json}") response = await generate_key_helper_fn(**data_json) return GenerateKeyResponse(key=response["token"], expires=response["expires"], user_id=response["user_id"]) diff --git a/litellm/tests/test_proxy_server_keys.py b/litellm/tests/test_proxy_server_keys.py index 5ffbfe3b0..c5984ba13 100644 --- a/litellm/tests/test_proxy_server_keys.py +++ b/litellm/tests/test_proxy_server_keys.py @@ -25,7 +25,7 @@ from fastapi.testclient import TestClient from fastapi import FastAPI from litellm.proxy.proxy_server import router, save_worker_config, startup_event # Replace with the actual module where your FastAPI router is defined filepath = os.path.dirname(os.path.abspath(__file__)) -config_fp = f"{filepath}/test_configs/test_config.yaml" +config_fp = f"{filepath}/test_configs/test_config_custom_auth.yaml" save_worker_config(config=config_fp, model=None, alias=None, api_base=None, api_version=None, debug=False, temperature=None, max_tokens=None, request_timeout=600, max_budget=None, telemetry=False, drop_params=True, add_function_to_prompt=False, headers=None, save=False, use_queue=False) app = FastAPI() app.include_router(router) # Include your router in the test app