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": "Parameter permintaan tidak valid",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Autentikasi gagal, harap periksa API Key Anda",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Saldo akun tidak mencukupi, harap isi ulang lalu coba lagi",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "Terlalu banyak permintaan, harap coba lagi nanti",
"type": "rate_limit_error"
}
}
Gemini Omni Flash
Pembuatan Video Gemini Omni Flash
- Model pembuatan video multimodal serba bisa Gemini Omni Flash resmi dari Google
- Mendukung Teks-ke-Video, Gambar-ke-Video, dan Video-ke-Video (pengeditan), dapat menggabungkan input teks + gambar + video
- Menghasilkan 720p / 24fps, 3–10 detik, disertai audio; mendukung pengeditan percakapan multi-giliran
- API tugas asinkron. Setelah pengiriman, kueri hasil pembuatan berdasarkan ID tugas
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": "Parameter permintaan tidak valid",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Autentikasi gagal, harap periksa API Key Anda",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Saldo akun tidak mencukupi, harap isi ulang lalu coba lagi",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "Terlalu banyak permintaan, harap coba lagi nanti",
"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": "Parameter permintaan tidak valid",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Autentikasi gagal, harap periksa API Key Anda",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Saldo akun tidak mencukupi, harap isi ulang lalu coba lagi",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "Terlalu banyak permintaan, harap coba lagi nanti",
"type": "rate_limit_error"
}
}
Autentikasi
string
wajib
Semua endpoint memerlukan autentikasi menggunakan Bearer Token.Dapatkan API Key:Kunjungi halaman manajemen API Key untuk mendapatkan API Key Anda.Tambahkan header berikut saat membuat permintaan:
Authorization: Bearer YOUR_API_KEY
Parameter Permintaan
string
wajib
Nama model pembuatan video, tetap
gemini-omni-flash-preview.boolean
default:"false"
Menentukan apakah moderasi konten dijalankan sebelum tugas video dikirim.
true: periksa prompt dan gambar input denganomni-moderation-latestfalseatau dihilangkan: tidak mengirim permintaan moderasi, tanpa biaya atau latensi moderasi tambahan (default)
string
wajib
Instruksi teks. Untuk Teks-ke-Video berupa deskripsi adegan; untuk Gambar / Video-ke-Video berupa instruksi aksi / gaya / pengeditan.
prompt dan materi referensi (image_urls / video_urls) setidaknya salah satu harus disediakan.array<string>
Gambar referensi, maksimal 16 gambar. Setiap item berupa URL
http(s)://.Mendukung JPEG / PNG. Untuk multi-subjek (seperti “kucing + bola benang”) Anda dapat mengirim beberapa gambar, dan jelaskan bagaimana mereka berinteraksi di dalam prompt.array<string>
Video referensi / yang akan diedit, maksimal 1 video (tidak mendukung referensi multi-video). Dapat berupa tautan langsung
http(s):// atau data:video/....- Video referensi 1 ~ 24 detik, disarankan secara resmi ≤3 detik.
video_urlsdanextend_from_task_idbersifat saling eksklusif; berikan hanya salah satunya, tidak boleh keduanya sekaligus.
string
default:"16:9"
Rasio aspek video, benar-benar mengontrol orientasi tampilan output.Hanya mendukung:
Saat
video_urls diberikan, parameter aspect_ratio tidak berlaku.16:9- lanskap (default)9:16- potret
16:9.string
default:"720p"
Resolusi video. Saat ini hanya mendukung
720p.string
ID tugas sebelumnya: isi dengan **
task_id** dari tugas pembuatan sebelumnya.extend_from_task_id dan video_urls bersifat saling eksklusif; berikan hanya salah satunya, tidak boleh keduanya sekaligus.Respons
integer
Kode status respons,
200 saat berhasil.array
Kueri Hasil Tugas
Pembuatan video merupakan tugas asinkron. Setelah pengiriman, API mengembalikantask_id. Gunakan endpoint Dapatkan status tugas untuk mengueri progres dan hasil pembuatan.
Contoh Hasil Berhasil
{
"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
}
]
}
}
}
Kasus Penggunaan
Skenario 1: Teks-ke-Video
{
"model": "gemini-omni-flash-preview",
"prompt": "a blue butterfly landing on a flower, macro, soft light",
"aspect_ratio": "9:16"
}
Skenario 2: Gambar-ke-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"]
}
Skenario 3: Video-ke-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"]
}