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": "Недопустимые параметры запроса",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Ошибка аутентификации, проверьте свой API-ключ",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Недостаточно средств на счёте, пополните баланс и попробуйте снова",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "Слишком много запросов, попробуйте позже",
"type": "rate_limit_error"
}
}
Gemini Omni Flash
Генерация видео Gemini Omni Flash
- Официальная универсальная мультимодальная модель генерации видео Google Gemini Omni Flash
- Поддерживает Text-to-Video, Image-to-Video, Video-to-Video (редактирование), можно смешивать ввод текста + изображений + видео
- Вывод 720p / 24fps, 3–10 секунд, со звуком; поддерживает диалоговое многораундовое редактирование
- Асинхронный API задач: после отправки результат генерации запрашивается по идентификатору задачи
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": "Недопустимые параметры запроса",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Ошибка аутентификации, проверьте свой API-ключ",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Недостаточно средств на счёте, пополните баланс и попробуйте снова",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "Слишком много запросов, попробуйте позже",
"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": "Недопустимые параметры запроса",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Ошибка аутентификации, проверьте свой API-ключ",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Недостаточно средств на счёте, пополните баланс и попробуйте снова",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "Слишком много запросов, попробуйте позже",
"type": "rate_limit_error"
}
}
Аутентификация
string
обязательно
Все запросы требуют аутентификации по Bearer Token.Получение API-ключа:Перейдите на страницу управления API-ключами, чтобы получить свой API-ключ.При выполнении запросов добавляйте в заголовок:
Authorization: Bearer YOUR_API_KEY
Параметры запроса
string
обязательно
Название модели генерации видео, фиксированное значение
gemini-omni-flash-preview.boolean
по умолчанию:"false"
Выполнять ли проверку содержимого перед отправкой задачи генерации видео.
true: проверить промпты и входные изображения с помощьюomni-moderation-latestfalseили параметр не указан: не отправлять запрос на проверку, без дополнительных затрат и задержки (по умолчанию)
string
обязательно
Текстовая инструкция. Для Text-to-Video — описание сцены; для Image/Video-to-Video — инструкция по движению / стилю / редактированию.
prompt и референсные материалы (image_urls / video_urls) — необходимо предоставить хотя бы одно из них.array<string>
Референсные изображения, максимум 16 штук. Каждый элемент — URL вида
http(s)://.Поддерживаются JPEG / PNG. Для нескольких субъектов (например, «кошка + клубок ниток») можно передать несколько изображений и описать в prompt, как они взаимодействуют.array<string>
Референсное / редактируемое видео, максимум 1 (несколько видеоссылок не поддерживаются). Может быть прямой ссылкой
http(s):// или data:video/....- Референсное видео 1 ~ 24 секунды, официально рекомендуется ≤3 секунд.
video_urlsиextend_from_task_idвзаимоисключающие; укажите только один из них, нельзя передавать оба одновременно.
string
по умолчанию:"16:9"
Соотношение сторон видео, реально управляет ориентацией выводимого кадра.Поддерживаются только:
При передаче
video_urls параметр aspect_ratio не применяется.16:9- горизонтальное (по умолчанию)9:16- вертикальное
16:9.string
по умолчанию:"720p"
Разрешение видео. В настоящее время поддерживается только
720p.string
Идентификатор предыдущей задачи: укажите **
task_id** предыдущей задачи генерации.extend_from_task_id и video_urls взаимоисключающие; укажите только один из них, нельзя передавать оба одновременно.Ответ
integer
Код состояния ответа. При успехе имеет значение
200.array
Получение результата задачи
Генерация видео является асинхронной задачей. После отправки возвращаетсяtask_id. Используйте эндпоинт Получить статус задачи, чтобы узнать прогресс и результат генерации.
Пример успешного результата
{
"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
}
]
}
}
}
Сценарии использования
Сценарий 1: Text-to-Video
{
"model": "gemini-omni-flash-preview",
"prompt": "a blue butterfly landing on a flower, macro, soft light",
"aspect_ratio": "9:16"
}
Сценарий 2: Image-to-Video
{
"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"]
}
Сценарий 3: Video-to-Video
{
"model": "gemini-omni-flash-preview",
"prompt": "when the person touches the mirror, make it ripple like liquid",
"video_urls": ["https://example.com/clip.mp4"]
}