[Frontend] update priority for --api-key and VLLM_API_KEY (#15588)

Signed-off-by: reidliu41 <reid201711@gmail.com>
Co-authored-by: reidliu41 <reid201711@gmail.com>
This commit is contained in:
Reid 2025-03-28 19:40:12 +08:00 committed by GitHub
parent 3bbaacbe15
commit fd5fd26902
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -818,7 +818,8 @@ def build_app(args: Namespace) -> FastAPI:
return JSONResponse(err.model_dump(),
status_code=HTTPStatus.BAD_REQUEST)
if token := envs.VLLM_API_KEY or args.api_key:
# Ensure --api-key option from CLI takes precedence over VLLM_API_KEY
if token := args.api_key or envs.VLLM_API_KEY:
@app.middleware("http")
async def authentication(request: Request, call_next):