Code samples
Production-ready snippets. Replace cw_live_... with your own API key from Dashboard → API Keys.
export CW_KEY="cw_live_..."
export CW_BASE="https://clipwave.ai"
curl "$CW_BASE/api/v1/models" -H "Authorization: Bearer $CW_KEY"
curl "$CW_BASE/api/v1/video/seedance-2/generate" \
-H "Authorization: Bearer $CW_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Total: 5s / 1 shot / 16:9\nShot 1: Slow dolly forward on a lone figure standing on a snowy mountain ridge at golden hour. Backlit; hard rim light catches their silhouette. Wind moves the parka hood.\nAudio: SFX wind howl, distant raven call. NO MUSIC.",
"duration_seconds": 5,
"aspect_ratio": "16:9",
"resolution": "720p",
"generate_audio": true
}'
curl "$CW_BASE/api/v1/video/seedance-2/generate" \
-H "Authorization: Bearer $CW_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Slow 360° orbit (counter-clockwise) on the watch on black surface. Hard key light from upper left. Audio: NO MUSIC, NO SFX, ambient room tone only.",
"image_url": "https://example.com/watch-photo.jpg",
"duration_seconds": 6,
"aspect_ratio": "1:1",
"resolution": "720p",
"generate_audio": false
}'
curl "$CW_BASE/api/v1/video/seedance-2/generate" \
-H "Authorization: Bearer $CW_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Quick TikTok hook of a sourdough loaf cracking open in slow motion, steam rising, against dark wooden table.",
"fast": true,
"duration_seconds": 5,
"aspect_ratio": "9:16"
}'
curl "$CW_BASE/api/v1/image/nano-banana/generate" \
-H "Authorization: Bearer $CW_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Editorial product photo of a brutalist concrete vase with a single dried branch, soft window light, marble surface",
"num_images": 2,
"aspect_ratio": "1:1"
}'
curl "$CW_BASE/api/v1/image/nano-banana/generate" \
-H "Authorization: Bearer $CW_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Place the watch from image 1 onto the marble surface from image 2 with the lighting from image 3",
"image_urls": [
"https://example.com/watch.jpg",
"https://example.com/marble.jpg",
"https://example.com/lighting-ref.jpg"
],
"aspect_ratio": "1:1"
}'
JOB_ID="ab12cdef"
while :; do
RESPONSE=$(curl -s "$CW_BASE/api/v1/jobs/$JOB_ID" -H "Authorization: Bearer $CW_KEY")
STATUS=$(echo "$RESPONSE" | jq -r .status)
echo "Status: $STATUS"
if [[ "$STATUS" == "completed" || "$STATUS" == "failed" ]]; then
echo "$RESPONSE" | jq
break
fi
sleep 5
done
curl -X DELETE "$CW_BASE/api/v1/jobs/ab12cdef" -H "Authorization: Bearer $CW_KEY"
RESPONSE=$(curl -s -w "\n%{http_code}" "$CW_BASE/api/v1/video/seedance-2/generate" \
-H "Authorization: Bearer $CW_KEY" \
-H "Content-Type: application/json" \
-d '{ "prompt": "test", "duration_seconds": 5 }')
HTTP_CODE=$(echo "$RESPONSE" | tail -n 1)
BODY=$(echo "$RESPONSE" | sed '$d')
if [[ "$HTTP_CODE" == "402" ]]; then
echo "Need more credits: $(echo "$BODY" | jq -r .credits_required)"
echo "Have: $(echo "$BODY" | jq -r .credits_remaining)"
exit 1
fi
echo "$BODY" | jq