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 全能多模态视频生成模型
- 支持文生视频、图生视频、视频生视频(编辑),可混合文本 + 图片 + 视频输入
- 输出 720p / 24fps、3–10 秒、含音频;支持对话式多轮编辑
- 异步任务接口,提交后通过任务 ID 查询生成结果
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 Key:访问 API Key 管理页面 获取您的 API Key。使用时在请求头中添加:
Authorization: Bearer YOUR_API_KEY
请求参数
string
必填
视频生成模型名称,固定为
gemini-omni-flash-preview。string
必填
文本指令。文生视频为场景描述;图 / 视频生视频为动作 / 风格 / 编辑指令。
prompt 与参考素材(image_urls / video_urls)至少提供其一。array<string>
参考图,最多 16 张。每项为
http(s):// URL。支持 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
上一个任务ID:填上一次生成任务的**
task_id**。extend_from_task_id 与 video_urls 互斥,二者只能提供其一,不能同时传入。响应
integer
响应状态码,成功时为
200。查询任务结果
视频生成为异步任务。提交后会返回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:文生视频
{
"model": "gemini-omni-flash-preview",
"prompt": "a blue butterfly landing on a flower, macro, soft light",
"aspect_ratio": "9:16"
}
场景 2:图生视频
{
"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:视频生视频
{
"model": "gemini-omni-flash-preview",
"prompt": "when the person touches the mirror, make it ripple like liquid",
"video_urls": ["https://example.com/clip.mp4"]
}
⌘I