curl --request POST \
--url https://api.apiyi.com/v1/videos \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form model=veo-3.1-fast-generate-preview \
--form 'prompt=Camera slowly rises from the base of the lighthouse to the top, dusk lighting, waves lapping the rocks' \
--form input_reference='@example-file'import requests
url = "https://api.apiyi.com/v1/videos"
files = { "input_reference": ("example-file", open("example-file", "rb")) }
payload = {
"model": "veo-3.1-fast-generate-preview",
"prompt": "Camera slowly rises from the base of the lighthouse to the top, dusk lighting, waves lapping the rocks"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('model', 'veo-3.1-fast-generate-preview');
form.append('prompt', 'Camera slowly rises from the base of the lighthouse to the top, dusk lighting, waves lapping the rocks');
form.append('input_reference', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.apiyi.com/v1/videos', 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.apiyi.com/v1/videos",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nveo-3.1-fast-generate-preview\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nCamera slowly rises from the base of the lighthouse to the top, dusk lighting, waves lapping the rocks\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"input_reference\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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.apiyi.com/v1/videos"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nveo-3.1-fast-generate-preview\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nCamera slowly rises from the base of the lighthouse to the top, dusk lighting, waves lapping the rocks\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"input_reference\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.apiyi.com/v1/videos")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nveo-3.1-fast-generate-preview\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nCamera slowly rises from the base of the lighthouse to the top, dusk lighting, waves lapping the rocks\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"input_reference\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1/videos")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nveo-3.1-fast-generate-preview\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nCamera slowly rises from the base of the lighthouse to the top, dusk lighting, waves lapping the rocks\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"input_reference\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "task_xxxxxxxxxxxxxxxx",
"task_id": "task_xxxxxxxxxxxxxxxx",
"object": "video",
"model": "veo-3.1-fast-generate-preview",
"status": "queued",
"progress": 0,
"created_at": 1775025000,
"completed_at": 1775025090
}VEO 3.1 公式画像から動画へのAPI
VEO 3.1 の公式画像から動画へのAPIリファレンスと対話型Playground — 静止ビジュアルを動かすために、単一の input_reference 画像を multipart アップロードします。
curl --request POST \
--url https://api.apiyi.com/v1/videos \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form model=veo-3.1-fast-generate-preview \
--form 'prompt=Camera slowly rises from the base of the lighthouse to the top, dusk lighting, waves lapping the rocks' \
--form input_reference='@example-file'import requests
url = "https://api.apiyi.com/v1/videos"
files = { "input_reference": ("example-file", open("example-file", "rb")) }
payload = {
"model": "veo-3.1-fast-generate-preview",
"prompt": "Camera slowly rises from the base of the lighthouse to the top, dusk lighting, waves lapping the rocks"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('model', 'veo-3.1-fast-generate-preview');
form.append('prompt', 'Camera slowly rises from the base of the lighthouse to the top, dusk lighting, waves lapping the rocks');
form.append('input_reference', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.apiyi.com/v1/videos', 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.apiyi.com/v1/videos",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nveo-3.1-fast-generate-preview\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nCamera slowly rises from the base of the lighthouse to the top, dusk lighting, waves lapping the rocks\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"input_reference\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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.apiyi.com/v1/videos"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nveo-3.1-fast-generate-preview\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nCamera slowly rises from the base of the lighthouse to the top, dusk lighting, waves lapping the rocks\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"input_reference\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.apiyi.com/v1/videos")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nveo-3.1-fast-generate-preview\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nCamera slowly rises from the base of the lighthouse to the top, dusk lighting, waves lapping the rocks\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"input_reference\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1/videos")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nveo-3.1-fast-generate-preview\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nCamera slowly rises from the base of the lighthouse to the top, dusk lighting, waves lapping the rocks\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"input_reference\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "task_xxxxxxxxxxxxxxxx",
"task_id": "task_xxxxxxxxxxxxxxxx",
"object": "video",
"model": "veo-3.1-fast-generate-preview",
"status": "queued",
"progress": 0,
"created_at": 1775025000,
"completed_at": 1775025090
}Bearer sk-xxx)、参照画像をアップロードして、prompt を入力し、model / seconds / resolution を選択してから送信してください。Default グループで動作します — 専用のグループ切り替えは不要です。- Content-Type は
multipart/form-dataでなければなりません(JSON ではありません) - サポートされる参照画像は 1 枚のみです。フィールド名は
input_referenceに固定されています。複数画像を送信しても、最初の 1 枚だけが保持されます - リモート URL は受け付けられません。ファイルアップロードまたは Base64 が必要です
- 対応形式:
image/jpeg/image/png/image/webp - 長さフィールド名は
secondsです(durationではありません)。また、文字列"4"/"6"/"8"でなければなりません。これをdurationとして指定すると静かに無視され、デフォルトの 4 秒にフォールバックします。数値を渡すと失敗します - 1080p / 4k では、
secondsは"8"でなければなりません
-fl シリーズを使用してください。コードサンプル
Python (OpenAI SDK · ローレベル client.post)
{/* OpenAI SDK has no videos.create method; /v1/videos is a custom path, use low-level client.post() */}
from openai import OpenAI
import time
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://api.apiyi.com/v1"
)
# Step 1: multipart upload (low-level client.post handles multipart boundary)
with open("./lighthouse.png", "rb") as f:
resp = client.post(
"/videos",
body=None,
files={
"input_reference": ("lighthouse.png", f, "image/png")
},
extra_body={
"model": "veo-3.1-fast-generate-preview",
"prompt": "Camera slowly rises from the base of the lighthouse to the top, dusk lighting, ocean ambience",
"seconds": "8", # must be string
"size": "1280x720",
"resolution": "720p",
"aspectRatio": "16:9"
},
cast_to=dict
)
task_id = resp["task_id"]
print(f"Task ID: {task_id}, status: {resp['status']}")
# Step 2: poll (up to 3 minutes)
deadline = time.time() + 180
while time.time() < deadline:
s = client.get(f"/videos/{task_id}", cast_to=dict)
print(f"Status: {s['status']}, progress: {s.get('progress', 0)}%")
if s["status"] == "completed":
break
if s["status"] == "failed":
raise RuntimeError(f"Generation failed: {s}")
time.sleep(8)
# Step 3: download (with retry)
import urllib.request, urllib.error
time.sleep(4)
for i in range(5):
try:
req = urllib.request.Request(
f"https://api.apiyi.com/v1/videos/{task_id}/content",
headers={"Authorization": "Bearer sk-your-api-key"}
)
with urllib.request.urlopen(req, timeout=180) as r, open("output.mp4", "wb") as f:
while chunk := r.read(1 << 16):
f.write(chunk)
break
except urllib.error.HTTPError:
if i == 4:
raise
time.sleep(4)
print("Saved: output.mp4")
Python(requests + マルチパート)
import requests
import time
API_KEY = "sk-your-api-key"
BASE_URL = "https://api.apiyi.com/v1"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
# Step 1: multipart upload of reference image + form fields
with open("./lighthouse.png", "rb") as f:
resp = requests.post(
f"{BASE_URL}/videos",
headers=HEADERS, # do not set Content-Type manually; requests handles multipart boundary
data={
"model": "veo-3.1-fast-generate-preview",
"prompt": "Camera slowly rises from the base of the lighthouse to the top, dusk lighting, waves lapping the rocks",
"seconds": "8", # string, not number
"size": "1280x720",
"resolution": "720p",
"aspectRatio": "16:9",
"seed": "20260521"
},
files={
"input_reference": ("lighthouse.png", f, "image/png")
},
timeout=60 # multipart upload of large images may be slow
).json()
task_id = resp["task_id"]
print(f"Task ID: {task_id}")
# Step 2: poll
deadline = time.time() + 180
while time.time() < deadline:
s = requests.get(f"{BASE_URL}/videos/{task_id}", headers=HEADERS).json()
print(f"Status: {s['status']}, progress: {s.get('progress', 0)}%")
if s["status"] == "completed":
break
if s["status"] == "failed":
raise RuntimeError(s)
time.sleep(8)
# Step 3: download (with 3 retries)
time.sleep(4)
for i in range(5):
try:
with requests.get(
f"{BASE_URL}/videos/{task_id}/content",
headers=HEADERS, stream=True, timeout=180
) as r:
r.raise_for_status()
with open("output.mp4", "wb") as f:
for chunk in r.iter_content(chunk_size=8192):
f.write(chunk)
break
except requests.HTTPError:
if i == 4:
raise
time.sleep(4)
print("Saved: output.mp4")
cURL (マルチパートアップロード)
{/* Just want to check/download with an existing task_id? See the "Already have a task_id?" section below */}
{/* Step 1: multipart upload (input_reference uses @ to reference a local file) */}
RESP=$(curl -sS -X POST "https://api.apiyi.com/v1/videos" \
-H "Authorization: Bearer sk-your-api-key" \
-F "model=veo-3.1-fast-generate-preview" \
-F "prompt=Camera slowly rises from the base of the lighthouse to the top, dusk lighting" \
-F "seconds=8" \
-F "size=1280x720" \
-F "resolution=720p" \
-F "aspectRatio=16:9" \
-F "input_reference=@./lighthouse.png;type=image/png")
TASK_ID=$(echo "$RESP" | python3 -c 'import sys,json;print(json.load(sys.stdin)["task_id"])')
echo "task_id=$TASK_ID"
{/* Step 2: poll */}
while :; do
S=$(curl -sS -H "Authorization: Bearer sk-your-api-key" "https://api.apiyi.com/v1/videos/$TASK_ID")
ST=$(echo "$S" | python3 -c 'import sys,json;print(json.load(sys.stdin)["status"])')
echo "status=$ST"
[ "$ST" = "completed" ] && break
[ "$ST" = "failed" ] && { echo "$S"; exit 1; }
sleep 8
done
{/* Step 3: download (--retry covers occasional 400 right after status=completed) */}
sleep 4
curl -sSL --retry 3 --retry-delay 4 \
-H "Authorization: Bearer sk-your-api-key" \
"https://api.apiyi.com/v1/videos/$TASK_ID/content" \
-o output.mp4
ls -lh output.mp4
Node.js(ネイティブ fetch + FormData)
import fs from 'node:fs';
import { FormData, File } from 'undici';
const API_KEY = 'sk-your-api-key';
const BASE_URL = 'https://api.apiyi.com/v1';
// Step 1: multipart upload
const buffer = fs.readFileSync('./lighthouse.png');
const form = new FormData();
form.append('model', 'veo-3.1-fast-generate-preview');
form.append('prompt', 'Camera slowly rises from the base of the lighthouse to the top, dusk lighting');
form.append('seconds', '8'); // string
form.append('size', '1280x720');
form.append('resolution', '720p');
form.append('aspectRatio', '16:9');
form.append('input_reference', new File([buffer], 'lighthouse.png', { type: 'image/png' }));
const submitResp = await fetch(`${BASE_URL}/videos`, {
method: 'POST',
headers: { 'Authorization': `Bearer ${API_KEY}` }, // do not set Content-Type manually
body: form
});
const { task_id } = await submitResp.json();
console.log(`Task ID: ${task_id}`);
// Step 2: poll
let status = 'queued';
while (status !== 'completed' && status !== 'failed') {
await new Promise(r => setTimeout(r, 8000));
const s = await (await fetch(`${BASE_URL}/videos/${task_id}`, {
headers: { 'Authorization': `Bearer ${API_KEY}` }
})).json();
status = s.status;
console.log(`Status: ${status}, progress: ${s.progress ?? 0}%`);
}
if (status === 'failed') throw new Error('Generation failed');
// Step 3: download (with retry)
await new Promise(r => setTimeout(r, 4000));
let videoBuffer;
for (let i = 0; i < 4; i++) {
try {
const resp = await fetch(`${BASE_URL}/videos/${task_id}/content`, {
headers: { 'Authorization': `Bearer ${API_KEY}` }
});
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
videoBuffer = Buffer.from(await resp.arrayBuffer());
break;
} catch (e) {
if (i === 3) throw e;
await new Promise(r => setTimeout(r, 4000));
}
}
fs.writeFileSync('output.mp4', videoBuffer);
console.log('Saved: output.mp4');
ブラウザ JavaScript(file input アップロード)
{/* Demo only; route through a backend proxy in production to avoid Key leakage */}
const fileInput = document.querySelector('input[type=file]');
const file = fileInput.files[0];
const form = new FormData();
form.append('model', 'veo-3.1-fast-generate-preview');
form.append('prompt', 'Animate this scene with a gentle camera push-in and natural ambient sound');
form.append('seconds', '4');
form.append('size', '720x1280');
form.append('resolution', '720p');
form.append('aspectRatio', '9:16');
form.append('input_reference', file);
const submitResp = await fetch('https://api.apiyi.com/v1/videos', {
method: 'POST',
headers: { 'Authorization': 'Bearer sk-your-api-key' },
body: form
});
const { task_id } = await submitResp.json();
console.log('Task ID:', task_id);
{/* After polling completes, route the /content endpoint through your backend proxy */}
task_id をすでにお持ちですか? 2つのコピペ用cURLコマンド
すでにtask_id をお持ちの場合(タスクを送信したときに返されるか、コンソールログに表示されます)、下の 2 つのプレースホルダーを置き換えて実行してください:
sk-your-api-key→ あなたの APIYI キーtask_xxxxxxxxxxxxxxxx→ あなたのタスク ID
1. タスクステータスを確認
curl "https://api.apiyi.com/v1/videos/task_xxxxxxxxxxxxxxxx" \
-H "Authorization: Bearer sk-your-api-key"
status: "completed" と表示されたらダウンロードできます。in_progress と表示された場合は、数秒待ってからもう一度確認してください。
2. 動画をダウンロード(output.mp4 として保存されます)
curl -L --retry 3 --retry-delay 4 \
"https://api.apiyi.com/v1/videos/task_xxxxxxxxxxxxxxxx/content" \
-H "Authorization: Bearer sk-your-api-key" \
-o output.mp4
/content エンドポイントには Authorization ヘッダーが必要です — URL をブラウザのアドレスバーに直接開くと 401 が返ります。--retry 3 は、status が completed に切り替わった直後にまれに発生する 400 をカバーしています(CDN の同期遅延)。パラメータ参照
| パラメータ | 型 | 必須 | デフォルト | 説明 |
|---|---|---|---|---|
input_reference | file | はい | — | 参照画像ファイル。フィールド名は固定で、画像は1枚のみ、image/jpeg / image/png / image/webp を受け付けます。リモートURLは受け付けません |
model | string | はい | — | veo-3.1-fast-generate-preview ($0.3/req) または veo-3.1-generate-preview ($1.2/req) |
prompt | string | はい | — | シーンをどのようにアニメーションさせるかを記述します: カメラの動き、オブジェクトの動作、ライティング、スタイル。generateAudioは渡さないでください。音声の意図は prompt に入れます |
seconds | string | いいえ | "8" | "4" / "6" / "8"。フィールドは seconds であり、duration ではありません(duration と名付けても黙って無視され、4秒にフォールバックします)。1080p/4k は "8" である必要があります |
size | string | いいえ | 1280x720 | 出力ピクセル |
resolution | string | いいえ | 720p | 720p / 1080p / 4k |
aspectRatio | string | いいえ | 16:9 | 16:9(横向き) / 9:16(縦向き) |
seed | int | いいえ | — | ランダムシード(マルチパートのフォームフィールド。文字列でエンコードされた数値でも問題ありません) |
- JSONモードでは
metadata.*の下にネストされます(例:metadata.resolution) - マルチパートモードではフォームフィールドとしてフラットになります(
resolution/aspectRatio/seedを直接指定) - 上のコードサンプルはすでにマルチパートの慣例を使っています
input_referenceを JSON ボディ内で Base64 文字列として送信する — マルチパートのファイルフィールドを使う必要があります- フィールド名を
image/reference/input_imageにする — 正確にinput_referenceである必要があります - 画像を2枚送る — サーバーは最初の1枚しか保持せず、2枚目は黙って破棄されます
- リモートURL(
https://cdn.../img.png)を送る — 受け付けません。ファイルまたは Base64 である必要があります
レスポンス形式
レスポンス構造は テキストから動画 と同じです。ステップ 1 ではtask_id + status: "queued" を返し、ステップ 2 のポーリングでは status + 大まかな progress を返し、ステップ 3 では /content から MP4 バイナリをダウンロードします。
{
"id": "task_xxxxxxxxxxxxxxxx",
"task_id": "task_xxxxxxxxxxxxxxxx",
"object": "video",
"model": "veo-3.1-fast-generate-preview",
"status": "queued",
"progress": 0,
"created_at": 1775025000
}
task_idはidと一致します。下流側はtask_idに統一してくださいvideo_urlフィールドはありません;GET /v1/videos/{task_id}/contentからダウンロードしてくださいprogressは 0 / 50 / 100 の間だけで変化し、線形ではありません/contentはstatusがcompletedに切り替わった直後に 400 を返すことがあります。4秒後に再試行してください- 画像から動画へのタスクは、対応するテキストから動画タスクより通常 10–30% 長くかかります(画像エンコードの追加ステップのため)
completed に達した時点で発生し、モデル名ごとにリクエスト単位で課金されます(input_reference が指定されているかどうかにかかわらず適用されます。高速 $0.3 / 標準 $1.2)。POST 送信、ポーリング、ダウンロード自体は 課金されません。失敗したタスクも 課金されません。承認
API Key from APIYI console (Default group + Pay-per-request or Pay-as-you-go Priority Token; pure Pay-as-you-go not supported)
ボディ
Model ID (per-request billing):
veo-3.1-fast-generate-preview— $0.3/requestveo-3.1-generate-preview— $1.2/request
veo-3.1-fast-generate-preview, veo-3.1-generate-preview Video generation prompt. Focus on how the scene should animate: camera motion, object action, lighting, audio atmosphere. Do not pass generateAudio — audio intent goes in the prompt.
"Camera slowly rises from the base of the lighthouse to the top, dusk lighting, waves lapping the rocks"
Reference image file. Field name is fixed as input_reference, only 1 image supported.
Accepted formats: image/jpeg / image/png / image/webp. Remote URLs not accepted — must be a file upload or Base64.
Video length. The field name is seconds (not duration), a string enum: "4" / "6" / "8". Sending duration is silently ignored and falls back to the default 4 sec. Must be "8" at 1080p / 4k.
4, 6, 8 Output pixel dimensions; lower precedence than resolution
1280x720, 720x1280, 1920x1080, 1080x1920, 3840x2160, 2160x3840 Resolution tier (multipart mode flattens this as a top-level form field; higher precedence than size)
720p, 1080p, 4k Aspect ratio: 16:9 landscape (default) or 9:16 portrait
16:9, 9:16 Random seed (multipart form field; string-encoded number is fine). Fixed seed clusters outputs in style but does not byte-reproduce.
"20260521"
Negative prompt; recommended "blurry, watermark, distorted, low quality"
"blurry, watermark, distorted, low quality"
レスポンス
Task submitted; returns task_id and queued status
Task ID (matches task_id; downstream should standardize on task_id)
"task_xxxxxxxxxxxxxxxx"
Task ID for subsequent polling and download
"task_xxxxxxxxxxxxxxxx"
Object type, fixed to video
"video"
Model ID used for this task
"veo-3.1-fast-generate-preview"
Task status:
queued— submitted, awaiting processingin_progress— generatingcompleted— done, downloadable (/v1/videos/{task_id}/content)failed— failed (not billed), retry possible
queued, in_progress, completed, failed "queued"
Generation progress (coarse-grained, jumps only between 0 / 50 / 100)
0
Task creation Unix timestamp (seconds)
1775025000
Task completion Unix timestamp (seconds); only present for completed status
1775025090
このページは役に立ちましたか?