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 秒、音声付きの出力。対話型のマルチターン編集に対応
- 非同期タスク API。送信後、タスク 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 です。array
タスク結果の照会
動画生成は非同期タスクです。送信後にtask_id が返されます。タスクステータス取得 API を使用して生成の進捗と結果を照会します。
成功結果の例
{
"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