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.2-flash-ext",
"prompt": "Aerial shot over a misty mountain lake at sunrise.",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "gemini-omni-1.2-flash-ext",
"prompt": "Aerial shot over a misty mountain lake at sunrise.",
"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.2-flash-ext",
prompt: "Aerial shot over a misty mountain lake at sunrise.",
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.2-flash-ext",
"prompt": "Aerial shot over a misty mountain lake at sunrise.",
"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": "请求参数无效",
"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-1.2-flash-ext
gemini-omni-1.2-flash-ext 视频生成
- gemini-omni-1.2-flash-ext 统一视频生成模型
- 支持文生视频、首帧生视频、首尾帧生视频、多图参考、视频编辑与续写
- 支持 360p/720p/1080p/4k 分辨率,3–15 秒时长,按秒计费
- 异步任务接口,提交后通过任务 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-1.2-flash-ext",
"prompt": "Aerial shot over a misty mountain lake at sunrise.",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "gemini-omni-1.2-flash-ext",
"prompt": "Aerial shot over a misty mountain lake at sunrise.",
"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.2-flash-ext",
prompt: "Aerial shot over a misty mountain lake at sunrise.",
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.2-flash-ext",
"prompt": "Aerial shot over a misty mountain lake at sunrise.",
"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": "请求参数无效",
"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-1.2-flash-ext",
"prompt": "Aerial shot over a misty mountain lake at sunrise.",
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "9:16"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "gemini-omni-1.2-flash-ext",
"prompt": "Aerial shot over a misty mountain lake at sunrise.",
"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.2-flash-ext",
prompt: "Aerial shot over a misty mountain lake at sunrise.",
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.2-flash-ext",
"prompt": "Aerial shot over a misty mountain lake at sunrise.",
"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": "请求参数无效",
"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-1.2-flash-ext。string
必填
视频内容描述或编辑指令,去除首尾空格后不能为空。文生视频描述场景、人物、动作、镜头和声音;带图片或视频时描述动作、风格或修改要求。示例:
"Aerial shot over a misty mountain lake at sunrise."所有模式都必须传入
prompt,包括首帧、多图参考、编辑和续写。缺少时返回 400 错误。integer
默认值:"10"
视频时长,单位为秒,必须为整数。
- 文生 / 首帧 / 多图参考:输出时长,支持
3–15 - 首尾帧:输出时长,支持
3–10 - 续写(
extend):新增片段的时长,支持3–10 - 编辑(
edit):不能传入,输出时长跟随源视频
seconds,两者同时传入时必须相等。编辑模式传入
duration 会返回 video edit does not accept duration 错误。string
默认值:"720p"
视频分辨率,不区分大小写,决定每秒单价。可选值:
360p720p1080p4k(也可传2160p)
传入其他分辨率会返回 400 错误。
string
默认值:"16:9"
仅支持
16:9(横屏,默认)和 9:16(竖屏);其他值返回 400 错误。string
任务类型,用于指定素材的使用方式。可选值:
edit- 编辑视频,需配合video_urls或extend_from_task_idextend- 续写视频,在片尾追加新内容,需配合video_urls或extend_from_task_idreference- 多图参考,需配合image_urlstext_to_video/image_to_video/reference_to_video- 文生 / 首帧 / 参考图auto- 按输入自动判断;带视频时视为edit
传入
video_urls 或 extend_from_task_id 时必须传入任务类型(omni_reference_task_type,或兼容字段 generation_type),不传返回 400 错误。推荐显式传入 edit 或 extend;传 auto 时按 edit 处理。string
兼容字段,与
omni_reference_task_type 等价。可选值:frame(等同 image_to_video)、reference、edit、extend。generation_type 与 omni_reference_task_type 不可以同时传入。array<url>
参考图片数组,用于多图参考(人物、商品、风格等),支持 1–10 张。仅支持公网可访问的 HTTP/HTTPS 图片 URL。本地图片请先上传获取公网 URL 再传入;当前不支持 Base64 Data URL,传入会返回 400 错误。只传 1 张图片时,处理方式取决于任务类型:
- 不传
omni_reference_task_type:按参考图处理 omni_reference_task_type为auto或image_to_video:按首帧处理
first_frame_image,不要依赖图片数量区分。image_urls 不能与 first_frame_image 或 last_frame_image 同时传入,image_urls 中的图片不会被当作首帧;编辑和续写时也不能传入图片。string
首帧图片,生成视频的第一帧即为该图。仅支持公网可访问的 HTTP/HTTPS 图片 URL,不支持 Base64 Data URL。与
last_frame_image 同时传入时为首尾帧生视频。string
尾帧图片,用于首尾帧生视频,视频从首帧画面过渡到该图。仅支持公网可访问的 HTTP/HTTPS 图片 URL,不支持 Base64 Data URL。首尾帧模式下:
duration支持3–10,不传按 10 秒- 不能传入
system_prompt和negative_prompt
last_frame_image 必须与 first_frame_image 同时传入,只传尾帧会返回 last_frame_image requires first_frame_image 错误;不能与 image_urls 同时传入。array<object>
array<url>
待编辑或续写的视频数组,仅支持 1 段视频。也可使用单值字段
video_url,二选一。只支持公网可访问的 HTTP/HTTPS 视频 URL,格式为 MP4 / MOV / WebM,时长不超过 15 秒,大小不超过 64 MB。传入
video_urls 时必须同时传入任务类型,推荐 omni_reference_task_type 为 edit 或 extend(auto 按 edit 处理);不传返回 400 错误。传入 2 个及以上视频会返回 400 错误。string
本平台的任务 ID(
task_01…),基于自己之前已完成的 gemini-omni-1.2-flash-ext 任务继续编辑或续写,无需重新上传视频。使用条件:- 任务属于当前账号
- 任务模型为
gemini-omni-1.2-flash-ext - 任务状态为
completed - 生成原任务的通道仍可用,否则返回 503
source_channel_unavailable - 原任务成片不超过 15 秒(编辑和续写均适用);编辑模式下还需时长可识别
video_urls 上传;原成片超过 15 秒时,需先裁剪至 15 秒以内再上传。extend_from_task_id 不能与 video_urls 同时传入,且必须同时传入任务类型,推荐 omni_reference_task_type 为 edit 或 extend(auto 按 edit 处理)。string
不希望出现在画面中的内容。示例:
"people, cars, color"首尾帧模式不能传入
negative_prompt。string
系统指令,例如固定画面风格、禁止出现文字。必须为字符串。示例:
"Render as a black-and-white silent film."首尾帧模式不能传入
system_prompt。响应
integer
响应状态码,成功时为
200。查询任务结果
视频生成为异步任务。提交后会返回task_id,使用 获取任务状态 接口查询生成进度和结果。
cURL
curl --request GET \
--url https://api.apimart.ai/v1/tasks/task_01KS1H7ZYSJWH1N779S2FSHTKA \
--header 'Authorization: Bearer <token>'
成功结果示例
{
"code": 200,
"data": {
"id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
"status": "completed",
"progress": 100,
"actual_time": 99,
"cost": 0.695,
"result": {
"videos": [
{
"url": ["https://cdn.example.com/videos/abc.mp4"]
}
]
}
}
}
data.result.videos[0].url[0]。data.actual_time 为任务耗时(秒),不是视频时长。输出为 MP4(H.264,24fps),含 AAC 音轨和 SynthID 不可见水印;4k 偶发无音轨。
失败结果示例
{
"code": 200,
"data": {
"id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
"status": "failed",
"progress": 100,
"cost": 0,
"error": {
"code": "task_failed",
"message": "content_rejected",
"type": "task_failed"
}
}
}
计费说明
按秒计费:费用 = 所选分辨率的每秒单价 × 计费秒数。所有模式均按请求的分辨率档位计费。实际单价以 价格页面 为准。| 模式 | 计费秒数 |
|---|---|
| 文生 / 首帧 / 多图参考 | duration,不传按 10 秒 |
| 首尾帧 | duration(最多 10 秒),不传按 10 秒 |
| 编辑 | 源视频时长(扣除 0.15 秒容器误差后向上取整,最少 1 秒;如 8.019 秒按 8 秒,8.3 秒按 9 秒) |
| 续写 | 新增秒数 duration,不传按 10 秒;原视频部分不收费 |
使用场景
场景 1:文生视频
{
"model": "gemini-omni-1.2-flash-ext",
"prompt": "Aerial shot over a misty mountain lake at sunrise.",
"duration": 15,
"resolution": "1080p",
"aspect_ratio": "9:16"
}
场景 2:首帧生视频
{
"model": "gemini-omni-1.2-flash-ext",
"prompt": "The camera slowly pushes in.",
"duration": 6,
"aspect_ratio": "9:16",
"first_frame_image": "https://example.com/start.jpg"
}
场景 3:首尾帧生视频
{
"model": "gemini-omni-1.2-flash-ext",
"prompt": "The flower bud slowly opens into full bloom.",
"duration": 8,
"aspect_ratio": "16:9",
"first_frame_image": "https://example.com/bud.jpg",
"last_frame_image": "https://example.com/bloom.jpg"
}
duration 支持 3–10 秒,不传按 10 秒;不能传入 system_prompt / negative_prompt。
场景 4:多图参考
{
"model": "gemini-omni-1.2-flash-ext",
"prompt": "The cat bats at the ball of yarn.",
"duration": 8,
"image_urls": [
"https://example.com/cat.png",
"https://example.com/yarn.png"
]
}
场景 5:视频编辑
{
"model": "gemini-omni-1.2-flash-ext",
"prompt": "Make the violin invisible. Keep everything else the same.",
"video_urls": ["https://example.com/clip.mp4"],
"omni_reference_task_type": "edit"
}
duration,输出时长跟随源视频。
场景 6:视频续写
{
"model": "gemini-omni-1.2-flash-ext",
"prompt": "Continue the scene: the dancer bows.",
"video_urls": ["https://example.com/clip.mp4"],
"omni_reference_task_type": "extend",
"duration": 4
}
场景 7:基于已有任务续写
{
"model": "gemini-omni-1.2-flash-ext",
"prompt": "Extend this video: the camera pans across the mountains.",
"extend_from_task_id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
"omni_reference_task_type": "extend",
"duration": 6
}
场景 8:系统指令与反向提示词
{
"model": "gemini-omni-1.2-flash-ext",
"prompt": "A busy city street at noon.",
"system_prompt": "Render as a black-and-white silent film.",
"negative_prompt": "people, cars, color",
"duration": 6
}