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.1-flash",
"prompt": "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
"aspect_ratio": "16:9",
"resolution": "1080p"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "gemini-omni-1.1-flash",
"prompt": "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
"aspect_ratio": "16:9",
"resolution": "1080p"
}
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.1-flash",
prompt: "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
aspect_ratio: "16:9",
resolution: "1080p"
};
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.1-flash",
"prompt": "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
"aspect_ratio": "16:9",
"resolution": "1080p",
}
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.1 Flash
Gemini Omni 1.1 Flash 動画生成
- Google 公式のオールインワン・マルチモーダル動画生成モデル Gemini Omni 1.1 Flash
- テキストから動画、画像から動画、複数被写体の参照、開始・終了フレーム補間、動画編集、延長に対応
- 360p / 720p / 1080p / 4K、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-1.1-flash",
"prompt": "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
"aspect_ratio": "16:9",
"resolution": "1080p"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "gemini-omni-1.1-flash",
"prompt": "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
"aspect_ratio": "16:9",
"resolution": "1080p"
}
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.1-flash",
prompt: "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
aspect_ratio: "16:9",
resolution: "1080p"
};
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.1-flash",
"prompt": "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
"aspect_ratio": "16:9",
"resolution": "1080p",
}
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.1-flash",
"prompt": "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
"aspect_ratio": "16:9",
"resolution": "1080p"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "gemini-omni-1.1-flash",
"prompt": "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
"aspect_ratio": "16:9",
"resolution": "1080p"
}
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.1-flash",
prompt: "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
aspect_ratio: "16:9",
resolution: "1080p"
};
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.1-flash",
"prompt": "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
"aspect_ratio": "16:9",
"resolution": "1080p",
}
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
必須
すべての API で Bearer Token による認証が必要です。API キーの取得:API キー管理ページにアクセスして API キーを取得します。使用時はリクエストヘッダーに追加します:
Authorization: Bearer YOUR_API_KEY
リクエストパラメータ
string
必須
動画生成モデル名。
gemini-omni-1.1-flash 固定です。string
テキスト指示。テキストから動画ではシーンを、画像から動画、動画編集、延長では動き、スタイル、編集内容を記述します。
prompt または素材(image_urls、開始・終了フレーム画像、video_urls)のいずれかを少なくとも 1 つ指定してください。string
デフォルト:"720p"
出力動画の解像度。大文字と小文字は区別されません。選択可能な値:
360p720p(デフォルト)1080p4k
2160p は 4k として扱われます。解像度によってタスクのデポジット区分と主な動画出力コストが決まります。未対応の解像度を指定すると
invalid_resolution エラーが返されます。string
デフォルト:"16:9"
動画のアスペクト比。横向きまたは縦向きの出力を指定します。対応値:
16:9- 横向き(デフォルト)9:16- 縦向き
16:9 として扱われます。video_urls を指定した場合、出力は通常入力動画のアスペクト比に従うため、aspect_ratio が反映されないことがあります。array<string>
参照画像の配列。公開アクセス可能な HTTP/HTTPS URL のみ対応します。
- 画像を 1 枚指定:デフォルトで動画の開始フレームとして使用
- 複数画像を指定:複数被写体またはスタイルの参照として使用。各画像の用途と関係を
promptに記述してください
image_urls と開始・終了フレーム画像は合計 10 枚までです。string
開始フレーム画像。公開アクセス可能な HTTP/HTTPS URL のみ対応します。
- 単独で指定:動画の開始フレームとして使用
last_frame_imageと同時に指定:開始フレームから終了フレームへ滑らかに遷移する動画を生成
string
終了フレーム画像。公開アクセス可能な HTTP/HTTPS URL のみ対応し、
first_frame_image と同時に指定する必要があります。last_frame_image のみを指定すると invalid_frame_images エラーが返されます。開始・終了フレーム画像は同じ比率にし、aspect_ratio と一致させることを推奨します。開始フレームまたは開始・終了フレーム生成では、次の 2 つの指定方法は同じ効果です。いずれか一方を選び、同時に指定しないでください:
first_frame_image/last_frame_imageを使用image_with_rolesを使用し、roleをfirst_frame/last_frameに設定
array<object>
ロール付き画像の配列。
例:
first_frame_image / last_frame_image と同等の指定方法として使用でき、参照画像の宣言にも使用できます。表示 image_with_roles の要素
表示 image_with_roles の要素
[
{"url": "https://example.com/start.jpg", "role": "first_frame"},
{"url": "https://example.com/end.jpg", "role": "last_frame"}
]
image_urls も指定した場合、参照画像は image_urls が優先され、image_with_roles の参照画像とは結合されません。実際に使用されるすべての画像は、開始・終了フレームを含め合計 10 枚までです。array<string>
編集または延長する動画の配列。現在は最大 1 本で、長さは 10 秒以下である必要があります。公開アクセス可能な HTTP/HTTPS 動画の直接 URL のみ対応します。YouTube リンクは対応していません。
video_urls と extend_from_task_id は相互排他です。いずれか一方のみ指定してください。object
生成目的を明示するための追加パラメータオブジェクトです。
表示 metadata フィールド
表示 metadata フィールド
string
選択可能なタスクタイプ:
text_to_video:テキストから動画image_to_video:画像から動画reference_to_video:参照素材から動画edit:動画編集extend:動画延長
開始・終了フレーム補間では、モデルがタスクタイプを自動推論し、プラットフォームは
metadata.task を渡しません。string
前回の生成タスクのローカル
task_id。会話形式の編集や追加延長に使用し、前回の動画を再アップロードする必要はありません。参照するタスクは現在のユーザーに属し、成功済みの Gemini Omni モデルタスクである必要があります。extend_from_task_id と video_urls は相互排他です。いずれか一方のみ指定してください。このモデルには
duration パラメータがありません。1 回の出力時間は内容に応じてモデルが自動決定し、通常は 3~10 秒です。テンポを制御するには、prompt に自然言語または時間範囲で記述してください。レスポンス
integer
レスポンスステータスコード。成功時は
200 です。タスク結果の照会
動画生成は非同期タスクです。送信後に返されるtask_id を使い、タスク状態の取得 API で進捗と結果を照会します。
cURL
curl --request GET \
--url https://api.apimart.ai/v1/tasks/task_01KS1H7ZYSJWH1N779S2FSHTKA \
--header 'Authorization: Bearer <token>'
completed または failed になったら停止してください。クライアント全体のタイムアウトは 10 分を推奨します。
成功結果の例
{
"code": 200,
"data": {
"id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
"status": "completed",
"progress": 100,
"cost": 1.52,
"credits_cost": 15.2,
"result": {
"videos": [
{
"url": ["https://cdn.example.com/gemini_omni_xxx.mp4"],
"expires_at": 1788518400
}
]
}
}
}
使用例
使用例 1:テキストから動画(4K)
{
"model": "gemini-omni-1.1-flash",
"prompt": "a blue butterfly landing on a flower, macro, soft light, no dialogue",
"aspect_ratio": "9:16",
"resolution": "4k"
}
使用例 2:開始・終了フレーム補間
{
"model": "gemini-omni-1.1-flash",
"prompt": "smooth transition, camera slowly pushes in",
"first_frame_image": "https://example.com/start.jpg",
"last_frame_image": "https://example.com/end.jpg",
"resolution": "720p"
}
使用例 3:複数被写体の参照
{
"model": "gemini-omni-1.1-flash",
"prompt": "the cat playfully bats at the ball of yarn",
"image_urls": [
"https://example.com/cat.png",
"https://example.com/yarn.png"
],
"resolution": "720p"
}
使用例 4:画像ロールで開始・終了フレームを指定
{
"model": "gemini-omni-1.1-flash",
"prompt": "a smooth cinematic transition from sunrise to a starry night",
"image_with_roles": [
{"url": "https://example.com/sunrise.jpg", "role": "first_frame"},
{"url": "https://example.com/night.jpg", "role": "last_frame"}
],
"resolution": "1080p"
}
使用例 5:動画編集
{
"model": "gemini-omni-1.1-flash",
"prompt": "Make the violin invisible. Keep everything else the same.",
"video_urls": ["https://example.com/clip.mp4"]
}
Keep everything else the same を追加してください。
使用例 6:会話形式の延長
{
"model": "gemini-omni-1.1-flash",
"prompt": "Extend this video: the camera pans across the mountains.",
"extend_from_task_id": "task_01AAA"
}