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
Geração de vídeo FLUX 3
- Modo de processamento assíncrono, retorna um ID de tarefa para consultas posteriores
- Entrada unificada: texto-para-vídeo / imagem-para-vídeo / continuação de vídeo / rascunho em duas etapas
- Saída H.264 + AAC com áudio sincronizado, duração 5~20 segundos
- Resolução hd / fhd, sete proporções
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
obrigatório
Todos os endpoints exigem autenticação por Bearer TokenObtenha sua chave de API na página de gerenciamento de chaves de API:
Authorization: Bearer YOUR_API_KEY
Modos de geração
flux-3-video é uma entrada unificada: o modo é inferido dos campos, ou definido explicitamente com mode.
| Modo | Gatilho | Notas |
|---|---|---|
| Texto-para-vídeo (t2v) | apenas prompt | Texto puro |
| Imagem-para-vídeo (i2v) | image_urls | Keyframes; veja abaixo |
| Continuação de vídeo (v2v) | video_url / video_urls | Preço unitário mais alto; se imagem e vídeo estiverem definidos, a continuação prevalece |
| Rascunho → final | draft:true ou draft_from_task_id | Prévia barata, depois final a preço cheio |
mode: t2v / i2v / v2v / draft_enhance, ou grafias oficiais text-to-video / image-continuation / video-continuation. mode explícito tem a maior prioridade.
Semântica de keyframes imagem-para-vídeo
A ordem emimage_urls é semântica — não ordene nem remova duplicatas:
| Contagem | Significado |
|---|---|
| 1 | Frame inicial |
| 2 | Primeiro = início, segundo = frame final |
| 3~10 | Primeiro = início, último = fim, frames do meio espaçados uniformemente (defina duration explicitamente) |
Parâmetros da requisição
string
obrigatório
Valor fixo:
flux-3-videoboolean
padrão:"false"
Define se o conteúdo deve ser moderado antes do envio da tarefa de vídeo.
true: verificar prompts e imagens de entrada comomni-moderation-latestfalseou omitido: não enviar solicitação de moderação, sem custo nem latência adicionais de moderação (padrão)
string
obrigatório
Prompt. Não deve ser enviado ao usar
draft_from_task_id (rejeitado se presente).integer
padrão:"5"
Duração em segundos, inteiro 5~20, padrão
5duration: "auto" não é suportado (a cobrança precisa de um número fixo de segundos). Omitido, "auto", ou não inteiros → tratados como 5 segundos sem erro e sem duração adaptativa.Na continuação de vídeo, a duração entregue pode ser menor que a solicitada (ex. solicitar 5s, obter 4s). Os segundos solicitados são pré-cobrados e a diferença é reembolsada após a conclusão; o valor final é o
cost da consulta. Texto/imagem-para-vídeo não apresentam essa diferença.string
padrão:"hd"
Resolução
hd(padrão; também aceita720p)fhd(também aceita1080p)
hd ~1280×704 em 16:9; fhd ~1920×1088.O modo rascunho (
draft:true) só permite hd.string
padrão:"auto"
ProporçãoOpções:
21:9, 2:1, 16:9, 4:3, 1:1, 3:4, 9:16, ou auto (padrão; escolhido automaticamente com base no prompt e nos assets)string[]
Keyframes imagem-para-vídeo, 1~10, URL http(s) pública ou base64
string
Vídeo de entrada para continuação (mp4, URL pública ou base64)
string[]
Igual a
video_url; usa o primeiro item (compat)boolean
padrão:"true"
Gerar áudio sincronizado, padrão
true. false gera vídeo silencioso (sem desconto)boolean
padrão:"false"
Modo rascunho: prévia de baixa qualidade a ~1/3 do preço; apenas com
resolution: hdstring
Rascunho → final: ID da sua tarefa de rascunho bem-sucedida
- Apenas
resolutionpode mudar; prompt, duração, imagens, vídeo não podem - Cobrado a preço final cheio; a taxa do rascunho não é creditada
- Mutualmente exclusivo com
draft:true
integer
padrão:"2"
Tolerância de moderação 0~4, padrão
2 (maior = mais permissivo)Não confunda com imagens FLUX.2 (05) ou Kontext (06).
string
Modo explícito (opcional); veja Modos de geração
Modo rascunho
Fluxo em duas etapas quando iterar é caro:Step 1 draft:true → ~1/3 price low-quality preview
Step 2 draft_from_task_id → full-price final matching the draft look
Criar rascunho
{
"model": "flux-3-video",
"prompt": "An orange cat jumps onto a sunlit wooden table",
"duration": 5,
"draft": true
}
Rascunho para final
{
"model": "flux-3-video",
"draft_from_task_id": "task_01K_DRAFT...",
"resolution": "fhd"
}
Exemplos de requisição
Texto-para-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"
}
Imagem-para-vídeo (início + fim)
{
"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
}
Continuação 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
}
Restrições
| Limite | Valor |
|---|---|
| Duração | Inteiro 5~20 (auto não suportado; 21 é rejeitado) |
| Keyframes | 1~10 |
| Resolução | apenas hd / fhd; rascunho apenas hd |
| Proporção | Sete opções ou auto |
safety_tolerance | 0~4 |
Erros comuns de envio (geralmente não cobrados)
| Caso | Notas |
|---|---|
prompt ausente | Obrigatório exceto draft enhance |
resolution / aspect_ratio / duration inválidos | Fora do intervalo |
| Keyframes > 10 | Limite excedido |
i2v explícito sem imagens / v2v sem vídeo | Incompatibilidade mode/asset |
draft:true + fhd | Rascunho é apenas hd |
draft_from_task_id inválido / não-rascunho / incompleto | Pré-condições de finalização |
| Alterar prompt / duração na finalização | Apenas resolution permitida |
draft e draft_from_task_id juntos | Mutualmente exclusivos |
failed com reembolso integral.
Cobertura de capacidades
| Capacidade | Status |
|---|---|
| t2v / i2v / v2v | ✅ Auto ou mode explícito |
| Rascunho / draft enhance | ✅ draft / draft_from_task_id |
| Áudio sincronizado | ✅ Ativado por padrão; audio:false desliga (sem desconto) |
Keyframes temporizados [seconds, image] | ❌ Apenas array de keyframes espaçados uniformemente |
duration: "auto" | ❌ Não suportado |
Response
integer
Código de status; 200 em caso de sucesso
array
Consultar resultadosA geração de vídeo é assíncrona. Consulte Obter status da tarefa.Intervalo recomendado 5~10 segundos; timeout do cliente 15 minutos (20s fhd é mais lento). Medido ~60s para
t2v + hd + 5s.Em caso de sucesso, use result.videos[0].url; os assets são espelhados no CDN da plataforma. cost é a cobrança final. Falhas são totalmente reembolsadas.