Get Started
Integrate this model into your application with a few lines of code.
You need an API key to use this model.
Example request
A complete request you can copy and run in your language of choice.
# 1. Submit
SUBMIT=$(curl -sS --fail-with-body https://api.nunchux.ai/v1/google/v1beta/models/veo-3.1-generate-preview:predictLongRunning \
-H "Authorization: Bearer $NUNCHUX_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: YourApp/1.0" \
-d '{
"instances": [
{
"prompt": "A cinematic shot of a fox trotting through a snowy forest at dawn, soft light"
}
],
"parameters": {
"resolution": "1080p",
"durationSeconds": 8
}
}') || { echo "submit failed: $SUBMIT" >&2; exit 1; }
TASK=$(jq -er '.name' <<<"$SUBMIT") || { echo "no task id in: $SUBMIT" >&2; exit 1; }
# 2. Poll until done is true
DELAY=5
for _ in $(seq 1 60); do
RESP=$(curl -sS https://api.nunchux.ai/v1/google/v1beta/operations/$TASK \
-H "Authorization: Bearer $NUNCHUX_API_KEY" \
-H "User-Agent: YourApp/1.0")
[ "$(jq -r '.done // false' <<<"$RESP")" = "true" ] && break
sleep "$DELAY"; DELAY=$(( DELAY * 2 > 30 ? 30 : DELAY * 2 ))
done
[ "$(jq -r '.done // false' <<<"$RESP")" = "true" ] || { echo "timed out" >&2; exit 1; }
# 3. Check for failure
jq -e '.error' >/dev/null 2>&1 <<<"$RESP" && { echo "Veo failed: $(jq -c '.error' <<<"$RESP")" >&2; exit 1; }
# 4. Download
curl -sSL -o veo.mp4 "$(jq -r '.response.generateVideoResponse.generatedSamples[0].video.uri' <<<"$RESP")"