curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gemini-omni-1.1-flash-ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "gemini-omni-1.1-flash-ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16"
}
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: "gemini-omni-1.1-flash-ext",
prompt: "a girl is dancing happily in a sunny garden",
duration: 10,
resolution: "1080p",
aspect_ratio: "9:16"
};
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": "gemini-omni-1.1-flash-ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16",
}
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_01KS1H7ZYSJWH1N779S2FSHTKA"
}
]
}
{
"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 recharge and try again",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "Too many requests. Please try again later",
"type": "rate_limit_error"
}
}
gemini-omni-1.1-flash-ext
Generación de video gemini-omni-1.1-flash-ext
- Modelo unificado de generación de video gemini-omni-1.1-flash-ext
- Admite Text-to-Video, Image-to-Video con una sola imagen, video de referencia y fusión con 3 imágenes de referencia
- Admite resolución 720p/1080p/4k y duración de 4/6/8/10 segundos
- API de tareas asíncronas. Primero envíe una tarea y luego consulte el resultado mediante el ID de la tarea
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": "gemini-omni-1.1-flash-ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "gemini-omni-1.1-flash-ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16"
}
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: "gemini-omni-1.1-flash-ext",
prompt: "a girl is dancing happily in a sunny garden",
duration: 10,
resolution: "1080p",
aspect_ratio: "9:16"
};
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": "gemini-omni-1.1-flash-ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16",
}
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_01KS1H7ZYSJWH1N779S2FSHTKA"
}
]
}
{
"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 recharge and try again",
"type": "payment_required"
}
}
{
"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": "gemini-omni-1.1-flash-ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "gemini-omni-1.1-flash-ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16"
}
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: "gemini-omni-1.1-flash-ext",
prompt: "a girl is dancing happily in a sunny garden",
duration: 10,
resolution: "1080p",
aspect_ratio: "9:16"
};
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": "gemini-omni-1.1-flash-ext",
"prompt": "a girl is dancing happily in a sunny garden",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16",
}
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_01KS1H7ZYSJWH1N779S2FSHTKA"
}
]
}
{
"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 recharge and try again",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "Too many requests. Please try again later",
"type": "rate_limit_error"
}
}
Autenticación
string
requerido
Todas las solicitudes requieren autenticación mediante Bearer Token.Obtener una API key:Visite la página de gestión de API Keys para obtener su API key.Añada el siguiente encabezado al realizar solicitudes:
Authorization: Bearer YOUR_API_KEY
Parámetros de la solicitud
string
requerido
Nombre del modelo de generación de video. Debe ser
gemini-omni-1.1-flash-ext.boolean
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
Descripción del contenido del video. Recomendamos describir en detalle la escena, el sujeto, la acción, el entorno, los movimientos de cámara, el estilo visual y las indicaciones de audio.Ejemplo:
"a girl is dancing happily in a sunny garden"integer
predeterminado:"6"
Duración del video en segundos.Valores compatibles:
4, 6, 8, 10.Otros valores como
5 o 7 devolverán un error invalid_duration.No envíe
duration al subir un video de referencia. duration y video_urls no se pueden enviar al mismo tiempo.string
predeterminado:"720p"
Resolución del video. Los valores no distinguen entre mayúsculas y minúsculas.Valores compatibles:
360p720p1080p4k
Otras resoluciones devolverán un error
invalid_resolution.string
predeterminado:"16:9"
Relación de aspecto del video. Úselo para controlar la salida horizontal o vertical.Valores comunes:
16:9- horizontal9:16- vertical
16:9string
Campo de compatibilidad. Tiene el mismo significado que
aspect_ratio. Si se proporcionan ambos, manténgalos coherentes.string
Tipo de generación, usado para especificar cómo se utilizan las imágenes.Opciones:
frame- Modo de primer frame.image_urlssolo puede contener 1 imagen, usada como el primer frame del vídeo.reference- Modo de referencia.image_urlspuede contener 1 o 3 imágenes, usadas como imágenes de referencia.
Cuando
generation_type es frame, image_urls solo admite 1 imagen; pasar cualquier otra cantidad devuelve un error unsupported_image_count.array<url>
Array de URLs de imágenes de referencia. Puede omitirlo, proporcionar 1 imagen o proporcionar 3 imágenes, según
generation_type:- Omitido o array vacío: Text-to-Video
- 1 imagen: Image-to-Video con una sola imagen
- 3 imágenes: fusión de imágenes de referencia (solo se admite cuando
generation_typeesreference)
generation_type:generation_typeesframe: solo se puede subir 1 imagen.generation_typeesreference: se pueden subir 1 o 3 imágenes.
No se admite el modo de primer-último frame con 2 imágenes. Pasar 2 imágenes devuelve un error
unsupported_image_count. 4 o más imágenes no se han verificado por completo y no se recomiendan.array<url>
Array de URLs de videos de referencia. Puede omitirlo o proporcionar 1 video de referencia.Solo se admiten URLs de video HTTP/HTTPS de acceso público. Puede enviarlo junto con
image_urls: las imágenes se usan como referencia de identidad o composición, mientras que el video se usa como referencia de movimiento.gemini-omni-1.1-flash-ext solo admite 0 o 1 video de referencia. Enviar 2 o más videos devuelve un error unsupported_video_count.No envíe
duration al enviar video_urls. video_urls y duration no se pueden enviar al mismo tiempo.Respuesta
integer
Código de estado de la respuesta. Las solicitudes exitosas devuelven
200.array
Consultar el resultado de la tarea
La generación de video es asíncrona. Tras la solicitud, la API devuelve untask_id. Use el endpoint Obtener estado de la tarea para consultar el progreso y los resultados.
cURL
curl --request GET \
--url https://api.apimart.ai/v1/tasks/task_01KS1H7ZYSJWH1N779S2FSHTKA \
--header 'Authorization: Bearer <token>'
Ejemplo de resultado exitoso
{
"code": 200,
"data": {
"id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
"status": "completed",
"progress": 100,
"created": 1779246294,
"completed": 1779246534,
"actual_time": 240,
"estimated_time": 600,
"cost": 0.4,
"credits_cost": 4,
"result": {
"videos": [
{
"url": ["https://cdn.example.com/videos/abc.mp4"],
"expires_at": 1779332760
}
]
}
}
}
Ejemplo de resultado fallido
{
"code": 200,
"data": {
"id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
"status": "failed",
"progress": 100,
"created": 1779246294,
"completed": 1779246534,
"actual_time": 240,
"estimated_time": 600,
"cost": 0,
"credits_cost": 0,
"error": {
"message": "invalid duration 7, must be one of 4/6/8/10",
"code": "task_failed"
}
}
}
Casos de uso
Escenario 1: Texto a video
{
"model": "gemini-omni-1.1-flash-ext",
"prompt": "a beautiful sunset over the ocean with seagulls flying",
"duration": 6,
"resolution": "720p",
"aspect_ratio": "16:9"
}
Escenario 2: Video a partir de una sola imagen
{
"model": "gemini-omni-1.1-flash-ext",
"prompt": "make the character smile and slowly turn around, cinematic camera motion",
"duration": 6,
"resolution": "1080p",
"aspect_ratio": "9:16",
"image_urls": ["https://example.com/character.jpg"]
}
Escenario 3: Fusión con 3 imágenes de referencia
{
"model": "gemini-omni-1.1-flash-ext",
"prompt": "a creative scene combining these elements with smooth camera motion",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16",
"image_urls": [
"https://example.com/scene.jpg",
"https://example.com/character.jpg",
"https://example.com/product.jpg"
]
}
Escenario 4: Video corto 4K
{
"model": "gemini-omni-1.1-flash-ext",
"prompt": "close-up of a hummingbird hovering in front of a red flower",
"duration": 4,
"resolution": "4k",
"aspect_ratio": "16:9"
}
Escenario 5: Generación con video de referencia
{
"model": "gemini-omni-1.1-flash-ext",
"prompt": "the same scene but at night with neon lights",
"resolution": "720p",
"aspect_ratio": "16:9",
"video_urls": ["https://example.com/reference.mp4"]
}
Códigos de error
| HTTP | Tipo de error | Significado | Acción sugerida |
|---|---|---|---|
| 400 | invalid_request_error | model no es gemini-omni-1.1-flash-ext, prompt está vacío o el formato JSON no es válido | Verifique el cuerpo de la solicitud |
| 400 | invalid_duration | duration no es 4, 6, 8 o 10 | Use una duración compatible |
| 400 | invalid_resolution | resolution no es 720p, 1080p o 4k | Use una resolución compatible |
| 400 | unsupported_image_count | El número de image_urls no es compatible, normalmente causado por pasar 2 imágenes | Use 0, 1 o 3 imágenes |
| 400 | unsupported_video_count | El número de video_urls no es compatible, normalmente causado por enviar 2 o más videos | Use 0 o 1 video de referencia |
| 401 | authentication_error | Token no válido | Verifique el Bearer Token |
| 402 | payment_required | Saldo insuficiente | Recargue y vuelva a intentarlo |
| 429 | rate_limit_error | Límite de tasa superado | Reduzca la concurrencia o vuelva a intentarlo más tarde |
data.error. Las causas comunes incluyen el agotamiento temporal de la cuota upstream, el fallo en la moderación de contenido o el tiempo de espera agotado en el upstream.