Inference

Turn 200 Text Prompts into Video Clips with Wan

Generate 200 clips from VBench prompts with Wan on a Serverless Endpoint backed by a preemptible VM. Set a GPU price cap, review clips alongside their prompts and seeds, and resume without regenerating saved clips.

Build it with an agent

Paste into Claude Code, Cursor, or any coding agent — it builds the recipe for you.

Use the runnable Wan cookbook at
https://github.com/nebius/serverless-ai-cookbook/tree/da7bb2d388c0b589af85a35a08d39aec9746c4be/inference/batch-video-generation

Check out da7bb2d388c0b589af85a35a08d39aec9746c4be and work from inference/batch-video-generation. Generate the 200-prompt VBench dataset with the bundled configuration and save it in results-vbench-200.

Read the README, run the offline tests and verify the bundled VBench input. Work in the existing recipe folder if there is one. Check results-vbench-200 before starting a GPU. If the input and settings match and scripts/check_results.py verifies all 200 clips, show me the gallery. For a partial batch, keep that folder, its pending request IDs and .state/.

For unfinished work, use my existing Nebius AI Cloud project and its region. Confirm the region offers Serverless AI and the project offers a compatible one-GPU preemptible configuration with a price cap. Use the GPU_PLATFORM and GPU_PRESET in my .env or help select a pair from my project’s offerings. Look for the project, subnet and policy IDs in the recipe’s .env and .state/endpoint.json. If an ID is missing, check the active project and its internet-enabled subnets. Ask me to choose only if the match is unclear. The public Wan model needs no Hugging Face token, bucket or SecretStash secret. The launcher handles Endpoint authentication. Never ask me to paste credentials or print raw Endpoint details.

Use the hourly GPU cap and total budget I approved for this batch. Ask only for what’s missing. Check the saved policy ID first. To find policies, use `nebius billing pricing-policy list --parent-id "$NEBIUS_PROJECT_ID" --all`. Reuse an active policy for my chosen project and GPU platform within my cap. Check its current regional rate. If its price blocks scheduling, tell me and wait for my decision. If none fits, ask before creating a policy or changing a cap.

Check the tracked Endpoint with scripts/endpoint.py status. If local state is missing, look in the selected project. Before using an Endpoint, confirm it belongs to this batch and matches the model, configuration and subnet. Check the attached policy ID in spec.pricing_model.spot_pricing_policy.id. The status line alone only confirms preemptibility. Ask which Endpoint to use if ownership or access is unclear. Wait for a starting Endpoint, reuse a running one, or start a stopped one within budget. Only create when there’s no match. Use the README’s dry run and pass --spot-pricing-policy-id on both create commands.

Wait for Model API ready, then run the keep-awake command in the same output folder. Ask before using --retry-lost for another paid request. If this batch’s Endpoint is still running after the last download or when abandoning the run, stop it and confirm STOPPED. Verify 200 MP4s with intact hashes and 49 decoded frames each. Show me the gallery, the new and reused counts, and any failures.

Recipe

Let’s generate 200 videos from VBench prompts so you can compare how Wan handles motion across eight types of scene. You’ll get an MP4 for each prompt, a gallery for side-by-side review, and a manifest with the seeds and settings to repeat the experiment.

A Nebius Serverless Endpoint runs Wan2.1-T2V-1.3B on a preemptible GPU. You set the most you’ll pay per GPU-hour. Your computer saves each finished clip, so you can resume if Nebius reclaims the GPU or your connection drops.

Fireworks unfolding above the skyline in a clip from the completed Wan batch

“fireworks display in the sky at night”, seed 24530229. Original 3-second MP4 · Frames from other clips

Source code · Powered by Nebius Serverless AI

1. Set up

To run this cookbook, you need a Nebius AI Cloud account and access to a project where you can run paid GPU workloads. Choose a region that offers Serverless AI and a compatible preemptible GPU with a price cap. Your project needs an internet-enabled subnet, room for a 500 GiB disk, and permission to create an Endpoint and use a pricing policy. Check regional availability.

On your Mac or Ubuntu machine, you need Git, Python 3.10+, the Nebius CLI 0.12.303+, and FFmpeg with ffprobe. The GPU runs on Nebius.

Install FFmpeg with brew install ffmpeg on macOS, or sudo apt-get update && sudo apt-get install -y ffmpeg on Ubuntu. Then get the recipe:

git clone https://github.com/nebius/serverless-ai-cookbook.git
cd serverless-ai-cookbook
git checkout --detach da7bb2d388c0b589af85a35a08d39aec9746c4be
cd inference/batch-video-generation

Use your existing CLI profile for that project (nebius profile activate PROFILE_NAME to switch). If this is your first sign-in, run nebius profile create and select the project.

Check the tools and the bundled prompts:

ffmpeg -version
ffprobe -version
python3 scripts/prepare_data.py --verify
python3 src/generate.py --check-input

Expect 200 prompts and 49 frames at 832×480. The pinned prompt selection and Apache 2.0 license are included. VBench supplies the prompts. This recipe does not calculate a benchmark score.

2. Start Wan with a price cap

If you’re resuming a partial batch, keep your existing .env, run source .env and pick up the interrupted batch.

For a first run, open the project selector in the Nebius console and choose ⋯ → Copy project ID. Replace YOUR_PROJECT_ID below with that ID to list your GPU options.

nebius compute platform list --parent-id YOUR_PROJECT_ID

Choose a platform marked allowed_for_preemptibles: true and a one-GPU preset. We ran Wan on an H100 in eu-north1 (gpu-h100-sxm, 1gpu-16vcpu-200gb). Where H200 is offered, the platform is gpu-h200-sxm with the same preset. We checked alternate launch settings offline. Platforms and presets.

In the console, open Billing → Pricing → Pricing policy. Use a policy for that project and GPU platform whose hourly cap fits your budget. If you need one, choose Create pricing policy and set your maximum price per GPU hour. The GPU can be scheduled only while its price is within your cap and capacity is available. Pricing policies

Find your subnet ID under Networking → Virtual Networks → Subnets. Add it to the file below with your project ID, policy ID and chosen GPU settings.

cat > .env <<'ENV'
export NEBIUS_PROJECT_ID="YOUR_PROJECT_ID"
export NEBIUS_SUBNET_ID="YOUR_SUBNET_ID"
export GPU_PLATFORM="YOUR_GPU_PLATFORM"
export GPU_PRESET="YOUR_ONE_GPU_PRESET"
export SPOT_PRICING_POLICY_ID="YOUR_POLICY_ID"
ENV
source .env

Wan runs with vLLM-Omni 0.24.0 and a 500 GiB temporary disk. Startup and idle time count toward the bill. For our H100 in eu-north1 on November 17–18, 2026, we were quoted $2.12–$2.42 an hour for GPU and disk combined. Check your own quote for the selected region and GPU. At those rates, allow a few dollars for a run with about an hour of generation plus startup. Longer interruptions can cost more while the Endpoint is running. Recorded rates and costs

Check the configuration, create the Endpoint and wait for Wan. On Ubuntu, replace caffeinate -i with systemd-inhibit --what=sleep --mode=block in every command.

python3 scripts/endpoint.py create \
  --project-id "$NEBIUS_PROJECT_ID" --subnet-id "$NEBIUS_SUBNET_ID" \
  --spot-pricing-policy-id "${SPOT_PRICING_POLICY_ID:?Set SPOT_PRICING_POLICY_ID}" \
  --name wan-video-dataset --dry-run &&
python3 scripts/endpoint.py create \
  --project-id "$NEBIUS_PROJECT_ID" --subnet-id "$NEBIUS_SUBNET_ID" \
  --spot-pricing-policy-id "${SPOT_PRICING_POLICY_ID:?Set SPOT_PRICING_POLICY_ID}" \
  --name wan-video-dataset --yes &&
caffeinate -i python3 scripts/endpoint.py wait --timeout 1800

Continue when you see Model API ready. In our November 17, 2026 run, the first clip was saved about seven minutes after we started creating the Endpoint. Allow extra time for account setup and available capacity. If the wait times out, stop the Endpoint while you diagnose it. If you open a new terminal, return to this folder and run source .env.

3. Generate 200 clips

Keep your computer awake and connected while it sends prompts and saves downloads. Leave the lid open if you’re using a laptop. For an unattended run, use a machine with persistent storage for the output folder.

caffeinate -i python3 scripts/endpoint.py run -- \
  python3 src/generate.py --input data/prompts.csv --output results-vbench-200

From an empty folder, expect Generated 200; reused 0. If you’re done generating, stop the Endpoint and review your clips now. If the batch stopped early, resume it in the same folder.

Allow about an hour of active generation. Clip timers averaged 16 seconds in the batch completed November 18, 2026. Wall time depends on startup and interruptions.

To use your own prompts before stopping Wan, supply a CSV with id,prompt,seed and a new output folder. Copy the custom-prompt example

What if your workload is interrupted?

Keep the same output folder. It holds each finished MP4, its completion record and the pending request IDs. Keep .state/ too, so the helper can find your Endpoint. Use the same prompts, seeds and model settings, with one client writing to the folder.

We finished the 200-clip batch across three runs on November 17–18, 2026. The last run reused 57 clips and generated the remaining 143. On November 20 we also stopped the Endpoint between two requests. After restart, the client kept the first clip and generated the second. Run records

  1. Run python3 scripts/endpoint.py status. If you attached a replacement Endpoint, check that its pricing policy matches SPOT_PRICING_POLICY_ID in your .env before starting it or sending requests. If it shows RUNNING, go straight to the generation command below. If it shows STOPPED, start the Endpoint and wait for Wan. If it already shows STARTING, run just the second command:

    python3 scripts/endpoint.py start --timeout 1800
    caffeinate -i python3 scripts/endpoint.py wait --timeout 1800
    

    The first command waits up to 30 minutes for RUNNING. The second checks that Wan can serve requests. If startup times out, check the Endpoint status before requesting another start.

  2. Rerun the original command. It skips verified downloads and checks the saved ID for the unfinished clip:

    caffeinate -i python3 scripts/endpoint.py run -- \
      python3 src/generate.py --input data/prompts.csv --output results-vbench-200
    
  3. If the client asks for --retry-lost, inspect the last request. Wan may have lost its ID, reported it failed or cancelled, or the original submission may be unconfirmed. If you replaced the Endpoint, confirm the old one is stopped. To authorize a new paid request for that unfinished clip, rerun in the same folder:

    caffeinate -i python3 scripts/endpoint.py run -- \
      python3 src/generate.py --input data/prompts.csv --output results-vbench-200 --retry-lost
    

Once the last download finishes, stop the Endpoint.

Try it yourself

To practice recovery during your first 200-clip run, use these commands in place of step 3. If you already completed the main run, repeating it in a fresh folder pays for another 200 clips. If the Endpoint is stopped, start it and wait for Wan first. This 20/180 split was tested locally with fixture videos.

caffeinate -i python3 scripts/endpoint.py run -- \
  python3 src/generate.py --input data/prompts.csv --output results-resume-test --limit 20

Wait for Generated 20; reused 0. Leave Wan running and remove the limit:

caffeinate -i python3 scripts/endpoint.py run -- \
  python3 src/generate.py --input data/prompts.csv --output results-resume-test

Expect Generated 180; reused 20. Your 200 clips are in results-resume-test.

4. Stop the Endpoint and review your clips

As soon as your last download finishes, stop the Endpoint. The checks and gallery run on your computer.

python3 scripts/endpoint.py stop
python3 scripts/endpoint.py status

Confirm STOPPED. Then check the saved videos. If you ran the 20/180 exercise, use results-resume-test in place of results-vbench-200 for the checker and gallery below.

python3 scripts/check_results.py results-vbench-200

On November 18, 2026, the checker verified the hashes and decoded all 200 clips from our Wan-AI/Wan2.1-T2V-1.3B-Diffusers run. Look for these fields:

{"completed": 200, "frames_per_clip": [49], "decode_passed": true}

Open results-vbench-200/index.html on your computer with open results-vbench-200/index.html on macOS or xdg-open results-vbench-200/index.html on Ubuntu. Play a clip beside its prompt and seed. Each MP4 is about three seconds long at 832×480 and 16 fps. The gallery should show 200 of 200 clips saved. You can use the MP4s and clips.csv directly in another workflow.