Genjutsu 1.0

Genjutsu 1.0 generates a new video from one source video and 1–20 reference images. It has two modes:

modeWhat it does
motion_controlMotion transfer: the person in the reference images performs the motion of the source video
replace_objectObject 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 nameDescription
genjutsu-1.0Source 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:

ResolutionCredits/s5s15s30s
480p35.1175.5526.51053
720p81.9409.51228.52457
1080p234117035107020

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

FieldTypeRequiredDescription
modelstringYesgenjutsu-1.0
inputobjectYesGeneration parameters
callback_urlstringNoURL that receives task completion/failure notifications

Input Parameters

FieldTypeRequiredDescription
modestringYesmotion_control or replace_object
video_urlsstring[]YesExactly 1 source video URL. MP4/MOV, up to 30 seconds; replace_object requires 4–30 seconds. Billing uses this video's duration.
image_urlsstring[]Yes1–20 reference image URLs in common image formats.
resolutionstringNo480p, 720p (default) or 1080p. Determines the per-second price.
promptstringNoUp 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-Id so 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 StatusCodeTypeDescription
400invalid_requestinvalid_request_errorMissing or invalid parameters
401invalid_api_keyauthentication_errorAPI key is invalid, disabled, or deleted
402insufficient_creditsbilling_errorCredit balance too low, please top up
403ip_not_allowedpermission_errorRequest IP not in the key's allowlist
404model_not_foundinvalid_request_errorModel does not exist or is inactive
404task_not_foundinvalid_request_errorTask ID does not exist
429rate_limit_exceededrate_limit_errorToo many requests, please slow down
429spend_limit_exceededbilling_errorKey spend limit reached (hourly/daily/total)
500internal_errorapi_errorUnexpected server error
503upstream_errorupstream_errorUpstream 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.