Genjutsu 1.0
Genjutsu 1.0 generates a new video from one source video and 1–20 reference images. It has two modes:
mode | What it does |
|---|---|
motion_control | Motion transfer: the person in the reference images performs the motion of the source video |
replace_object | Object replacement: an object in the source video is replaced with the object in the reference images |
Output resolution is 480p, 720p or 1080p, and the source video can be up to 30 seconds long.
Model
| Model name | Description |
|---|---|
genjutsu-1.0 | Source video + reference images to video (motion transfer / object replacement) |
Pricing
Cost = billed seconds of the source video × the per-second price of the chosen resolution:
| Resolution | Credits/s | 5s | 15s | 30s |
|---|---|---|---|---|
480p | 35.1 | 175.5 | 526.5 | 1053 |
720p | 81.9 | 409.5 | 1228.5 | 2457 |
1080p | 234 | 1170 | 3510 | 7020 |
Billed seconds are calculated by the server from the probed source video duration. They are never supplied by the client:
motion_control: rounded to the nearest whole second, with a minimum of 4 seconds.replace_object: rounded up to the whole second; the source video must be 4–30 seconds.- Encoding noise of a few tens of milliseconds is ignored (a file reporting 30.02 seconds counts as 30 seconds).
If the duration cannot be detected (the URL is unreachable or not MP4/MOV), the video is longer than 30 seconds, or a replace_object video is shorter than 4 seconds, task creation returns a 400 error and no credits are charged. Credits are pre-charged when the task is created and fully refunded if it fails. Prices are before account multipliers.
Create Task
POST https://api.aivideoapi.ai/v1/videos/generations
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | genjutsu-1.0 |
input | object | Yes | Generation parameters |
callback_url | string | No | URL that receives task completion/failure notifications |
Input Parameters
| Field | Type | Required | Description |
|---|---|---|---|
mode | string | Yes | motion_control or replace_object |
video_urls | string[] | Yes | Exactly 1 source video URL. MP4/MOV, up to 30 seconds; replace_object requires 4–30 seconds. Billing uses this video's duration. |
image_urls | string[] | Yes | 1–20 reference image URLs in common image formats. |
resolution | string | No | 480p, 720p (default) or 1080p. Determines the per-second price. |
prompt | string | No | Up to 5000 characters. Use @Image1…@Image20 for the images in image_urls (in order) and @Video1 for the source video. |
All media must be public, directly downloadable HTTP(S) URLs (base64 / data URLs are not supported) and must stay reachable until the task finishes. There is no duration parameter: the output length follows the source video.
Examples
Motion transfer
curl -X POST https://api.aivideoapi.ai/v1/videos/generations \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "genjutsu-1.0",
"callback_url": "https://your-server.com/webhook",
"input": {
"mode": "motion_control",
"video_urls": ["https://example.com/dance.mp4"],
"image_urls": ["https://example.com/person.png"],
"resolution": "720p",
"prompt": "@Image1 performs the dance in @Video1"
}
}'
Object replacement (1080p)
curl -X POST https://api.aivideoapi.ai/v1/videos/generations \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "genjutsu-1.0",
"input": {
"mode": "replace_object",
"video_urls": ["https://example.com/street.mp4"],
"image_urls": ["https://example.com/red-car.png"],
"resolution": "1080p",
"prompt": "Replace the car in @Video1 with the red sports car in @Image1"
}
}'
Response
{
"code": 200,
"msg": "success",
"data": {
"taskId": "8b6a5162-5c91-4a42-8e80-4c8ef5486f24"
}
}
Query Task
curl https://api.aivideoapi.ai/v1/tasks/{taskId} \
-H "Authorization: Bearer sk-your-api-key"
Status flow: pending -> processing -> completed or failed. Generation usually takes a few minutes; prefer callback_url, or poll no more often than every 15 seconds.
- On success the video URL is in
output.urls[0]. It is valid for 24 hours, so download and save it promptly. - If the task fails, the pre-charged credits are fully refunded.
- Tasks for this model cannot be cancelled after submission.
Callback
Pass callback_url when creating the task and the system will POST to your URL when the task completes or fails. See Callbacks for headers and the retry policy.
Completed callback
{
"id": "8b6a5162-5c91-4a42-8e80-4c8ef5486f24",
"status": "completed",
"model": "genjutsu-1.0",
"created_at": 1795600000,
"completed_at": 1795600240,
"output": {
"urls": [
"https://file.aivideoapi.ai/videos/2026/11/25/abc.mp4"
]
}
}
Failed callback
{
"id": "57c8772c-f834-46f3-9b7d-81f92e104050",
"status": "failed",
"model": "genjutsu-1.0",
"created_at": 1795600000,
"error": {
"code": "upstream_error",
"message": "The source video or a reference image could not be read. Ensure every URL is public and directly downloadable (video: MP4 or MOV)."
}
}
Common failure reasons: the prompt or media was rejected by the content policy, the source video or a reference image could not be read, the source video duration is out of range, or a general generation failure.
Notes
- Return a 2xx status as soon as you receive the callback (within 3 seconds is recommended). A non-2xx response or a timeout (10 seconds) triggers up to 3 retries (3 minutes and 10 minutes apart).
- Deduplicate on
X-Task-Idso the same task is not stored twice. GET /v1/tasks/{taskId}is the source of truth for the final status; if all 3 callbacks fail you can still poll.
Error Codes
When a request fails, the API returns a JSON error response:
{
"error": {
"code": "insufficient_credits",
"message": "Your credit balance is too low. Please top up.",
"type": "billing_error"
}
}
Error Reference
| HTTP Status | Code | Type | Description |
|---|---|---|---|
| 400 | invalid_request | invalid_request_error | Missing or invalid parameters |
| 401 | invalid_api_key | authentication_error | API key is invalid, disabled, or deleted |
| 402 | insufficient_credits | billing_error | Credit balance too low, please top up |
| 403 | ip_not_allowed | permission_error | Request IP not in the key's allowlist |
| 404 | model_not_found | invalid_request_error | Model does not exist or is inactive |
| 404 | task_not_found | invalid_request_error | Task ID does not exist |
| 429 | rate_limit_exceeded | rate_limit_error | Too many requests, please slow down |
| 429 | spend_limit_exceeded | billing_error | Key spend limit reached (hourly/daily/total) |
| 500 | internal_error | api_error | Unexpected server error |
| 503 | upstream_error | upstream_error | Upstream AI provider returned an error |
Common Scenarios
invalid_request (400)
Returned when required fields are missing or invalid.
{
"error": {
"code": "invalid_request",
"message": "'model' is required.",
"type": "invalid_request_error"
}
}
insufficient_credits (402)
Your balance is too low. Check your balance with GET /v1/credits and top up in Dashboard > Billing.
invalid_api_key (401)
Possible causes:
- The key does not start with
sk- - The key has been disabled or deleted
- The user account has been banned
upstream_error (503)
The upstream AI provider returned an error. This may happen when:
- The input contains sensitive or prohibited content
- The provider is temporarily unavailable
- The request parameters are not supported by the provider
Credits are automatically refunded when a task fails due to upstream errors.