
テキストから画像
テキストプロンプトからAI画像を作成
Best Image AI で ByteDance Seedance 2.5 Flash API を使い、画像から動画を生成できます。動きを指定し、必要に応じて終了フレームを追加して、動画の終わり方を調整できます。
Seedance 2.5 Flash Image-to-Video は、Best Image AI 上で静止画に動きを付ける ByteDance の API モデルです。 必須の開始フレームが冒頭の構図を決めます。プロンプトに動きを記述し、特定の構図で クリップを終えたい場合は終了フレームも追加します。
注記 料金は選択した出力解像度と生成された動画の長さに基づいて決まります。画像とプロンプトは ByteDance のコンテンツ安全ガイドラインに沿ったものを使用してください。
ブラウザで画像や動画をすばやく制作できる複数のAIクリエイティブツールを試し、成功したアイデアをBest Image AIの本番運用対応モデルAPIでスケールできます。Best Image AIはすべてのモデルに対応する統合APIレイヤーを提供し、ワークフローを簡単に利用・拡張できるようにします。
// Step 1: Submit generation request
const response = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
model_name: 'seedance-v2.5-flash-image-to-video',
prompt: 'Gentle camera push-in; leaves rustle softly in the breeze',
resolution: '720p',
duration: 8,
sound: true,
image_url: 'https://example.com/first-frame.jpg',
image_end_url: 'https://example.com/last-frame.jpg'
})
});
const { data } = await response.json();
const taskId = data.task_id;
// Step 2: Poll for results
const taskId = data.task_id;
const pollResult = async (taskId) => {
const res = await fetch(`https://api.flaq.ai/api/v1/video/${taskId}`, {
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});
return res.json();
};
while (true) {
const pollResultData = await pollResult(taskId);
const status = pollResultData.data.task_status;
if (status === 'succeed') {
console.log(pollResultData.data.task_result.videos[].);
;
}
(status === ) {
.(pollResultData..);
;
}
( (resolve, ));
}
# Step 1: Submit generation request
import requests
response = requests.post(
'https://api.flaq.ai/api/v1/video/task',
headers={
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
json={
'model_name': 'seedance-v2.5-flash-image-to-video',
'prompt': 'Gentle camera push-in; leaves rustle softly in the breeze',
'resolution': '720p',
'duration': 8,
'sound': True,
'image_url': 'https://example.com/first-frame.jpg',
'image_end_url': 'https://example.com/last-frame.jpg'
}
)
result = response.json()
task_id = result['data']['task_id']
# Step 1: Submit generation request
curl -X POST https://api.flaq.ai/api/v1/video/task \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model_name": "seedance-v2.5-flash-image-to-video",
"prompt": "Gentle camera push-in; leaves rustle softly in the breeze",
"resolution": "720p",
"duration": 8,
"sound": true,
"image_url": "https://example.com/first-frame.jpg",
"image_end_url": "https://example.com/last-frame.jpg"
}'
# Step 2: Poll for results
# Replace {task_id} with the task_id returned from the submit response
curl -X GET "https://api.flaq.ai/api/v1/video/{task_id}" \
-H "Authorization: Bearer YOUR_API_KEY"
# Step 2: Poll for results
task_id = response.json()['data']['task_id']
poll_url = f"https://api.flaq.ai/api/v1/video/{task_id}"
while True:
poll_result = requests.get(poll_url, headers={'Authorization': 'Bearer YOUR_API_KEY'}).json()
status = poll_result['data']['task_status']
if status == 'succeed':
print(poll_result['data']['task_result']['videos'][0]['url'])
break
if status == 'failed':
print(poll_result['data']['task_status_msg'])
break
time.sleep(10)