[Refactor] P0.2: Migrate API server helpers out of api_server (#5453)

Signed-off-by: herotai214 <herotai214@gmail.com>
This commit is contained in:
herotai214 authored and GitHub committed 2026-09-10 15:03:21 +08:00
1 parent aff7d64948
commit bbac4df7d3
47 files changed
+2437 -1744

No files matched your search

@@ -1,11 +1,24 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
"""
Shared helper utilities for OpenAI-compatible image generation API.
Shared media utilities for OpenAI-compatible image APIs.
This module provides common helper functions for the image generation endpoint.
All functions work with plain Python types to maintain separation from the
FastAPI HTTP layer.
PUT HERE:
- Pure media helpers with no FastAPI Request / app-state / job semantics:
size parsing, image encode/base64, layered-layer validation.
DO NOT PUT HERE:
- ``/v1/images*`` request/engine/job helpers — those go in ``images.helpers``.
LONGEVITY:
- This root utils file is a **temporary shared home**.
- TODO(#5227, P1.2): tidy up / absorb into the images family (e.g. ``images/media.py``
or equivalent) in the P1.2 image modality PR; do not treat this file as the
long-term owner.
- ``images.helpers`` is the longer home for endpoint-specific logic through
P0.2/P0.3 until P1.2 further splits it.
See ``openai/README.md`` and ``images/README.md`` (utils vs helpers, no overlap).
"""
import base64