使用 Google Gemini Omni 生成视频
curl --request POST \
--url https://api.crun.ai/api/v1/client/job/CreateTask \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"model": "google/gemini-omni",
"callback_url": "https://your-domain.com/api/callback",
"input": {
"prompt": "Create a cinematic product video of a glass perfume bottle on a reflective surface, with soft studio lighting and slow camera movement.",
"img_urls": [
"https://example.com/reference-1.png",
"https://example.com/reference-2.png"
],
"video_list": [
{
"url": "https://example.com/source-video.mp4",
"start": 0,
"ends": 6
}
],
"duration": 6,
"aspect_ratio": "16:9",
"resolution": "720p"
}
}
'import requests
url = "https://api.crun.ai/api/v1/client/job/CreateTask"
payload = {
"model": "google/gemini-omni",
"callback_url": "https://your-domain.com/api/callback",
"input": {
"prompt": "Create a cinematic product video of a glass perfume bottle on a reflective surface, with soft studio lighting and slow camera movement.",
"img_urls": ["https://example.com/reference-1.png", "https://example.com/reference-2.png"],
"video_list": [
{
"url": "https://example.com/source-video.mp4",
"start": 0,
"ends": 6
}
],
"duration": 6,
"aspect_ratio": "16:9",
"resolution": "720p"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'google/gemini-omni',
callback_url: 'https://your-domain.com/api/callback',
input: {
prompt: 'Create a cinematic product video of a glass perfume bottle on a reflective surface, with soft studio lighting and slow camera movement.',
img_urls: ['https://example.com/reference-1.png', 'https://example.com/reference-2.png'],
video_list: [{url: 'https://example.com/source-video.mp4', start: 0, ends: 6}],
duration: 6,
aspect_ratio: '16:9',
resolution: '720p'
}
})
};
fetch('https://api.crun.ai/api/v1/client/job/CreateTask', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.crun.ai/api/v1/client/job/CreateTask",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'google/gemini-omni',
'callback_url' => 'https://your-domain.com/api/callback',
'input' => [
'prompt' => 'Create a cinematic product video of a glass perfume bottle on a reflective surface, with soft studio lighting and slow camera movement.',
'img_urls' => [
'https://example.com/reference-1.png',
'https://example.com/reference-2.png'
],
'video_list' => [
[
'url' => 'https://example.com/source-video.mp4',
'start' => 0,
'ends' => 6
]
],
'duration' => 6,
'aspect_ratio' => '16:9',
'resolution' => '720p'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.crun.ai/api/v1/client/job/CreateTask"
payload := strings.NewReader("{\n \"model\": \"google/gemini-omni\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"Create a cinematic product video of a glass perfume bottle on a reflective surface, with soft studio lighting and slow camera movement.\",\n \"img_urls\": [\n \"https://example.com/reference-1.png\",\n \"https://example.com/reference-2.png\"\n ],\n \"video_list\": [\n {\n \"url\": \"https://example.com/source-video.mp4\",\n \"start\": 0,\n \"ends\": 6\n }\n ],\n \"duration\": 6,\n \"aspect_ratio\": \"16:9\",\n \"resolution\": \"720p\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.crun.ai/api/v1/client/job/CreateTask")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"google/gemini-omni\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"Create a cinematic product video of a glass perfume bottle on a reflective surface, with soft studio lighting and slow camera movement.\",\n \"img_urls\": [\n \"https://example.com/reference-1.png\",\n \"https://example.com/reference-2.png\"\n ],\n \"video_list\": [\n {\n \"url\": \"https://example.com/source-video.mp4\",\n \"start\": 0,\n \"ends\": 6\n }\n ],\n \"duration\": 6,\n \"aspect_ratio\": \"16:9\",\n \"resolution\": \"720p\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crun.ai/api/v1/client/job/CreateTask")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"google/gemini-omni\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"Create a cinematic product video of a glass perfume bottle on a reflective surface, with soft studio lighting and slow camera movement.\",\n \"img_urls\": [\n \"https://example.com/reference-1.png\",\n \"https://example.com/reference-2.png\"\n ],\n \"video_list\": [\n {\n \"url\": \"https://example.com/source-video.mp4\",\n \"start\": 0,\n \"ends\": 6\n }\n ],\n \"duration\": 6,\n \"aspect_ratio\": \"16:9\",\n \"resolution\": \"720p\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "success",
"data": {
"task_id": "task_12345678"
}
}{
"code": 422,
"message": "Missing Params or Type Error",
"errors": [
"Value error, Invalid input for model google/gemini-omni: The end time shall be later than the start time"
]
}Google
Gemini Omni
Google Gemini Omni 是一款多模态视频生成与编辑模型,可将文本、图像和视频参考转化为连贯视频,并提供稳定场景一致性、世界理解能力和自然语言控制。
POST
/
api
/
v1
/
client
/
job
/
CreateTask
使用 Google Gemini Omni 生成视频
curl --request POST \
--url https://api.crun.ai/api/v1/client/job/CreateTask \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"model": "google/gemini-omni",
"callback_url": "https://your-domain.com/api/callback",
"input": {
"prompt": "Create a cinematic product video of a glass perfume bottle on a reflective surface, with soft studio lighting and slow camera movement.",
"img_urls": [
"https://example.com/reference-1.png",
"https://example.com/reference-2.png"
],
"video_list": [
{
"url": "https://example.com/source-video.mp4",
"start": 0,
"ends": 6
}
],
"duration": 6,
"aspect_ratio": "16:9",
"resolution": "720p"
}
}
'import requests
url = "https://api.crun.ai/api/v1/client/job/CreateTask"
payload = {
"model": "google/gemini-omni",
"callback_url": "https://your-domain.com/api/callback",
"input": {
"prompt": "Create a cinematic product video of a glass perfume bottle on a reflective surface, with soft studio lighting and slow camera movement.",
"img_urls": ["https://example.com/reference-1.png", "https://example.com/reference-2.png"],
"video_list": [
{
"url": "https://example.com/source-video.mp4",
"start": 0,
"ends": 6
}
],
"duration": 6,
"aspect_ratio": "16:9",
"resolution": "720p"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'google/gemini-omni',
callback_url: 'https://your-domain.com/api/callback',
input: {
prompt: 'Create a cinematic product video of a glass perfume bottle on a reflective surface, with soft studio lighting and slow camera movement.',
img_urls: ['https://example.com/reference-1.png', 'https://example.com/reference-2.png'],
video_list: [{url: 'https://example.com/source-video.mp4', start: 0, ends: 6}],
duration: 6,
aspect_ratio: '16:9',
resolution: '720p'
}
})
};
fetch('https://api.crun.ai/api/v1/client/job/CreateTask', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.crun.ai/api/v1/client/job/CreateTask",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'google/gemini-omni',
'callback_url' => 'https://your-domain.com/api/callback',
'input' => [
'prompt' => 'Create a cinematic product video of a glass perfume bottle on a reflective surface, with soft studio lighting and slow camera movement.',
'img_urls' => [
'https://example.com/reference-1.png',
'https://example.com/reference-2.png'
],
'video_list' => [
[
'url' => 'https://example.com/source-video.mp4',
'start' => 0,
'ends' => 6
]
],
'duration' => 6,
'aspect_ratio' => '16:9',
'resolution' => '720p'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.crun.ai/api/v1/client/job/CreateTask"
payload := strings.NewReader("{\n \"model\": \"google/gemini-omni\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"Create a cinematic product video of a glass perfume bottle on a reflective surface, with soft studio lighting and slow camera movement.\",\n \"img_urls\": [\n \"https://example.com/reference-1.png\",\n \"https://example.com/reference-2.png\"\n ],\n \"video_list\": [\n {\n \"url\": \"https://example.com/source-video.mp4\",\n \"start\": 0,\n \"ends\": 6\n }\n ],\n \"duration\": 6,\n \"aspect_ratio\": \"16:9\",\n \"resolution\": \"720p\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.crun.ai/api/v1/client/job/CreateTask")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"google/gemini-omni\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"Create a cinematic product video of a glass perfume bottle on a reflective surface, with soft studio lighting and slow camera movement.\",\n \"img_urls\": [\n \"https://example.com/reference-1.png\",\n \"https://example.com/reference-2.png\"\n ],\n \"video_list\": [\n {\n \"url\": \"https://example.com/source-video.mp4\",\n \"start\": 0,\n \"ends\": 6\n }\n ],\n \"duration\": 6,\n \"aspect_ratio\": \"16:9\",\n \"resolution\": \"720p\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crun.ai/api/v1/client/job/CreateTask")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"google/gemini-omni\",\n \"callback_url\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"Create a cinematic product video of a glass perfume bottle on a reflective surface, with soft studio lighting and slow camera movement.\",\n \"img_urls\": [\n \"https://example.com/reference-1.png\",\n \"https://example.com/reference-2.png\"\n ],\n \"video_list\": [\n {\n \"url\": \"https://example.com/source-video.mp4\",\n \"start\": 0,\n \"ends\": 6\n }\n ],\n \"duration\": 6,\n \"aspect_ratio\": \"16:9\",\n \"resolution\": \"720p\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "success",
"data": {
"task_id": "task_12345678"
}
}{
"code": 422,
"message": "Missing Params or Type Error",
"errors": [
"Value error, Invalid input for model google/gemini-omni: The end time shall be later than the start time"
]
}查询任务状态
提交任务后,请使用统一查询接口查看进度并获取结果:获取任务信息
了解如何查询任务状态并获取生成结果
生产环境中,建议使用
callback_url 参数接收任务完成后的自动通知,而不是轮询状态接口。相关资源
模型概览
查看所有可用模型
通用 API
查询账户剩余积分
授权
所有 API 都需要通过 API Key 进行身份验证。
获取 API Key:
- 访问 API Key 管理页面 获取您的 API Key
使用方式: 添加到请求头:
x-api-key: YOUR_API_KEY
注意:
- 请妥善保管您的 API Key,不要与他人共享
- 如果怀疑 API Key 已泄露,请立即在管理页面重置
请求体
application/json
用于生成的模型名称。必填字段。
- 此接口必须使用
google/gemini-omni
可用选项:
google/gemini-omni Gemini Omni 视频生成任务的输入参数
Show child attributes
Show child attributes
可选。用于接收任务完成通知的回调 URL。
- 生成完成后,系统会向该 URL POST 任务状态和结果
- 回调载荷结构与任务状态查询返回的
data对象一致 - 您的回调接口应接受包含结果的 JSON POST 请求
- 成功接收后应返回 HTTP 200 状态码
示例:
"https://your-domain.com/api/callback"
响应
请求成功
响应状态码
- 200:成功 - 请求已成功处理
- 401:未授权 - 身份验证凭据缺失或无效
- 402:积分不足 - 账户积分不足以执行操作
- 404:未找到 - 请求的资源或接口不存在
- 422:验证错误 - 请求参数未通过验证检查
- 429:请求受限 - 已超出该资源的请求限制
- 455:服务不可用 - 系统当前正在维护
- 500:服务器错误 - 处理请求时发生意外错误
- 501:生成失败 - 内容生成任务失败
- 505:功能已禁用 - 请求的功能当前不可用
可用选项:
200, 401, 402, 404, 422, 429, 455, 500, 501, 505 响应消息,失败时返回错误描述
示例:
"success"
Show child attributes
Show child attributes
此页面对您有帮助吗?
⌘I
