Serverless FLUX.1-dev text-to-image generation with Redis caching, minus the cold start.
485
Serverless FLUX.1-dev text-to-image generation with Redis caching, minus the goldfish-memory cold start.
This repo turns FLUX.1-dev into a RunPod serverless template that keeps its brain on /workspace: Python venv, caches, and downloaded model assets survive worker churn instead of being painfully rediscovered on every boot.
Less boot drama. More actual inference.
The simplest way to get started is to pull a pre-built Docker image from Docker Hub and deploy it as a RunPod serverless endpoint.
Pre-built images include both the FLUX.1-dev handler and the model in diffusers format.
/workspace is persistent (optional but recommended).Active Workers = 0 unless you enjoy paying for idle GPUs.Hardware requirements: 12GB+ VRAM and 16GB+ free disk recommended. See Deployment Guide for details.
{
"input": {
"prompt": "A futuristic city at sunset, cinematic lighting",
"width": 1024,
"height": 1024,
"num_inference_steps": 50,
"guidance_scale": 3.5,
"seed": 42
}
}
{
"status": "success",
"image": "base64_encoded_png_data",
"metadata": {
"generation_time_sec": 12.5,
"seed": 42
},
"cached": false
}
The FLUX.1-dev model is included in the Docker image, so no preload is needed. Workspace persistence caches Python venv and other assets across worker restarts.
For the full list of environment variables, see Configuration Guide.
You can test the endpoint locally using docker-compose:
docker-compose up --build
curl -X POST http://localhost:8000/run \
-H "Content-Type: application/json" \
-d '{
"input": {
"prompt": "A futuristic city at sunset, cinematic lighting",
"width": 1024,
"height": 1024,
"num_inference_steps": 50,
"guidance_scale": 3.5,
"seed": 42
}
}'
{
"status": "success",
"image": "iVBORw0KGgoAAAANSUhEUgAA...<truncated base64 PNG data>...A5ElFTkSuQmCC",
"metadata": {
"generation_time_sec": 12.5,
"seed": 42
},
"cached": false
}
The image field contains a base64-encoded PNG image. Decode it to view or save the generated image:
echo "iVBORw0KGgoAAAANSUhEUgAA..." | base64 -d > output.png
Content type
Image
Digest
sha256:4c291aa16…
Size
6.9 GB
Last updated
5 months ago
docker pull notrius/runpod-fluxdev-serverless