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 秒の長さに対応し、秒単位で課金
- 非同期タスク 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-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_idと併用しますextend- 動画の末尾に新しい内容を追加して延長します。video_urlsまたはextend_from_task_idと併用しますreference- 複数画像参照。image_urlsと併用しますtext_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 です。array
タスク結果の照会
動画生成は非同期タスクです。送信後にtask_id が返されるので、タスクステータスの取得 API で生成の進捗と結果を照会してください。
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
}