UX: add vLLM env info in '/server_info' (#31899)

Signed-off-by: Jee Jee Li <pandaleefree@gmail.com>
This commit is contained in:
Jee Jee Li
2026-01-08 01:13:02 +08:00
committed by GitHub
parent b89443b8d9
commit 30399cc725

View File

@@ -19,6 +19,19 @@ router = APIRouter()
PydanticVllmConfig = pydantic.TypeAdapter(VllmConfig)
def _get_vllm_env_vars():
from vllm.config.utils import normalize_value
vllm_envs = {}
for key in dir(envs):
if key.startswith("VLLM_") and "KEY" not in key:
value = getattr(envs, key, None)
if value is not None:
value = normalize_value(value)
vllm_envs[key] = value
return vllm_envs
@router.get("/server_info")
async def show_server_info(
raw_request: Request,
@@ -26,10 +39,13 @@ async def show_server_info(
):
vllm_config: VllmConfig = raw_request.app.state.vllm_config
server_info = {
"vllm_config": str(vllm_config)
if config_format == "text"
else PydanticVllmConfig.dump_python(vllm_config, mode="json", fallback=str)
"vllm_config": (
str(vllm_config)
if config_format == "text"
else PydanticVllmConfig.dump_python(vllm_config, mode="json", fallback=str)
),
# fallback=str is needed to handle e.g. torch.dtype
"vllm_env": _get_vllm_env_vars(),
}
return JSONResponse(content=server_info)