scripts/readme/full-2k-ref2va-h3-api-2k-in-open-platform-for-reference.sh
1.7 KB · 50 lines · bash Raw
1 #!/usr/bin/env bash
2 set -euo pipefail
3
4 # Create a 5-second 2K Ref2VA 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": "Character speaks: Follow the wind, live free. Leave worries behind, enjoy the moment. Voice timbre follows reference audio 1."
17 },
18 {
19 "type": "video_url",
20 "video_url": {
21 "url": "https://cdn.hailuoai.com/prod/hailuo_demo/testsets/h3_promo_eval_ref2va/gallery/sr_v2p26_trio_seed42_20260724/inputs/297573323635_00_%E8%A7%86%E9%A2%911_YnyRbxEwio_video_20260525_163755_1927e9d3.mp4"
22 },
23 "role": "reference_video"
24 },
25 {
26 "type": "audio_url",
27 "audio_url": {
28 "url": "https://cdn.hailuoai.com/prod/hailuo_demo/testsets/h3_promo_eval_ref2va/gallery/sr_v2p26_trio_seed42_20260724/inputs/f463d523c5ce_01_%E9%9F%B3%E9%A2%911_RSLcbpzJPo_6%E6%9C%885%E6%97%A5(1).mp3"
29 },
30 "role": "reference_audio"
31 }
32 ],
33 "resolution": "2K",
34 "duration": 5,
35 "ratio": "adaptive"
36 }' |
37 jq -er '.task_id'
38 )
39 # Query again while the task is queued or running.
40 generation_result=$(
41 curl --silent --show-error \
42 --request GET \
43 --url "$MINIMAX_API_BASE/v2/query/video_generation/$task_id" \
44 --header "Authorization: Bearer $TOKEN"
45 )
46 echo "$generation_result" | jq '{status: .task.status}'
47 # Download the 2K MP4 after the task succeeds.
48 video_url=$(echo "$generation_result" | jq -er '.task.content.url')
49 curl --location "$video_url" --output r2va_direct_2k.mp4
50