יצירת וידאו Minimax
יצירת וידאו מתקדמת עם הבנת סצנות אינטליגנטית ותנועה טבעית. מודלים Hailuo ו-HailuoI2V זמינים לאיכות מעולה.
✓ יצירה ב-HD 1280x720
✓ סרטונים של 5 שניות
✓ הבנת סצנות חכמה
✓ תמיכה בתמונה-לווידאו
אימות זהות
כדי לגשת ל-Minimax/Hailuo באמצעות ה-API של Doitong, השתמשו במפתח ה-API שלכם. יש לכלול אותו ב-GraphQL mutation או ב-headers של ה-REST API.
// GraphQL Header
{
"Authorization": "Bearer YOUR_API_KEY"
}
// REST Header
"X-API-Key": "YOUR_API_KEY"
תחילת עבודה מהירה
מתחילים לעבוד עם Minimax / Hailuo-02 API תוך דקות ספורות. עקבו אחר הצעדים הפשוטים האלו כדי ליצור את ה-text to video הראשון שלכם.
שלב 1: קבלת מפתח API
הירשמו לחשבון Doitong ועברו ללוח הבקרה (Dashboard) כדי להנפיק מפתח API.
שלב 2: ביצוע הבקשה הראשונה
השתמשו באחת מדוגמאות הקוד להלן כדי לבצע את קריאת ה-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"
}
}
}
תמחור
Minimax / Hailuo-02 API פועל במודל תמחור מבוסס קרדיטים. צריכת הקרדיטים נקבעת לפי מורכבות התוכן ומשך הזמן שלו.
| תכונה | קרדיטים | תיאור |
|---|---|---|
| מצב סטנדרטי | 100-200 קרדיטים | וידאו של 5-10 שניות באיכות סטנדרטית |
| מצב פרו | 300-500 קרדיטים | וידאו של 5-10 שניות באיכות מקצועית |
נקודות קצה (Endpoints)
הגישה ל-Minimax / Hailuo-02 API מתבצעת דרך נקודת קצה מאוחדת של GraphQL.
נקודת קצה GraphQL
POST https://api.doitong.com/graphql
נקודת קצה REST
POST https://api.doitong.com/v1/text_to_video
פרמטרים
פרמטרים זמינים עבור בקשות Minimax / Hailuo-02 API:
| פרמטר | סוג | חובה | תיאור |
|---|---|---|---|
service |
String | Yes | מזהה שירות: "minimax" |
prompt |
String | Yes | תיאור טקסטואלי של מה שברצונכם ליצור |
duration |
Integer | No | משך הווידאו בשניות (ברירת מחדל: 5) |
aspectRatio |
String | No | יחס גובה-רוחב: "16:9", "9:16", "1:1" (ברירת מחדל: "16:9") |
version |
String | No | Model version: "hailuo-02" |
webhookUrl |
String | No | כתובת URL לקבלת התראות על סיום התהליך |
פורמט תגובה
כל התגובות מה-API מגיעות בפורמט אחיד:
תגובת הצלחה
{
"data": {
"generatevideo": {
"id": "abc123xyz",
"status": "processing",
"url": null,
"webhookUrl": "https://your-webhook.com/callback",
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
תגובת סיום
{
"data": {
"generatevideo": {
"id": "abc123xyz",
"status": "completed",
"url": "https://cdn.doitong.com/outputs/abc123xyz.mp4",
"duration": 5,
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
טיפול בשגיאות
ה-API משתמש בקודי סטטוס HTTP סטנדרטיים ומחזיר הודעות שגיאה מפורטות.
קודי שגיאה נפוצים
| קוד סטטוס | סוג שגיאה | תיאור |
|---|---|---|
| 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 |
פורמט תגובת שגיאה
{
"errors": [
{
"message": "Insufficient credits for this operation",
"extensions": {
"code": "INSUFFICIENT_CREDITS",
"creditsRequired": 100,
"creditsAvailable": 50
}
}
]
}
וובהוקס (Webhooks)
קבלו התראות בזמן אמת ברגע שתהליך היצירה של ה-text to video מסתיים.
הגדרת וובהוקס
Include a <code>webhookUrl</code> parameter in your request to receive a POST notification when processing is complete.
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
}
}
אבטחת וובהוק
כל בקשות הוובהוק כוללות header חתימה לצורכי אימות:
X-Doitong-Signature: sha256=abc123...
מגבלות קצב (Rate Limits)
כדי להבטיח שימוש הוגן ויציבות מערכת, חלות מגבלות הקצב הבאות:
| תוכנית | בקשות לדקה | תהליכים מקבילים | מכסה יומית |
|---|---|---|---|
| חינם | 10 | 1 | 100 |
| Starter | 30 | 3 | 1,000 |
| Pro | 60 | 10 | 10,000 |
| Enterprise | בהתאמה אישית | בהתאמה אישית | ללא הגבלה |
X-RateLimit-Limit: Maximum requests per windowX-RateLimit-Remaining: Requests remainingX-RateLimit-Reset: Window reset timestamp
המלצות ושיטות עבודה
1. אופטימיזציה של הפרומפטים
כתבו פרומפטים ברורים ומפורטים לקבלת התוצאות הטובות ביותר:
- Be specific about visual elements, style, and mood
- Include details about lighting, camera angles, and composition
- Avoid contradictory or impossible requests
2. ניהול עיבוד אסינכרוני
תהליך היצירה הוא אסינכרוני. מומלץ להטמיע מנגנון Polling או 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. התאוששות משגיאות
הטמיעו לוגיקת ניסיונות חוזרים (Retry) עם השהיה מעריכית (Exponential 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. מעקב אחר צריכת קרדיטים
עקבו אחר ניצול הקרדיטים שלכם כדי למנוע הפסקות בשירות:
- Check credit balance before large batch operations
- Set up alerts for low credit thresholds
- Implement credit-aware request queuing
מוכנים להתחיל?
הצטרפו לאלפי מפתחים שמשתמשים ב-Minimax / Hailuo-02 API כדי ליצור תוכן מדהים