GPU Compute / Recipe
Image and video batch jobs
Run Diffusers, ComfyUI, or video synthesis pipelines as one-off GPU jobs. Billing stops automatically when the script exits — no persistent endpoint to manage.
npm install -g badgr-cli then badgr login. Setup guide →Batch image generation with Diffusers
Run a Python script that generates images from a list of prompts. Point Badgr at your project folder and it handles the rest:
badgr run . --cmd "python generate.py" --gpu L40S \ --env HF_TOKEN=$HF_TOKEN \ --env MODEL_ID=black-forest-labs/FLUX.1-schnell \ --max-cost 5
A typical generate.py using Diffusers:
import os, torch
from diffusers import FluxPipeline
pipe = FluxPipeline.from_pretrained(
os.environ["MODEL_ID"],
torch_dtype=torch.bfloat16,
).to("cuda")
prompts = [
"A sunset over mountain peaks",
"A futuristic city skyline, photorealistic",
"Abstract watercolor painting of a forest",
]
for i, prompt in enumerate(prompts):
image = pipe(prompt, num_inference_steps=4).images[0]
image.save(f"output_{i}.png")
print(f"Saved output_{i}.png")Custom image (escape hatch)
For pinned dependency combinations, bring your own container. Pass model config via --env:
badgr run \ --image ghcr.io/my-org/diffusers-runner:latest \ --gpu L40S \ --env MODEL_ID=black-forest-labs/FLUX.1-schnell \ --env OUTPUT_DIR=/app/outputs \ --max-cost 5
ComfyUI workflow (CLI)
Use badgr comfyui run to launch ComfyUI with a workflow file — no image or container config needed:
badgr comfyui run workflow.json \ --gpu A100 \ --max-cost 5.00
Badgr auto-detects ComfyUI images, health-checks /system_stats (up to 10 min), and returns the endpoint URL. Use --persistent to keep it running after the workflow completes.
ComfyUI batch (REST API)
Use the comfy.batch job type to send up to 20 prompts through ComfyUI in a single API call. Badgr provisions the GPU, waits for ComfyUI to be ready, runs the batch, downloads the images, and tears down the GPU. Currently supports workflow_id: "sdxl-basic" (SDXL 1.0, 1024×1024).
curl https://aibadgr.com/v1/jobs \
-H "Authorization: Bearer $BADGR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "comfy.batch",
"input": {
"workflow_id": "sdxl-basic",
"prompts": [
"a red fox in a snowy forest, photorealistic",
"a futuristic city at sunset, digital art",
"an astronaut riding a horse on the moon"
]
},
"policy": { "max_cost": 3 }
}'Poll GET /v1/jobs/{job_id} until status === "completed". The output contains image_urls — download each with:
curl https://aibadgr.com/v1/jobs/$JOB_ID/images/0 \ -H "Authorization: Bearer $BADGR_API_KEY" \ -o image_0.png
Video synthesis
Run a video generation script — for example with CogVideoX or Wan:
badgr run . --cmd "python generate_video.py" --gpu H100 \ --env HF_TOKEN=$HF_TOKEN \ --env PROMPT="A time-lapse of a blooming flower" \ --max-cost 10
Use the H100 for video models that require large VRAM. Billing stops when the script exits.
Detach and collect outputs later
Use --detach for long-running jobs — badgr returns the job ID immediately:
# Launch and return immediately badgr run . --cmd "python generate.py" --gpu L40S --env HF_TOKEN=$HF_TOKEN --max-cost 5 --detach # Follow logs when ready badgr logs <deployment-id>
Options
--gpu <type>L40S or A100 for images; H100 for large video models--cmd <command>Command to run inside the uploaded project folder.--image <ref>Custom container image — bypasses the runner. Use for unusual dependencies.--env KEY=VALUESet environment variables — repeatable--detachReturn job ID immediately, don't stream logs--max-runtime <min>Auto-stop after N minutes (recommended to cap spend)--max-cost <$>Auto-stop when spend reaches this amountNext steps