Skip to content

Commit 988d44e

Browse files
techpro-aimlapigitbook-bot
authored andcommitted
GITBOOK-723: docs: add video models minimax 2.3 and 2.3 fast
1 parent dcd3664 commit 988d44e

5 files changed

Lines changed: 586 additions & 2 deletions

File tree

docs/SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@
295295
* [video-01](api-references/video-models/MiniMax/video-01.md)
296296
* [video-01-live2d](api-references/video-models/MiniMax/video-01-live2d.md)
297297
* [hailuo-02](api-references/video-models/minimax/hailuo-02.md)
298+
* [hailuo-2.3](api-references/video-models/minimax/hailuo-2.3.md)
299+
* [hailuo-2.3-fast](api-references/video-models/minimax/hailuo-2.3-fast.md)
298300
* [OpenAI](api-references/video-models/openai/README.md)
299301
* [sora-2-t2v](api-references/video-models/openai/sora-2-t2v.md)
300302
* [sora-2-i2v](api-references/video-models/openai/sora-2-i2v.md)

docs/api-references/model-database.md

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/api-references/video-models/README.md

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
# hailuo-2.3-fast
2+
3+
{% columns %}
4+
{% column width="66.66666666666666%" %}
5+
{% hint style="info" %}
6+
This documentation is valid for the following list of our models:
7+
8+
* `minimax/hailuo-2.3-fast`
9+
{% endhint %}
10+
{% endcolumn %}
11+
12+
{% column width="33.33333333333334%" %}
13+
<a href="https://aimlapi.com/app/minimax/hailuo-2-3-fast" class="button primary">Try in Playground</a>
14+
{% endcolumn %}
15+
{% endcolumns %}
16+
17+
A fast version of the [hailuo-2.3](hailuo-2.3.md) model. Delivers more expressive motion and produces visuals that are both more realistic and stable and introduces major improvements in the depiction of physical actions, stylization, and subtle character expressions, while also further refining its responsiveness to motion commands.
18+
19+
## Setup your API Key
20+
21+
If you don’t have an API key for the AI/ML API yet, feel free to use our [Quickstart guide](https://docs.aimlapi.com/quickstart/setting-up).
22+
23+
## How to Make a Call
24+
25+
<details>
26+
27+
<summary>Step-by-Step Instructions</summary>
28+
29+
Generating a video using this model involves sequentially calling two endpoints:
30+
31+
* The first one is for creating and sending a video generation task to the server (returns a generation ID).
32+
* The second one is for requesting the generated video from the server using the generation ID received from the first endpoint.
33+
34+
Below, you can find both corresponding API schemas.
35+
36+
</details>
37+
38+
## API Schemas
39+
40+
### Create a video generation task and send it to the server
41+
42+
{% openapi-operation spec="hailuo-2-3-fast" path="/v2/video/generations" method="post" %}
43+
[OpenAPI hailuo-2-3-fast](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/video-models/MiniMax/hailuo-2.3-fast.json)
44+
{% endopenapi-operation %}
45+
46+
### Retrieve the generated video from the server
47+
48+
After sending a request for video generation, this task is added to the queue. This endpoint lets you check the status of a video generation task using its `generation_id`, obtained from the endpoint described above.\
49+
If the video generation task status is `complete`, the response will include the final result — with the generated video URL and additional metadata.
50+
51+
{% openapi-operation spec="universal-video-endpoint-fetch" path="/v2/video/generations" method="get" %}
52+
[OpenAPI universal-video-endpoint-fetch](https://raw.githubusercontent.com/aimlapi/api-docs/refs/heads/main/docs/api-references/video-models/ByteDance/omnihuman-pair.json)
53+
{% endopenapi-operation %}
54+
55+
## Code Example
56+
57+
The code below creates a video generation task, then automatically polls the server every **15** seconds until it finally receives the video URL.
58+
59+
{% tabs %}
60+
{% tab title="Python" %}
61+
{% code overflow="wrap" %}
62+
```python
63+
import requests
64+
import time
65+
66+
# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
67+
api_key = "<YOUR_AIMLAPI_KEY>"
68+
base_url = "https://api.aimlapi.com/v2"
69+
70+
# Creating and sending a video generation task to the server
71+
def generate_video():
72+
url = f"{base_url}/video/generations"
73+
headers = {
74+
"Authorization": f"Bearer {api_key}",
75+
}
76+
77+
data = {
78+
"model": "minimax/hailuo-2.3-fast",
79+
"prompt": "Mona Lisa puts on glasses with her hands.",
80+
"image_url": "https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/mona_lisa_extended.jpg",
81+
"duration": "5",
82+
}
83+
84+
response = requests.post(url, json=data, headers=headers)
85+
86+
if response.status_code >= 400:
87+
print(f"Error: {response.status_code} - {response.text}")
88+
else:
89+
response_data = response.json()
90+
return response_data
91+
92+
# Requesting the result of the task from the server using the generation_id
93+
def get_video(gen_id):
94+
url = f"{base_url}/video/generations"
95+
params = {
96+
"generation_id": gen_id,
97+
}
98+
99+
headers = {
100+
"Authorization": f"Bearer {api_key}",
101+
"Content-Type": "application/json"
102+
}
103+
104+
response = requests.get(url, params=params, headers=headers)
105+
return response.json()
106+
107+
108+
def main():
109+
# Running video generation and getting a task id
110+
gen_response = generate_video()
111+
print(gen_response)
112+
gen_id = gen_response.get("generation_id")
113+
print("Generation ID: ", gen_id)
114+
115+
# Try to retrieve the video from the server every 15 sec
116+
if gen_id:
117+
start_time = time.time()
118+
119+
timeout = 1000
120+
while time.time() - start_time < timeout:
121+
response_data = get_video(gen_id)
122+
123+
if response_data is None:
124+
print("Error: No response from API")
125+
break
126+
127+
status = response_data.get("status")
128+
129+
if status in ["waiting", "queued", "generating"]:
130+
print(f"Status: {status}. Checking again in 15 seconds.")
131+
time.sleep(15)
132+
else:
133+
print("Processing complete:\n", response_data)
134+
return response_data
135+
136+
print("Timeout reached. Stopping.")
137+
return None
138+
139+
140+
if __name__ == "__main__":
141+
main()
142+
```
143+
{% endcode %}
144+
{% endtab %}
145+
146+
{% tab title="JS" %}
147+
{% code overflow="wrap" %}
148+
```javascript
149+
const https = require("https");
150+
const { URL } = require("url");
151+
152+
// Replace <YOUR_AIMLAPI_KEY> with your actual AI/ML API key
153+
const apiKey = "<YOUR_AIMLAPI_KEY>";
154+
const baseUrl = "https://api.aimlapi.com/v2";
155+
156+
// Creating and sending a video generation task to the server
157+
function generateVideo(callback) {
158+
const data = JSON.stringify({
159+
model: "minimax/hailuo-2.3-fast",
160+
prompt: "Mona Lisa puts on glasses with her hands.",
161+
image_url: "https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/mona_lisa_extended.jpg",
162+
duration: "5",
163+
});
164+
165+
const url = new URL(`${baseUrl}/video/generations`);
166+
const options = {
167+
method: "POST",
168+
headers: {
169+
"Authorization": `Bearer ${apiKey}`,
170+
"Content-Type": "application/json",
171+
"Content-Length": Buffer.byteLength(data),
172+
},
173+
};
174+
175+
const req = https.request(url, options, (res) => {
176+
let body = "";
177+
res.on("data", (chunk) => body += chunk);
178+
res.on("end", () => {
179+
if (res.statusCode >= 400) {
180+
console.error(`Error: ${res.statusCode} - ${body}`);
181+
callback(null);
182+
} else {
183+
const parsed = JSON.parse(body);
184+
callback(parsed);
185+
}
186+
});
187+
});
188+
189+
req.on("error", (err) => console.error("Request error:", err));
190+
req.write(data);
191+
req.end();
192+
}
193+
194+
// Requesting the result of the task from the server using the generation_id
195+
function getVideo(genId, callback) {
196+
const url = new URL(`${baseUrl}/video/generations`);
197+
url.searchParams.append("generation_id", genId);
198+
199+
const options = {
200+
method: "GET",
201+
headers: {
202+
"Authorization": `Bearer ${apiKey}`,
203+
"Content-Type": "application/json",
204+
},
205+
};
206+
207+
const req = https.request(url, options, (res) => {
208+
let body = "";
209+
res.on("data", (chunk) => body += chunk);
210+
res.on("end", () => {
211+
const parsed = JSON.parse(body);
212+
callback(parsed);
213+
});
214+
});
215+
216+
req.on("error", (err) => console.error("Request error:", err));
217+
req.end();
218+
}
219+
220+
// Initiates video generation and checks the status every 15 seconds until completion or timeout
221+
function main() {
222+
generateVideo((genResponse) => {
223+
if (!genResponse || !genResponse.id) {
224+
console.error("No generation ID received.");
225+
return;
226+
}
227+
228+
const genId = genResponse.id;
229+
console.log("Generation ID:", genId);
230+
231+
const timeout = 1000 * 1000; // 1000 sec
232+
const interval = 15 * 1000; // 15 sec
233+
const startTime = Date.now();
234+
235+
const checkStatus = () => {
236+
if (Date.now() - startTime >= timeout) {
237+
console.log("Timeout reached. Stopping.");
238+
return;
239+
}
240+
241+
getVideo(genId, (responseData) => {
242+
if (!responseData) {
243+
console.error("Error: No response from API");
244+
return;
245+
}
246+
247+
const status = responseData.status;
248+
249+
if (["waiting", "queued", "generating"].includes(status)) {
250+
console.log(`Status: ${status}. Checking again in 15 seconds.`);
251+
setTimeout(checkStatus, interval);
252+
} else {
253+
console.log("Processing complete:\n", responseData);
254+
}
255+
});
256+
};
257+
checkStatus();
258+
})
259+
}
260+
261+
main();
262+
```
263+
{% endcode %}
264+
{% endtab %}
265+
{% endtabs %}
266+
267+
<details>
268+
269+
<summary>Response</summary>
270+
271+
{% code overflow="wrap" %}
272+
```json5
273+
{'generation_id': '349872201343396:minimax/hailuo-2.3-fast', 'status': 'queued', 'meta': {'usage': {'credits_used': 399000}}}
274+
Generation ID: 349872201343396:minimax/hailuo-2.3-fast
275+
Status: queued. Checking again in 15 seconds.
276+
Status: queued. Checking again in 15 seconds.
277+
Status: generating. Checking again in 15 seconds.
278+
Status: generating. Checking again in 15 seconds.
279+
Processing complete:
280+
{'id': '349872201343396:minimax/hailuo-2.3-fast', 'status': 'completed', 'video': {'url': 'https://cdn.aimlapi.com/whale/inference_output%2Fvideo%2F2025-12-29%2Faa7d5360-0ef6-4bcd-ac65-2cf6b906cb71%2Foutput.mp4?Expires=1767003365&OSSAccessKeyId=LTAI5tAmwsjSaaZVA6cEFAUu&Signature=NDBDXmVZr3QX5XOxReOH3n8pwLQ%3D'}}
281+
```
282+
{% endcode %}
283+
284+
</details>
285+
286+
**Processing time**: \~ 1 min 9 sec.
287+
288+
**Generated video** (1364x768, without sound):
289+
290+
{% embed url="https://drive.google.com/file/d/1u0QlCW2VeoSSFrjUq4gLYPNkcg6sKqxg/view" %}

0 commit comments

Comments
 (0)