scripts/readme/full-2k-t2va-reference-768p-result-by-directly-calling-open-platform-api.sh
| 1 | #!/usr/bin/env bash |
| 2 | set -euo pipefail |
| 3 | |
| 4 | # Create a 10-second 768P video directly and capture its runtime task ID. |
| 5 | task_id=$( |
| 6 | curl --silent --show-error \ |
| 7 | --request POST \ |
| 8 | --url "$MINIMAX_API_BASE/v2/video_generation" \ |
| 9 | --header "Authorization: Bearer $TOKEN" \ |
| 10 | --header 'Content-Type: application/json' \ |
| 11 | --data '{ |
| 12 | "model": "MiniMax-H3", |
| 13 | "content": [ |
| 14 | { |
| 15 | "type": "text", |
| 16 | "text": "Epic space-opera theatrical teaser: a female captain stands alone before a massive observation window as the last fleet gathers and jumps away in a blinding flash, the bridge shaking, leaving her behind." |
| 17 | } |
| 18 | ], |
| 19 | "resolution": "768P", |
| 20 | "duration": 10, |
| 21 | "ratio": "16:9" |
| 22 | }' | |
| 23 | jq -er '.task_id' |
| 24 | ) |
| 25 | # Query again while the task is queued or running. |
| 26 | generation_result=$( |
| 27 | curl --silent --show-error \ |
| 28 | --request GET \ |
| 29 | --url "$MINIMAX_API_BASE/v2/query/video_generation/$task_id" \ |
| 30 | --header "Authorization: Bearer $TOKEN" |
| 31 | ) |
| 32 | echo "$generation_result" | jq '{status: .task.status}' |
| 33 | # Download the 768P MP4 after the task succeeds. |
| 34 | video_url=$(echo "$generation_result" | jq -er '.task.content.url') |
| 35 | curl --location "$video_url" --output h3_direct_768p.mp4 |
| 36 | |