Minimax Videogeneréierung
Fortgeschratt Videogeneréierung mat intelligentem Szeneverständnis an natierleche Beweegungen. Hailuo an HailuoI2V Modeller fir exzellent Qualitéit.
✓ 1280x720 HD Generéierung
✓ 5-Sekonne Videoen
✓ Intelligent Szeneverständnis
✓ Bild-zu-Video Support
Authentifizéierung
Fir op Minimax/Hailuo iwwer d'Doitong API zouzegräifen, benotzt Ären Doitong API-Schlëssel. Füügt dësen an d'GraphQL Mutation oder an d'REST API Headers bäi.
// GraphQL Header
{
"Authorization": "Bearer YOUR_API_KEY"
}
// REST Header
"X-API-Key": "YOUR_API_KEY"
Schnellstart
Fänkt mat Minimax / Hailuo-02 API an nëmmen e puer Minutten un. Follegt dës einfach Schrëtt fir Är éischt text to video ze generéieren.
Schrëtt 1: Kritt Ären API-Schlëssel
Mellt Iech fir en Doitong-Kont un a gitt op Ären Dashboard fir en API-Schlëssel ze generéieren.
Schrëtt 2: Maacht Är éischt Ufro
Benotzt ee vun de Code-Beispiller hei drënner fir Är éischt API-Ufro ze maachen.
curl -X POST https://api.doitong.com/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: unique-request-id-123" \
-d '{
"query": "mutation Generate($input: GenerateInput!) { generate(input: $input) { id status type provider url metadata creditCost } }",
"variables": {
"input": {
"type": "VIDEO",
"provider": "minimax",
"input": {
"text": "A serene landscape with mountains and a lake at sunset"
},
"options": {
"duration": 5,
"aspectRatio": "16:9"
}
}
}
}'
const response = await fetch('https://api.doitong.com/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY',
'Idempotency-Key': 'unique-request-id-123'
},
body: JSON.stringify({
query: `
mutation Generate($input: GenerateInput!) {
generate(input: $input) {
id
status
type
provider
url
metadata
creditCost
}
}
`,
variables: {
input: {
type: 'VIDEO',
provider: 'minimax',
input: {
text: 'A serene landscape with mountains and a lake at sunset'
},
options: {
duration: 5,
aspectRatio: '16:9'
}
}
}
})
});
const data = await response.json();
console.log('Result:', data.data.generate);
import requests
import json
url = "https://api.doitong.com/graphql"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
}
query = """
mutation Generate($input: GenerateInput!) {
generate(input: $input) {
id
status
type
provider
url
metadata
creditCost
}
}
"""
variables = {
"input": {
"type": "VIDEO",
"provider": "minimax",
"input": {
"text": "A serene landscape with mountains and a lake at sunset"
},
"options": {
"duration": 5,
"aspectRatio": "16:9"
}
}
}
response = requests.post(url, json={
"query": query,
"variables": variables
}, headers=headers)
data = response.json()
print("Result:", data["data"]["generate"])
mutation Generate($input: GenerateInput!) {
generate(input: $input) {
id
status
type
provider
url
metadata
creditCost
createdAt
}
}
# Variables
{
"input": {
"type": "VIDEO",
"provider": "minimax",
"input": {
"text": "A serene landscape with mountains and a lake at sunset"
},
"options": {
"duration": 5,
"aspectRatio": "16:9",
"version": "hailuo-02",
"quality": "high"
}
}
}
Präisser
Minimax / Hailuo-02 API benotzt e Credit-baséierte Präismodell. Credits ginn ofhängeg vun der Komplexitéit an der Dauer vum generéierten Inhalt ofgerechent.
| Funktioun | Credits | Beschreiwung |
|---|---|---|
| Standard-Modus | 100-200 Credits | 5-10 Sekonne Video a Standardqualitéit |
| Pro-Modus | 300-500 Credits | 5-10 Sekonne Video a Profi-Qualitéit |
API-Endpunkten
Minimax / Hailuo-02 API ass iwwer eisen eenheetleche GraphQL-Endpunkt verfügbar.
GraphQL-Endpunkt
POST https://api.doitong.com/graphql
REST-Endpunkt
POST https://api.doitong.com/v1/text_to_video
Parameteren
Verfügbar Parameter fir Minimax / Hailuo-02 API Ufroen:
| Parameter | Typ | Obligatoresch | Beschreiwung |
|---|---|---|---|
service |
String | Yes | Service-Identifikateur: "minimax" |
prompt |
String | Yes | Textbeschreiwung vun deem, wat generéiert soll ginn |
duration |
Integer | No | Videodauer a Sekonnen (Standard: 5) |
aspectRatio |
String | No | Säiteverhältnis: "16:9", "9:16", "1:1" (Standard: "16:9") |
version |
String | No | Model version: "hailuo-02" |
webhookUrl |
String | No | URL fir Notifikatiounen iwwer d'Fäerdegstellung ze kréien |
Äntwert-Format
All API-Äntwerte folgen engem eenheetleche Format:
Erfollegräich Äntwert
{
"data": {
"generatevideo": {
"id": "abc123xyz",
"status": "processing",
"url": null,
"webhookUrl": "https://your-webhook.com/callback",
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
Ofgeschloss Äntwert
{
"data": {
"generatevideo": {
"id": "abc123xyz",
"status": "completed",
"url": "https://cdn.doitong.com/outputs/abc123xyz.mp4",
"duration": 5,
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
Feelerbehandlung
D'API benotzt Standard-HTTP-Statuscoden a liwwert detailléiert Fehlermeldungen.
Gängeg Fehlercoden
| Statuscode | Fealertyp | Beschreiwung |
|---|---|---|
| 400 | Bad Request | Invalid parameters or malformed request |
| 401 | Unauthorized | Missing or invalid API key |
| 402 | Payment Required | Insufficient credits |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Server error, please retry |
Feeler-Äntwert-Format
{
"errors": [
{
"message": "Insufficient credits for this operation",
"extensions": {
"code": "INSUFFICIENT_CREDITS",
"creditsRequired": 100,
"creditsAvailable": 50
}
}
]
}
Webhooks
Kritt Echtzäit-Notifikatiounen, wann d'Generéierung vun Ärer text to video fäerdeg ass.
Webhooks ariichten
Include a <code>webhookUrl</code> parameter in your request to receive a POST notification when processing is complete.
Webhook-Payload
{
"id": "abc123xyz",
"status": "completed",
"url": "https://cdn.doitong.com/outputs/abc123xyz.mp4",
"service": "minimax",
"createdAt": "2024-01-01T00:00:00Z",
"completedAt": "2024-01-01T00:01:00Z",
"metadata": {
"duration": 5,
"width": 1920,
"height": 1080
}
}
Webhook-Sécherheet
All Webhook-Ufroe enthalen e Signature-Header fir d'Verifikatioun:
X-Doitong-Signature: sha256=abc123...
Rate Limits
Fir eng fair Notzung an d'Systemstabilitéit ze garantéieren, gëllen dës Limitten:
| Plang | Ufroen/Minutt | Gläichzäiteg Jobs | Dageslimit |
|---|---|---|---|
| Gratis | 10 | 1 | 100 |
| Starter | 30 | 3 | 1,000 |
| Pro | 60 | 10 | 10,000 |
| Enterprise | Individuell | Individuell | Onlimitéiert |
X-RateLimit-Limit: Maximum requests per windowX-RateLimit-Remaining: Requests remainingX-RateLimit-Reset: Window reset timestamp
Best Practices
1. Optimiséiert Är Prompts
Schreift kloer an detailléiert Prompts fir déi bescht Resultater:
- Be specific about visual elements, style, and mood
- Include details about lighting, camera angles, and composition
- Avoid contradictory or impossible requests
2. Asynchron Veraarbechtung handhaben
D'Generéierung ass asynchron. Implementéiert e richtegt Polling oder Webhooks:
// Polling example
async function pollStatus(jobId) {
let status = 'processing';
while (status === 'processing') {
await sleep(2000); // Wait 2 seconds
const result = await checkJobStatus(jobId);
status = result.status;
}
return result;
}
3. Feelerbehandlung
Implementéiert eng Retry-Logik mat exponentiellem Backoff:
async function retryWithBackoff(fn, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await fn();
} catch (error) {
if (i === maxRetries - 1) throw error;
await sleep(Math.pow(2, i) * 1000);
}
}
}
4. Credit-Verbrauch iwwerwaachen
Verfollegt Äre Credit-Verbrauch fir Ënnerbriechungen ze vermeiden:
- Check credit balance before large batch operations
- Set up alerts for low credit thresholds
- Implement credit-aware request queuing
Bereet fir unzefänken?
Schléisst Iech Dausende vun Entwéckler un, déi Minimax / Hailuo-02 API benotze fir super Inhalter ze erstellen