curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gemini-omni-flash-preview",
"prompt": "a red apple on a wooden table, short cinematic clip",
"aspect_ratio": "16:9"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "gemini-omni-flash-preview",
"prompt": "a red apple on a wooden table, short cinematic clip",
"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: "gemini-omni-flash-preview",
prompt: "a red apple on a wooden table, short cinematic clip",
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": "gemini-omni-flash-preview",
"prompt": "a red apple on a wooden table, short cinematic clip",
"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_01KS1H7ZYSJWH1N779S2FSHTKA"
}
]
}
{
"error": {
"code": 400,
"message": "Parâmetros da requisição inválidos",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Falha na autenticação. Verifique sua chave de API",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Saldo insuficiente na conta. Recarregue e tente novamente",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "Requisições em excesso. Tente novamente mais tarde",
"type": "rate_limit_error"
}
}
Gemini Omni Flash
Geração de vídeo Gemini Omni Flash
- Modelo oficial do Google Gemini Omni Flash, um modelo de geração de vídeo multimodal completo
- Suporta Text-to-Video, Image-to-Video e Video-to-Video (edição), podendo combinar entradas de texto + imagem + vídeo
- Saída em 720p / 24fps, 3 a 10 segundos, com áudio; suporta edição conversacional em várias etapas
- API de tarefa assíncrona. Após a submissão, consulte o resultado da geração pelo ID da tarefa
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-flash-preview",
"prompt": "a red apple on a wooden table, short cinematic clip",
"aspect_ratio": "16:9"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "gemini-omni-flash-preview",
"prompt": "a red apple on a wooden table, short cinematic clip",
"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: "gemini-omni-flash-preview",
prompt: "a red apple on a wooden table, short cinematic clip",
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": "gemini-omni-flash-preview",
"prompt": "a red apple on a wooden table, short cinematic clip",
"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_01KS1H7ZYSJWH1N779S2FSHTKA"
}
]
}
{
"error": {
"code": 400,
"message": "Parâmetros da requisição inválidos",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Falha na autenticação. Verifique sua chave de API",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Saldo insuficiente na conta. Recarregue e tente novamente",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "Requisições em excesso. Tente novamente mais tarde",
"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-flash-preview",
"prompt": "a red apple on a wooden table, short cinematic clip",
"aspect_ratio": "16:9"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "gemini-omni-flash-preview",
"prompt": "a red apple on a wooden table, short cinematic clip",
"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: "gemini-omni-flash-preview",
prompt: "a red apple on a wooden table, short cinematic clip",
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": "gemini-omni-flash-preview",
"prompt": "a red apple on a wooden table, short cinematic clip",
"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_01KS1H7ZYSJWH1N779S2FSHTKA"
}
]
}
{
"error": {
"code": 400,
"message": "Parâmetros da requisição inválidos",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Falha na autenticação. Verifique sua chave de API",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Saldo insuficiente na conta. Recarregue e tente novamente",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "Requisições em excesso. Tente novamente mais tarde",
"type": "rate_limit_error"
}
}
Autenticação
string
obrigatório
Todas as requisições exigem autenticação via Bearer Token.Obtenha uma chave de API:Acesse a página de gerenciamento de chaves de API para obter sua chave de API.Adicione o seguinte cabeçalho ao fazer requisições:
Authorization: Bearer YOUR_API_KEY
Parâmetros da requisição
string
obrigatório
Nome do modelo de geração de vídeo. Deve ser
gemini-omni-flash-preview.boolean
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
Instrução de texto. Para Text-to-Video, é a descrição da cena; para Image/Video-to-Video, é a instrução de ação / estilo / edição.
prompt e o material de referência (image_urls / video_urls) devem ser fornecidos em pelo menos um deles.array<string>
Imagens de referência, no máximo 16. Cada item é uma URL
http(s)://.Suporta JPEG / PNG. Para múltiplos sujeitos (como “gato + novelo de lã”), você pode enviar várias imagens e descrever no prompt como elas interagem.array<string>
Vídeo de referência / a ser editado, no máximo 1 (não há suporte para referência a múltiplos vídeos). Pode ser um link direto
http(s):// ou data:video/....- O vídeo de referência deve ter de 1 a 24 segundos; a recomendação oficial é ≤3 segundos.
video_urlseextend_from_task_idsão mutuamente exclusivos; forneça apenas um deles, não ambos ao mesmo tempo.
string
padrão:"16:9"
Proporção do vídeo, que efetivamente controla a orientação da saída.Suporta apenas:
Ao fornecer
video_urls, o parâmetro aspect_ratio não terá efeito.16:9- paisagem (padrão)9:16- retrato
16:9.string
padrão:"720p"
Resolução do vídeo. Atualmente suporta apenas
720p.string
ID da tarefa anterior: preencha com o **
task_id** da tarefa de geração anterior.extend_from_task_id e video_urls são mutuamente exclusivos; forneça apenas um deles, não ambos ao mesmo tempo.Resposta
integer
Código de status da resposta. É
200 em caso de sucesso.array
Consultar o resultado da tarefa
A geração de vídeo é uma tarefa assíncrona. Após a submissão, a API retorna umtask_id. Use o endpoint Obter status da tarefa para consultar o progresso e o resultado da geração.
Exemplo de resultado bem-sucedido
{
"code": 200,
"data": {
"id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
"status": "completed",
"progress": 100,
"created": 1779246294,
"completed": 1779246334,
"actual_time": 40,
"estimated_time": 60,
"cost": 1.0,
"credits_cost": 10,
"result": {
"videos": [
{
"url": ["https://cdn.example.com/gemini_omni_xxx.mp4"],
"expires_at": 1779332760
}
]
}
}
}
Casos de uso
Cenário 1: Texto para vídeo
{
"model": "gemini-omni-flash-preview",
"prompt": "a blue butterfly landing on a flower, macro, soft light",
"aspect_ratio": "9:16"
}
Cenário 2: Imagem para vídeo
{
"model": "gemini-omni-flash-preview",
"prompt": "turn this drawing into realistic footage, use it only as a motion guide",
"image_urls": ["https://example.com/sketch.jpg"]
}
Cenário 3: Vídeo para vídeo
{
"model": "gemini-omni-flash-preview",
"prompt": "when the person touches the mirror, make it ripple like liquid",
"video_urls": ["https://example.com/clip.mp4"]
}