Semua permintaan dikirim ke https://genjutsu.top. Kirim kunci API Genjutsu sebagai bearer token. POST https://genjutsu.top/v1/media/generate · Authorization: Bearer $GENJUTSU_API_KEY · Scope yang diperlukan: generate, read, assets
curl -X POST "https://genjutsu.top/v1/media/generate" \
-H "Authorization: Bearer $GENJUTSU_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "veo-3.1",
"mode": "t2v",
"params": {
"prompt": "A lighthouse on a rocky cliff at golden hour, soft clouds, cinematic light"
}
}'
Permintaan dengan parameter opsional
curl -X POST "https://genjutsu.top/v1/media/generate" \
-H "Authorization: Bearer $GENJUTSU_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "veo-3.1",
"mode": "t2v",
"params": {
"count": 1,
"prompt": "A lighthouse on a rocky cliff at golden hour, soft clouds, cinematic light",
"duration": 8,
"aspect_ratio": "9:16",
"video_upscale": "none"
}
}'
veo-3.1
Image to Video i2v
Parameter
Tipe
Wajib
Default
Detail
prompt
string
Wajib
-
hingga 50000 karakter
video_mode
salah satu dari
Opsional
"image-to-video"
"image-to-video"Single image
"multi-image-to-video"Reference images
"batch-frame"Start and end frames
image_url
ID aset image
Wajib
-
menerima image/png, image/jpeg, image/webp; hingga 1 berkas
end_image_url
ID aset image
Wajib
-
menerima image/png, image/jpeg, image/webp; hingga 1 berkas
images_list
daftar ID aset image
Wajib
-
menerima image/png, image/jpeg, image/webp; minimal 1 berkas; hingga 3 berkas
aspect_ratio
salah satu dari
Opsional
"9:16"
"16:9"
"9:16"
duration
salah satu dari
Opsional
8
44 seconds
66 seconds
88 seconds
video_upscale
salah satu dari
Opsional
"none"
"none"720p
"1080p"
"2k"2K
count
integer
Opsional
1
rentang 1 sampai 4; langkah 1
Permintaan minimal
image_url: Replace with the asset ID of your own uploaded image (upload it with POST /v1/assets/uploads first). Accepted types: image/png, image/jpeg, image/webp.
# Media IDs below are placeholders: replace them with your own uploaded assets before running this.
curl -X POST "https://genjutsu.top/v1/media/generate" \
-H "Authorization: Bearer $GENJUTSU_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "veo-3.1",
"mode": "i2v",
"params": {
"prompt": "A lighthouse on a rocky cliff at golden hour, soft clouds, cinematic light",
"image_url": "asset:00000000-0000-4000-8000-000000000001"
}
}'
Permintaan dengan parameter opsional
image_url: Replace with the asset ID of your own uploaded image (upload it with POST /v1/assets/uploads first). Accepted types: image/png, image/jpeg, image/webp.
# Media IDs below are placeholders: replace them with your own uploaded assets before running this.
curl -X POST "https://genjutsu.top/v1/media/generate" \
-H "Authorization: Bearer $GENJUTSU_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "veo-3.1",
"mode": "i2v",
"params": {
"count": 1,
"prompt": "A lighthouse on a rocky cliff at golden hour, soft clouds, cinematic light",
"duration": 8,
"image_url": "asset:00000000-0000-4000-8000-000000000001",
"video_mode": "image-to-video",
"aspect_ratio": "9:16",
"video_upscale": "none"
}
}'
Kirim permintaan ke POST /v1/media/generate. Server membalas 202 dengan task_id. Polling GET /v1/media/tasks/{task_id} setiap 5 detik sampai is_final bernilai true: statusnya lalu succeeded, failed, atau cancelled dan task yang sama memuat hasil (outputs) atau galat (error_code dan error_message). Mengirim ulang dengan Idempotency-Key yang sama mengembalikan task asli. ID dan URL pada respons hanya ilustrasi.
# Needs curl and jq.
# 1. Submit. The response is 202 with task_id, state and credits_held.
ID=$(curl -s -X POST "https://genjutsu.top/v1/media/generate" \
-H "Authorization: Bearer $GENJUTSU_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "veo-3.1",
"mode": "t2v",
"params": {
"prompt": "A lighthouse on a rocky cliff at golden hour, soft clouds, cinematic light"
}
}' | jq -r .task_id)
echo "task: $ID"
# 2. Poll every 5 seconds until is_final is true (state is then succeeded, failed or cancelled).
while true; do
TASK=$(curl -s "https://genjutsu.top/v1/media/tasks/$ID" -H "Authorization: Bearer $GENJUTSU_API_KEY")
echo "state: $(echo "$TASK" | jq -r .state)"
[ "$(echo "$TASK" | jq -r .is_final)" = "true" ] && break
sleep 5
done
# 3. The final task carries the result: outputs[].url when succeeded, error_code and error_message when failed.
echo "$TASK" | jq '{state, outputs, error_code, error_message, credits}'
Galat memakai kode huruf kecil dan menyertakan retryable serta request_id. Pembatalan yang tertunda bukan pembatalan: jika model tetap selesai, task masih bisa ditagih. Lihat referensi API untuk pembatalan.
API gaya resource (alternatif)
POST /v1/generations menerima nilai yang sama di inputs (dan quote_id opsional) dan membalas dengan resource generation: polling GET /v1/generations/{id} berdasarkan id sampai status-nya succeeded, failed, atau cancelled, lalu ambil GET /v1/generations/{id}/result. Kode galatnya HURUF BESAR. Integrasi baru sebaiknya memakai API media di atas; keduanya memakai alur dan harga yang sama.
# Needs curl and jq.
# 1. Submit. The response is 202 with the generation id.
ID=$(curl -s -X POST "https://genjutsu.top/v1/generations" \
-H "Authorization: Bearer $GENJUTSU_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"mode": "t2v",
"model": "veo-3.1",
"inputs": {
"prompt": "A lighthouse on a rocky cliff at golden hour, soft clouds, cinematic light"
}
}' | jq -r .id)
echo "generation: $ID"
# 2. Poll until the status is succeeded, failed or cancelled.
while true; do
STATUS=$(curl -s "https://genjutsu.top/v1/generations/$ID" -H "Authorization: Bearer $GENJUTSU_API_KEY" | jq -r .status)
echo "status: $STATUS"
case "$STATUS" in succeeded|failed|cancelled) break ;; esac
sleep 2
done
# 3. Fetch the result (only available once the status is succeeded).
curl -s "https://genjutsu.top/v1/generations/$ID/result" -H "Authorization: Bearer $GENJUTSU_API_KEY"