Minimax Video Generation
Generazione video avanzata con comprensione intelligente della scena e movimento naturale. Modelli Hailuo e HailuoI2V disponibili per una qualità superiore.
✓ Generazione HD 1280x720
✓ Video di 5 secondi
✓ Comprensione intelligente della scena
✓ Supporto image-to-video
Autenticazione
Per accedere a Minimax/Hailuo tramite l'API di Doitong, usa la tua chiave API Doitong. Includila nella mutation GraphQL o negli header della REST API.
// GraphQL Header
{
"Authorization": "Bearer YOUR_API_KEY"
}
// REST Header
"X-API-Key": "YOUR_API_KEY"
Guida rapida
Inizia a usare Minimax / Hailuo-02 API in pochi minuti. Segui questi semplici passaggi per generare il tuo primo text to video.
Passaggio 1: Ottieni la tua chiave API
Registrati per un account Doitong e vai alla tua dashboard per generare una chiave API.
Passaggio 2: Effettua la tua prima richiesta
Usa uno degli esempi di codice qui sotto per effettuare la tua prima chiamata API.
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"
}
}
}
Prezzi
Minimax / Hailuo-02 API utilizza un modello di prezzo basato su crediti. I crediti vengono consumati in base alla complessità e alla durata del contenuto generato.
| Funzionalità | Crediti | Descrizione |
|---|---|---|
| Modalità Standard | 100-200 Crediti | Video di 5-10 secondi a qualità standard |
| Modalità Pro | 300-500 Crediti | Video di 5-10 secondi a qualità professionale |
Endpoint API
Minimax / Hailuo-02 API è disponibile tramite il nostro endpoint GraphQL unificato.
Endpoint GraphQL
POST https://api.doitong.com/graphql
Endpoint REST
POST https://api.doitong.com/v1/text_to_video
Parametri
Parametri disponibili per le richieste Minimax / Hailuo-02 API:
| Parametro | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
service |
Stringa | Yes | Identificatore del servizio: "minimax" |
prompt |
Stringa | Yes | Descrizione testuale di cosa generare |
duration |
Intero | No | Durata del video in secondi (predefinito: 5) |
aspectRatio |
Stringa | No | Rapporto d'aspetto: "16:9", "9:16", "1:1" (predefinito: "16:9") |
version |
Stringa | No | Model version: "hailuo-02" |
webhookUrl |
Stringa | No | URL per ricevere le notifiche di completamento |
Formato della risposta
Tutte le risposte API seguono un formato coerente:
Risposta di successo
{
"data": {
"generatevideo": {
"id": "abc123xyz",
"status": "processing",
"url": null,
"webhookUrl": "https://your-webhook.com/callback",
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
Risposta completata
{
"data": {
"generatevideo": {
"id": "abc123xyz",
"status": "completed",
"url": "https://cdn.doitong.com/outputs/abc123xyz.mp4",
"duration": 5,
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
Gestione degli errori
L'API utilizza codici di stato HTTP standard e restituisce messaggi di errore dettagliati.
Codici di errore comuni
| Codice di stato | Tipo di errore | Descrizione |
|---|---|---|
| 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 |
Formato risposta di errore
{
"errors": [
{
"message": "Insufficient credits for this operation",
"extensions": {
"code": "INSUFFICIENT_CREDITS",
"creditsRequired": 100,
"creditsAvailable": 50
}
}
]
}
Webhook
Ricevi notifiche in tempo reale quando la generazione di text to video è completata.
Configurazione dei Webhook
Include a <code>webhookUrl</code> parameter in your request to receive a POST notification when processing is complete.
Payload del Webhook
{
"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
}
}
Sicurezza dei Webhook
Tutte le richieste webhook includono un header di firma per la verifica:
X-Doitong-Signature: sha256=abc123...
Limiti di frequenza
Per garantire un utilizzo equo e la stabilità del sistema, si applicano i seguenti limiti di frequenza:
| Piano | Richieste/Minuto | Processi simultanei | Limite giornaliero |
|---|---|---|---|
| Gratis | 10 | 1 | 100 |
| Starter | 30 | 3 | 1,000 |
| Pro | 60 | 10 | 10,000 |
| Enterprise | Personalizzato | Personalizzato | Illimitato |
X-RateLimit-Limit: Maximum requests per windowX-RateLimit-Remaining: Requests remainingX-RateLimit-Reset: Window reset timestamp
Best practice
1. Ottimizza i tuoi prompt
Scrivi prompt chiari e descrittivi per ottenere i migliori risultati:
- Be specific about visual elements, style, and mood
- Include details about lighting, camera angles, and composition
- Avoid contradictory or impossible requests
2. Gestisci l'elaborazione asincrona
La generazione è asincrona. Implementa un sistema di polling o i webhook:
// 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. Recupero dagli errori
Implementa una logica di retry con backoff esponenziale:
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. Monitora l'uso dei crediti
Tieni traccia del consumo di crediti per evitare interruzioni:
- Check credit balance before large batch operations
- Set up alerts for low credit thresholds
- Implement credit-aware request queuing
Pronto per iniziare?
Unisciti a migliaia di sviluppatori che usano Minimax / Hailuo-02 API per creare contenuti incredibili