LTX 2.3 serverless worker for text2video and image2video docker image for runpod template
7.5K
Serverless LTX 2.3, minus the goldfish-memory cold start.
This repo turns ComfyUI + LTX 2.3 into a RunPod serverless template that keeps its brain on /workspace: Comfy install, Python venv, caches, and downloaded model assets survive worker churn instead of being painfully rediscovered on every boot.
Less boot drama. More actual inference.
/workspace bootstrap for ComfyUI, the venv, and caches.ComfyUI-LTXVideo nodes in the LTX image targets./workspace via network volume.<repo>:<version>-base<repo>:<version>-ltx2.3-distilled-cu128<repo>:<version>-ltx2.3-distilled-fp8-cu128<repo>:<version>-ltx2.3-distilled-cu130<repo>:<version>-base-cuda12.8.1<repo>:<version>-base-cuda13.0/run, /runsync, /health.video_ltx2_3_i2v_API.json.input.prompt, input.image_url, and input.api_key.LTX 2.3 is interesting. Rebuilding Comfy, reinstalling nodes, and redownloading weights on every serverless boot is not.
This repo optimizes the boring part:
/workspace| Target | Use Case |
|---|---|
base | Default clean CUDA 12.8 / cu128 base image |
ltx2-3-distilled | Default target for CUDA 12.8 deployments |
ltx2-3-distilled-fp8 | Lower VRAM pressure with the FP8 distilled checkpoint |
ltx2-3-distilled-cuda13 | Experimental CUDA 13 path for newer Blackwell-oriented stacks |
base-cuda12-8-1 | Explicit CUDA 12.8 base image alias for custom LTX builds |
base-cuda13-0 | Clean CUDA 13 base image for custom experimental builds |
docker build ... and bake target base now default to CUDA 12.8.1 with the cu128 PyTorch wheel index.cu130 wheels start at PyTorch 2.9+, so treat that lane accordingly.docker-bake.hcl./workspace is persistent.Active Workers = 0 unless you enjoy paying for idle GPUs.PERSIST_WORKSPACE=trueLTX23_PRELOAD_VARIANT=distilledLTX23_PRELOAD_UPSCALERS=trueHUGGINGFACE_ACCESS_TOKEN=<your_hf_read_token>Workflow > Export (API)./run or /runsync./workspace/worker-comfyui/.bootstrap.lock.For a sane first boot on RunPod serverless, use:
PERSIST_WORKSPACE=true
RUN_MODE=worker
COMFY_NODES=127.0.0.1:8188
LTX23_PRELOAD_VARIANT=distilled
LTX23_PRELOAD_UPSCALERS=true
HUGGINGFACE_ACCESS_TOKEN=hf_xxx
For a plain pod instead of a serverless worker:
PERSIST_WORKSPACE=true
RUN_MODE=pod
LOCAL_COMFY_NODE=127.0.0.1:8188
LTX23_PRELOAD_VARIANT=distilled
LTX23_PRELOAD_UPSCALERS=true
HUGGINGFACE_ACCESS_TOKEN=hf_xxx
This preloads the main LTX checkpoint plus the official latent upscalers and distilled LoRA into persistent storage. Some secondary assets, especially Gemma and text-encoder weights used by ComfyUI-LTXVideo, may still download on first render through Hugging Face cache. Because apparently one startup path was not enough.
The container now supports explicit runtime modes via RUN_MODE:
worker: default serverless worker behavior, starts ComfyUI, the frontend, and runpod.serverless.start(...)local-api: starts ComfyUI, the frontend, and the local RunPod-style API on port 8000pod: starts ComfyUI and the frontend only, without the serverless handlerIf RUN_MODE is unset, the image stays backward compatible:
SERVE_API_LOCALLY=true maps to RUN_MODE=local-apiRUN_MODE=workerThe worker accepts:
input.workflow: required ComfyUI API workflow JSONinput.images: optional list of base64-encoded input imagesinput.priority: optional queue hint, standard by default and vip for the legacy custom pathThe worker currently returns:
output.images[] when the workflow produces image outputsoutput.videos[] when the workflow produces video outputsArtifact entries look like this:
{
"filename": "LTX_2.3_i2v.mp4",
"type": "base64",
"data": "AAAAIGZ0eXBpc29tAAACAGlzb20uLi4=",
"media_type": "video/mp4"
}
If S3 is configured, type becomes url and data is a presigned URL.
curl -X POST \
-H "Authorization: Bearer <runpod_api_key>" \
-H "Content-Type: application/json" \
-d '{"input":{"workflow":{... your Comfy API workflow ...},"images":[{"name":"source.png","image":"data:image/png;base64,..." }]}}' \
https://api.runpod.ai/v2/<endpoint_id>/runsync
The checked-in frontend and the primary docs target the workflow contract above.
The worker still accepts the older compatibility payload below for existing clients:
{
"input": {
"api_key": "your-worker-secret",
"prompt": "your prompt",
"image_url": "https://example.com/source.png",
"priority": "standard"
}
}
Treat that mode as legacy. It exists so old callers do not explode on contact, not because it is the API you should build new things around.
| Variable | What It Does |
|---|---|
PERSIST_WORKSPACE | Persist ComfyUI, venv, caches, and downloaded assets on the network volume |
WORKSPACE_ROOT | Override the detected persistent root |
WORKSPACE_STATE_ROOT | Override where worker state lives inside the persistent root |
LTX23_PRELOAD_VARIANT | Preload distilled, dev, distilled-fp8, or dev-fp8 |
LTX23_PRELOAD_UPSCALERS | Also preload the official LTX latent upscalers and distilled LoRA |
HUGGINGFACE_ACCESS_TOKEN | Optional Hugging Face token for startup downloads |
INDRO_API_KEY | Secret expected only by the legacy custom prompt/image_url path |
REDIS_URL | Redis connection for queue telemetry, rate limiting, dedupe, and circuit breaker state |
COMFY_NODES | Comma-separated ComfyUI API hosts the worker can route jobs to |
LOCAL_COMFY_NODE | Local ComfyUI host used by the bundled frontend when RUN_MODE=pod |
COMFY_INPUT_DIR | Where uploaded workflow input files are staged before queueing |
COMFY_OUTPUT_DIR | Where generated Comfy artifacts are read back from |
AWS_BUCKET_NAME | Enable S3 upload mode for image and video outputs |
MAX_INLINE_VIDEO_MB | Max inline base64 video size before the worker forces S3 or errors |
CACHE_TTL_SECONDS | Deduped success-response cache retention |
The full list lives in docs/configuration.md.
/runpod-volume, but the worker normalizes on /workspace internally by creating /workspace -> /runpod-volume when needed./workspace/worker-comfyui./workspace/worker-comfyui/.bootstrap.lock so multiple workers do not try to initialize the same persisted venv at once./workspace/models/... via /comfyui/extra_model_paths.yaml. On serverless that is the same storage as /runpod-volume/models/..../comfyui/input and /comfyui/output by default.7777 unless LTX_FRONTEND_ENABLED=false.RUN_MODE=pod so the container does not launch the serverless handler./comfyui/user/default/ComfyUI-Manager/config.ini unless COMFYUI_MANAGER_CONFIG overrides it.ComfyUI-LTXVideo from Lightricks./comfyui/input and cleaned up after execution.test_input.json is legacy and not an LTX example.Content type
Image
Digest
sha256:956accfd1…
Size
10.7 GB
Last updated
6 months ago
docker pull notrius/ltx-23-serverless:dev2