curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "flux-3-video",
"prompt": "An orange cat jumps onto a sunlit wooden table, its tail brushes a glass that wobbles but does not fall. Cinematic, shallow depth of field.",
"duration": 5,
"resolution": "hd",
"aspect_ratio": "16:9"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "flux-3-video",
"prompt": "An orange cat jumps onto a sunlit wooden table, its tail brushes a glass that wobbles but does not fall. Cinematic, shallow depth of field.",
"duration": 5,
"resolution": "hd",
"aspect_ratio": "16:9",
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/videos/generations";
const payload = {
model: "flux-3-video",
prompt: "An orange cat jumps onto a sunlit wooden table, its tail brushes a glass that wobbles but does not fall. Cinematic, shallow depth of field.",
duration: 5,
resolution: "hd",
aspect_ratio: "16:9",
};
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.apimart.ai/v1/videos/generations"
payload := map[string]interface{}{
"model": "flux-3-video",
"prompt": "An orange cat jumps onto a sunlit wooden table",
"duration": 5,
"resolution": "hd",
"aspect_ratio": "16:9",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ"
}
]
}
{
"error": {
"code": 400,
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Authentication failed, please check your API key",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Insufficient account balance, please top up and try again",
"type": "payment_required"
}
}
{
"error": {
"code": 422,
"message": "Parameter conflict or invalid value",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 429,
"message": "Too many requests, please try again later",
"type": "rate_limit_error"
}
}
FLUX 3 Video
Generación de vídeo FLUX 3
- Modo de procesamiento asíncrono, devuelve un ID de tarea para consultas posteriores
- Entrada unificada: texto a vídeo / imagen a vídeo / continuación de vídeo / borrador en dos pasos
- Salida H.264 + AAC con audio sincronizado, duración 5~20 segundos
- Resolución hd / fhd, siete proporciones de aspecto
POST
/
v1
/
videos
/
generations
curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "flux-3-video",
"prompt": "An orange cat jumps onto a sunlit wooden table, its tail brushes a glass that wobbles but does not fall. Cinematic, shallow depth of field.",
"duration": 5,
"resolution": "hd",
"aspect_ratio": "16:9"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "flux-3-video",
"prompt": "An orange cat jumps onto a sunlit wooden table, its tail brushes a glass that wobbles but does not fall. Cinematic, shallow depth of field.",
"duration": 5,
"resolution": "hd",
"aspect_ratio": "16:9",
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/videos/generations";
const payload = {
model: "flux-3-video",
prompt: "An orange cat jumps onto a sunlit wooden table, its tail brushes a glass that wobbles but does not fall. Cinematic, shallow depth of field.",
duration: 5,
resolution: "hd",
aspect_ratio: "16:9",
};
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.apimart.ai/v1/videos/generations"
payload := map[string]interface{}{
"model": "flux-3-video",
"prompt": "An orange cat jumps onto a sunlit wooden table",
"duration": 5,
"resolution": "hd",
"aspect_ratio": "16:9",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ"
}
]
}
{
"error": {
"code": 400,
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Authentication failed, please check your API key",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Insufficient account balance, please top up and try again",
"type": "payment_required"
}
}
{
"error": {
"code": 422,
"message": "Parameter conflict or invalid value",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 429,
"message": "Too many requests, please try again later",
"type": "rate_limit_error"
}
}
curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "flux-3-video",
"prompt": "An orange cat jumps onto a sunlit wooden table, its tail brushes a glass that wobbles but does not fall. Cinematic, shallow depth of field.",
"duration": 5,
"resolution": "hd",
"aspect_ratio": "16:9"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "flux-3-video",
"prompt": "An orange cat jumps onto a sunlit wooden table, its tail brushes a glass that wobbles but does not fall. Cinematic, shallow depth of field.",
"duration": 5,
"resolution": "hd",
"aspect_ratio": "16:9",
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/videos/generations";
const payload = {
model: "flux-3-video",
prompt: "An orange cat jumps onto a sunlit wooden table, its tail brushes a glass that wobbles but does not fall. Cinematic, shallow depth of field.",
duration: 5,
resolution: "hd",
aspect_ratio: "16:9",
};
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.apimart.ai/v1/videos/generations"
payload := map[string]interface{}{
"model": "flux-3-video",
"prompt": "An orange cat jumps onto a sunlit wooden table",
"duration": 5,
"resolution": "hd",
"aspect_ratio": "16:9",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ"
}
]
}
{
"error": {
"code": 400,
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Authentication failed, please check your API key",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Insufficient account balance, please top up and try again",
"type": "payment_required"
}
}
{
"error": {
"code": 422,
"message": "Parameter conflict or invalid value",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 429,
"message": "Too many requests, please try again later",
"type": "rate_limit_error"
}
}
Authorization
string
requerido
Todos los endpoints requieren autenticación mediante Bearer TokenObtenga su clave de API en la página de gestión de claves de API:
Authorization: Bearer YOUR_API_KEY
Modos de generación
flux-3-video es una entrada unificada: el modo se infiere de los campos, o se define explícitamente con mode.
| Modo | Disparador | Notas |
|---|---|---|
| Texto a vídeo (t2v) | solo prompt | Texto puro |
| Imagen a vídeo (i2v) | image_urls | Keyframes; ver abajo |
| Continuación de vídeo (v2v) | video_url / video_urls | Precio unitario más alto; si se definen imagen y vídeo, la continuación prevalece |
| Borrador → final | draft:true o draft_from_task_id | Vista previa económica, luego final a precio completo |
mode: t2v / i2v / v2v / draft_enhance, u ortografías oficiales text-to-video / image-continuation / video-continuation. mode explícito tiene la máxima prioridad.
Semántica de keyframes imagen a vídeo
El orden enimage_urls es semántico — no ordene ni elimine duplicados:
| Cantidad | Significado |
|---|---|
| 1 | Fotograma inicial |
| 2 | Primero = inicio, segundo = fotograma final |
| 3~10 | Primero = inicio, último = final, fotogramas intermedios espaciados uniformemente (defina duration explícitamente) |
Parámetros de la solicitud
string
requerido
Valor fijo:
flux-3-videoboolean
predeterminado:"false"
Indica si se debe moderar el contenido antes de enviar la tarea de vídeo.
true: revisar los prompts y las imágenes de entrada conomni-moderation-latestfalseu omitido: no enviar una solicitud de moderación, sin coste ni latencia de moderación adicionales (predeterminado)
string
requerido
Prompt. No debe enviarse al usar
draft_from_task_id (se rechaza si está presente).integer
predeterminado:"5"
Duración en segundos, entero 5~20, predeterminado
5duration: "auto" no se admite (la facturación necesita un recuento fijo de segundos). Omitido, "auto", o no enteros → se tratan como 5 segundos sin error y sin longitud adaptativa.En la continuación de vídeo, la duración entregada puede ser menor que la solicitada (p. ej. solicitar 5s, obtener 4s). Se cobran por adelantado los segundos solicitados y se reembolsa la diferencia al completar; el importe final es el
cost de la consulta. Texto/imagen a vídeo no muestran esta diferencia.string
predeterminado:"hd"
Resolución
hd(predeterminado; también acepta720p)fhd(también acepta1080p)
hd ~1280×704 en 16:9; fhd ~1920×1088.El modo borrador (
draft:true) solo permite hd.string
predeterminado:"auto"
Proporción de aspectoOpciones:
21:9, 2:1, 16:9, 4:3, 1:1, 3:4, 9:16, o auto (predeterminado; se elige automáticamente según el prompt y los assets)string[]
Keyframes imagen a vídeo, 1~10, URL http(s) pública o base64
string
Vídeo de entrada para continuación (mp4, URL pública o base64)
string[]
Igual que
video_url; usa el primer elemento (compat)boolean
predeterminado:"true"
Generar audio sincronizado, predeterminado
true. false produce vídeo silencioso (sin descuento)boolean
predeterminado:"false"
Modo borrador: vista previa de baja calidad a ~1/3 del precio; solo con
resolution: hdstring
Borrador → final: ID de su tarea de borrador exitosa
- Solo
resolutionpuede cambiar; prompt, duración, imágenes, vídeo no pueden - Se cobra al precio final completo; la tarifa del borrador no se acredita
- Mutuamente excluyente con
draft:true
integer
predeterminado:"2"
Tolerancia de moderación 0~4, predeterminado
2 (mayor = más permisivo)No confunda con imágenes FLUX.2 (05) o Kontext (06).
string
Modo explícito (opcional); ver Modos de generación
Modo borrador
Flujo de trabajo en dos pasos cuando iterar es costoso:Step 1 draft:true → ~1/3 price low-quality preview
Step 2 draft_from_task_id → full-price final matching the draft look
Crear borrador
{
"model": "flux-3-video",
"prompt": "An orange cat jumps onto a sunlit wooden table",
"duration": 5,
"draft": true
}
Borrador a final
{
"model": "flux-3-video",
"draft_from_task_id": "task_01K_DRAFT...",
"resolution": "fhd"
}
Ejemplos de solicitud
Texto a vídeo (retrato)
{
"model": "flux-3-video",
"prompt": "Rainy Tokyo street at night, neon in puddles, a person walks with an umbrella.",
"duration": 8,
"resolution": "fhd",
"aspect_ratio": "9:16"
}
Imagen a vídeo (inicio + fin)
{
"model": "flux-3-video",
"prompt": "Slow push-in as a flower opens from bud to bloom",
"image_urls": [
"https://example.com/bud.jpg",
"https://example.com/bloom.jpg"
],
"duration": 5
}
Continuación de vídeo
{
"model": "flux-3-video",
"prompt": "Camera keeps following as the lead turns toward a distant lighthouse",
"video_url": "https://example.com/clip.mp4",
"duration": 5
}
Vídeo silencioso
{
"model": "flux-3-video",
"prompt": "...",
"audio": false
}
Restricciones
| Límite | Valor |
|---|---|
| Duración | Entero 5~20 (auto no admitido; 21 se rechaza) |
| Keyframes | 1~10 |
| Resolución | solo hd / fhd; borrador solo hd |
| Proporción de aspecto | Siete opciones o auto |
safety_tolerance | 0~4 |
Errores comunes de envío (normalmente no se cobran)
| Caso | Notas |
|---|---|
Falta prompt | Obligatorio excepto draft enhance |
resolution / aspect_ratio / duration no válidos | Fuera de rango |
| Keyframes > 10 | Límite superado |
i2v explícito sin imágenes / v2v sin vídeo | Desajuste mode/asset |
draft:true + fhd | El borrador es solo hd |
draft_from_task_id no válido / no borrador / incompleto | Precondiciones de finalización |
| Cambiar prompt / duración al finalizar | Solo se permite resolution |
Ambos draft y draft_from_task_id | Mutuamente excluyentes |
failed con reembolso completo.
Cobertura de capacidades
| Capacidad | Estado |
|---|---|
| t2v / i2v / v2v | ✅ Auto o mode explícito |
| Borrador / draft enhance | ✅ draft / draft_from_task_id |
| Audio sincronizado | ✅ Activado por defecto; audio:false desactiva (sin descuento) |
Keyframes temporizados [seconds, image] | ❌ Solo array de keyframes espaciados uniformemente |
duration: "auto" | ❌ No admitido |
Response
integer
Código de estado; 200 en caso de éxito
array
Consultar resultadosLa generación de vídeo es asíncrona. Consulte Obtener el estado de la tarea.Intervalo recomendado 5~10 segundos; timeout del cliente 15 minutos (20s fhd es más lento). Medido ~60s para
t2v + hd + 5s.En caso de éxito use result.videos[0].url; los assets se reflejan en el CDN de la plataforma. cost es el cargo final. Los fallos se reembolsan por completo.