واجهة FLUX 3 API
مرجع API كامل لنماذج FLUX 3 لإنشاء الفيديو. تستخدم جميع الإصدارات نقطة نهاية موحدة لمهام الفيديو.
إصدارات النموذج
مقارنة سريعة
تدعم النماذج الأربعة نسب العرض إلى الارتفاع التالية:
21:9, 2:1, 16:9, 4:3, 1:1, 3:4, 9:16
نقطة النهاية
POST /api/v1/video/task
المصادقة {#}
Authorization: Bearer YOUR_API_KEY
FLUX 3 Text to Video
معلمات الطلب
مطلوبة
اختيارية
مثال على الطلب
const response = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model_name: 'flux-3.0-text-to-video',
prompt: 'A cinematic aerial shot of a coastal city at sunrise',
resolution: '1080p',
aspect_ratio: '16:9',
duration: 10,
sound: true,
}),
});
const { data } = await response.json();
const taskId = data.task_id;
FLUX 3 Image to Video
معلمات الطلب
مطلوبة
اختيارية
مثال على الطلب
const response = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model_name: 'flux-3.0-image-to-video',
prompt: 'A gentle camera push forward with natural subject motion',
resolution: '1080p',
aspect_ratio: '16:9',
image_url: 'https://example.com/first-frame.jpg',
duration: 10,
sound: true,
}),
});
const { data } = await response.json();
const taskId = data.task_id;
FLUX 3 Start-End to Video
معلمات الطلب
مطلوبة
اختيارية
مثال على الطلب
const response = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model_name: 'flux-3.0-start-end-to-video',
prompt: 'Create a smooth cinematic transition with consistent lighting',
resolution: '720p',
aspect_ratio: '16:9',
image_url: 'https://example.com/start-frame.jpg',
image_end_url: 'https://example.com/end-frame.jpg',
duration: 8,
sound: true,
}),
});
const { data } = await response.json();
const taskId = data.task_id;
FLUX 3 Video Extend
يجب أن يكون الفيديو المُدخل بتنسيق MP4، وألا تتجاوز مدته 15 ثانية، وألا يتجاوز حجمه 50 ميغابايت.
معلمات الطلب
مطلوبة
اختيارية
مثال على الطلب
const response = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model_name: 'flux-3.0-video-extend',
prompt: 'Continue the scene as the subject walks toward the skyline',
resolution: '1080p',
aspect_ratio: '16:9',
video_url: 'https://example.com/source-video.mp4',
duration: 10,
sound: true,
}),
});
const { data } = await response.json();
const taskId = data.task_id;
تنسيق الاستجابة
الاستجابة الأولية
{
"code": 0,
"message": "success",
"data": {
"task_id": "{task_id}",
"response_url": "https://api.flaq.ai/api/v1/video/{task_id}",
"task_status": "submitted"
}
}
استجابة الاستقصاء
استقصِ GET /api/v1/video/{task_id} للتحقق من حالة المهمة:
{
"code": 0,
"message": "success",
"data": {
"task_id": "{task_id}",
"response_url": "https://api.flaq.ai/api/v1/video/{task_id}",
"task_status": "succeed",
"task_status_msg": null,
"task_result": {
"videos": [
{
"url": "https://example.com/generated-video.mp4"
}
]
}
}
}
قيم الحالة
submitted: تم قبول المهمة
processing: إنشاء الفيديو قيد التنفيذ
succeed: اكتمل إنشاء الفيديو بنجاح
failed: فشل إنشاء الفيديو
أفضل الممارسات
- نسبة العرض إلى الارتفاع: اختر النسبة المناسبة للقناة المستهدفة قبل إرسال المهمة.
- المدة: استخدم قيمة من 5 إلى 20 ثانية لكل إصدار.
- وسائط الإدخال: استخدم عناوين URL لصور يمكن الوصول إليها ومصدر MP4 يقع ضمن حدود امتداد الفيديو.
- الاستقصاء: استقصِ كل 5–10 ثوانٍ حتى تصبح قيمة
task_status إما succeed أو failed.