2025-11-28 11:03:52 +08:00
# Quickstart
This guide will help you quickly get started with vLLM-Omni to perform:
- Offline batched inference
- Online serving using OpenAI-compatible server
## Prerequisites
- OS: Linux
- Python: 3.12
## Installation
2025-12-24 12:51:19 +08:00
For installation on GPU from source:
2025-12-22 21:29:40 +08:00
```bash
uv venv --python 3.12 --seed
source .venv/bin/activate
2026-01-21 22:39:45 +08:00
# On CUDA
2026-08-27 14:12:55 +08:00
uv pip install vllm == 0.28.0 --torch-backend= auto
2026-01-21 22:39:45 +08:00
# On ROCm
2026-08-27 14:12:55 +08:00
uv pip install vllm == 0.28.0+rocm723 --extra-index-url https://wheels.vllm.ai/rocm/0.28.0/rocm723
2026-01-21 22:39:45 +08:00
2025-12-24 12:51:19 +08:00
git clone https://github.com/vllm-project/vllm-omni.git
cd vllm-omni
uv pip install -e .
2025-12-22 21:29:40 +08:00
```
2025-12-24 12:51:19 +08:00
2025-12-30 21:55:32 +08:00
For additional installation methods — please see the [installation guide ](installation/README.md ).
2025-11-28 11:03:52 +08:00
2026-04-30 06:00:21 -06:00
!!! note
It is important to install the same major & minor version of vLLM and vLLM Omni, otherwise things may not work as expected. If the versions are misaligned, you will see a warning when you import vLLM Omni.
2026-08-27 14:12:55 +08:00
If you are seeing strange behavior with the `vllm` command not handling the `--omni` flag correctly, you most likely have a version mismatch with vLLM < `0.28.0` and vLLM Omni `0.28.0` , as vLLM Omni no longer hijacks the vLLM entrypoint. Updating vLLM should resolve this issue.
2026-04-30 06:00:21 -06:00
2025-11-28 11:03:52 +08:00
## Offline Inference
2025-12-08 16:00:25 +08:00
Text-to-image generation quickstart with vLLM-Omni:
```python
from vllm_omni.entrypoints.omni import Omni
if __name__ == "__main__" :
omni = Omni ( model = "Tongyi-MAI/Z-Image-Turbo" )
prompt = "a cup of coffee on the table"
2025-12-31 09:46:44 +08:00
outputs = omni . generate ( prompt )
2026-08-15 07:07:28 +08:00
images = outputs [ 0 ] . images
2025-12-08 16:00:25 +08:00
images [ 0 ] . save ( "coffee.png" )
```
2026-06-30 00:09:19 +08:00
You can pass a list of prompts and wait for the independent requests to finish,
as shown below.
2026-01-28 16:07:42 +08:00
!!! info
2026-06-30 00:09:19 +08:00
For diffusion pipelines, each prompt becomes a separate logical request.
The runtime may automatically batch compatible in-flight requests through
the scheduler and runner.
2026-01-28 16:07:42 +08:00
```python
from vllm_omni.entrypoints.omni import Omni
if __name__ == "__main__" :
omni = Omni (
model = "Tongyi-MAI/Z-Image-Turbo" ,
2026-08-20 07:09:12 +08:00
# deploy_config="./deploy-config.yaml", # Optional deploy override
2026-01-28 16:07:42 +08:00
)
prompts = [
"a cup of coffee on a table" ,
"a toy dinosaur on a sandy beach" ,
"a fox waking up in bed and yawning" ,
]
omni_outputs = omni . generate ( prompts )
for i_prompt , prompt_output in enumerate ( omni_outputs ):
2026-08-15 07:07:28 +08:00
this_images = prompt_output . images
2026-01-28 16:07:42 +08:00
for i_image , image in enumerate ( this_images ):
image . save ( f "p { i_prompt } -img { i_image } .jpg" )
print ( "saved to" , f "p { i_prompt } -img { i_image } .jpg" )
# saved to p0-img0.jpg
# saved to p1-img0.jpg
# saved to p2-img0.jpg
```
!!! info
2026-08-05 22:41:18 +08:00
For diffusion request batching, step execution, and streaming controls, see
[Diffusion Execution Modes ](../user_guide/diffusion/execution_modes.md ).
2026-01-28 16:07:42 +08:00
2025-12-08 16:00:25 +08:00
For more usages, please refer to [offline inference ](../user_guide/examples/offline_inference/qwen2_5_omni.md )
2025-11-28 11:03:52 +08:00
2026-09-01 20:34:09 +08:00
## Online Serving with the API Server
2025-11-28 11:03:52 +08:00
2025-12-23 15:09:25 +08:00
Text-to-image generation quickstart with vLLM-Omni:
```bash
vllm serve Tongyi-MAI/Z-Image-Turbo --omni --port 8091
```
```bash
2026-09-01 20:34:09 +08:00
curl -s http://localhost:8091/v1/images/generations \
2025-12-23 15:09:25 +08:00
-H "Content-Type: application/json" \
-d '{
2026-09-01 20:34:09 +08:00
"prompt": "a cup of coffee on the table",
"size": "1024x1024",
"response_format": "b64_json",
"seed": 42
}' | jq -r '.data[0].b64_json' | base64 -d > coffee.png
2025-12-23 15:09:25 +08:00
```
2026-09-01 20:34:09 +08:00
See the [API Server guide ](../serving/README.md ) to choose an endpoint. For
model-specific details, refer to the [text-to-image online serving
example ](../user_guide/examples/online_serving/text_to_image.md ).