Complete Workflow Tutorial
Learn how to combine multiple models to create complex AI generation workflows.
Overview
This tutorial shows how to chain multiple WaveSpeedAI models together to create a complete content generation workflow.
Example: Text → Image → Video → Digital Human
Create a talking head video from just a text description. Each submission returns a prediction ID, not the final media. Poll data.urls.get starting around every 2 seconds (and less often for long-running tasks) until the step reaches a terminal status before starting the dependent step.
- Generate a face image (Text-to-Image)
- Generate speech audio (Text-to-Speech)
- Animate with lip sync (Digital Human)
Step 1: Generate a Face Image
curl --fail-with-body --connect-timeout 10 --max-time 60 --request POST 'https://api.wavespeed.ai/api/v3/wavespeed-ai/z-image/turbo' \
--header "Content-Type: application/json" \
--header "Authorization: Bearer ${WAVESPEED_API_KEY}" \
--data-raw '{
"prompt": "Professional headshot of a young woman, neutral expression, studio lighting, white background, high quality",
"size": "1024*1024"
}'Poll the returned result URL. After the prediction is completed, save data.outputs[0] for step 3.
Step 2: Generate Speech Audio
curl --fail-with-body --connect-timeout 10 --max-time 60 --request POST 'https://api.wavespeed.ai/api/v3/minimax/speech-2.6-hd' \
--header "Content-Type: application/json" \
--header "Authorization: Bearer ${WAVESPEED_API_KEY}" \
--data-raw '{
"text": "Hello! Welcome to WaveSpeedAI. Let me show you how easy it is to create AI-generated content.",
"voice_id": "Friendly_Person",
"emotion": "happy",
"speed": 1
}'Poll the returned result URL. After the prediction is completed, save data.outputs[0] for step 3.
Step 3: Create Digital Human Video
Use the image and audio URLs from the previous steps:
curl --fail-with-body --connect-timeout 10 --max-time 60 --request POST 'https://api.wavespeed.ai/api/v3/wavespeed-ai/infinitetalk' \
--header "Content-Type: application/json" \
--header "Authorization: Bearer ${WAVESPEED_API_KEY}" \
--data-raw '{
"image": "https://...your-generated-face-image...",
"audio": "https://...your-generated-audio...",
"resolution": "480p",
"seed": -1
}'Poll the returned result URL. When the prediction is completed, the final video is in data.outputs[0].
Example: Character Animation
Make a person in an image follow movements from a reference video:
- Upload your image (the person to animate)
- Upload a reference video (the movements to follow)
- Generate the animated video
Step 1: Upload Files
Upload your image and reference video to get URLs.
Step 2: Generate Animation
curl --fail-with-body --connect-timeout 10 --max-time 60 --request POST 'https://api.wavespeed.ai/api/v3/wavespeed-ai/wan-2.2/animate' \
--header "Content-Type: application/json" \
--header "Authorization: Bearer ${WAVESPEED_API_KEY}" \
--data-raw '{
"image": "https://your-uploaded-image-url",
"video": "https://your-reference-video-url",
"mode": "replace",
"resolution": "480p",
"seed": -1
}'Poll the returned result URL before reading data.outputs[0]. The person in your image will replicate the movements and expressions from the reference video.
Example: Concurrent Image Generation
There is no dedicated batch-submission endpoint. To generate multiple images, make individual API calls concurrently within your account limits and track each returned prediction ID.
# Image 1
curl --fail-with-body --connect-timeout 10 --max-time 60 --request POST 'https://api.wavespeed.ai/api/v3/wavespeed-ai/z-image/turbo' \
--header "Content-Type: application/json" \
--header "Authorization: Bearer ${WAVESPEED_API_KEY}" \
--data-raw '{
"prompt": "A cinematic portrait on a city street",
"size": "1024*1024"
}'
# Image 2
curl --fail-with-body --connect-timeout 10 --max-time 60 --request POST 'https://api.wavespeed.ai/api/v3/wavespeed-ai/z-image/turbo' \
--header "Content-Type: application/json" \
--header "Authorization: Bearer ${WAVESPEED_API_KEY}" \
--data-raw '{
"prompt": "A cinematic portrait in a coffee shop",
"size": "1024*1024"
}'For character or style consistency with a compatible LoRA model, see LoRA Training & Usage and use that model’s documented schema.
Best Practices
Error Handling
- Check both the HTTP status and the response envelope’s
code,message, anddata.status - Retry idempotent result-query
GETrequests only for network errors,429, and5xx; honorRetry-After - Do not blindly retry submission
POSTrequests because an ambiguous disconnect can create a duplicate prediction - Start polling around 2 seconds and increase toward 5–10 seconds for long-running tasks
- Stop on
completed,failed,cancelled,timeout, or your own deadline - Use webhooks for long-running tasks
Cost Management
- Test with lower resolution first
- Use webhooks instead of polling for long tasks
- Monitor credit usage via API
Rate Limiting
- Add small delays between requests when making many calls
- Use webhooks to avoid polling overhead
- Batch similar operations when possible