Long Video

Long Video creates a connected 4–180 second video from one prompt. Choose HappyHorse or Seedance as the generation provider and track the asynchronous task through the standard task endpoint or a callback.

Model

ModelDescription
long-videoLong-form prompt-to-video generation with optional global image references

When provider is set to seedance, Long Video uses Seedance 2.0 as the underlying generation model.

Pricing

Completed tasks are billed by requested duration, resolution, and provider.

ProviderResolutionCredits per second
HappyHorse720p27.5
HappyHorse1080p47.2
Seedance480p21.6
Seedance720p45.6
Seedance1080p114

Credits are pre-charged when the task is created and fully refunded if generation fails.

Create a task

POST https://api.aivideoapi.ai/v1/videos/generations

Request body

FieldTypeRequiredDescription
modelstringYesMust be long-video
inputobjectYesGeneration parameters
callback_urlstringNoReceives the standard task completion or failure callback

Input parameters

FieldTypeRequiredDescription
promptstringYesVideo description, 1–2500 characters
durationintegerYesOutput duration from 4 to 180 seconds
providerstringNohappyhorse (default) or seedance
resolutionstringNoDefault 720p; HappyHorse supports 720p/1080p, Seedance supports 480p/720p/1080p
aspect_ratiostringNoDefault 16:9; supports 16:9, 9:16, 1:1, 4:3, 3:4
continuity_modestringNoconsistent (default) or seamless
stylestringNoOptional style direction, up to 500 characters
image_urlsstring[]NoUp to five global reference images; only valid in consistent mode
native_audio_continuitybooleanNoSeedance only; default false
seedintegerNoRandom seed from 0 to 2147483647; default 42

Example

curl -X POST https://api.aivideoapi.ai/v1/videos/generations \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "long-video",
    "callback_url": "https://your-server.com/webhook",
    "input": {
      "prompt": "A traveler follows a river from the mountains to a coastal city",
      "duration": 60,
      "provider": "seedance",
      "resolution": "720p",
      "aspect_ratio": "16:9",
      "continuity_mode": "consistent",
      "image_urls": ["https://example.com/character.jpg"],
      "native_audio_continuity": true
    }
  }'

Response

{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "8b6a5162-5c91-4a42-8e80-4c8ef5486f24"
  }
}

Query the task

curl https://api.aivideoapi.ai/v1/tasks/{taskId} \
  -H "Authorization: Bearer sk-your-api-key"

The task moves from pending to processing, then to completed or failed. A completed task returns the final video in output.urls.


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.