Wan 3.0 Video API

Wan 3.0 All-in-One exposes text-to-video, first/last-frame animation, multimodal reference generation, document understanding, and public web-page input through one public model: wan-3.0-video.

This integration uses Alibaba Bailian's invited Beijing Workspace API. The documented output tiers are 480p, 720p, and 1080p; this API does not advertise unverified native 4K output. See the official Wan 3.0 documentation and Alibaba Cloud model pricing.

Pricing

ResolutionCredits per billable second5-second text-only request
480p1260 credits
720p24120 credits
1080p48240 credits

Without reference video, billable seconds equal the requested output duration. With video_urls, billing is:

(detected input video seconds + requested output seconds) × resolution rate

Images, audio, files, and web pages do not add input-video seconds. For example, 4.5 seconds of reference video plus 5 seconds of 720p output costs (4.5 + 5) × 24 = 228 credits.

Create a task

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

Request body

FieldTypeRequiredDescription
modelstringYesFixed value: wan-3.0-video
inputobjectYesPrompt, media, and output controls
callback_urlstringNoPublic callback URL for terminal task notifications

input.prompt and the media fields are optional individually, but at least one prompt or media value is required.

Input fields

FieldTypeDefaultDescription
promptstringUp to 20,000 characters
first_frame_urlstringPublic HTTP(S) first-frame image URL
last_frame_urlstringPublic HTTP(S) last-frame URL; requires first_frame_url
image_urlsstring[][]Up to 10 reference images
video_urlsstring[][]Up to 5 MP4/MOV references; each 1–15s, 15s total
audio_urlsstring[][]Up to 5 MP3/WAV references; each 1–15s, 15s total
file_urlstringOne public document URL
link_urlstringOne public, login-free web page URL
resolutionstring1080p480p, 720p, or 1080p
aspect_ratiostringadaptiveadaptive, 16:9, 4:3, 1:1, 3:4, or 9:16
durationinteger52–30 output seconds; -1 is not accepted
audiobooleantrueInclude an audio track
seedinteger0–2147483647
watermarkbooleanfalseAdd a watermark

Only public HTTP(S) URLs are accepted. Base64 data, OSS URIs, credentials in URLs, localhost, and private network addresses are outside the public contract.

Mode and duration rules

  • First/last-frame mode cannot be combined with image_urls, video_urls, audio_urls, file_url, or link_url.
  • last_frame_url cannot be sent without first_frame_url.
  • file_url and link_url are mutually exclusive.
  • Reference media remain in their array order. In prompts, images, videos, and audio are numbered independently.
  • Input video duration plus output duration cannot exceed 30 seconds.
  • Automatic duration=-1 is rejected because the platform pre-charges an exact estimate.

Create response

HTTP 200 returns the platform task ID immediately. Use data.taskId with the task-query endpoint.

{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "cbf6b69d-4f03-4817-8ed7-94c0292184a8"
  }
}

Examples

Text-to-video

curl -X POST https://api.aivideoapi.ai/v1/videos/generations \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan-3.0-video",
    "callback_url": "https://your-server.com/webhook",
    "input": {
      "prompt": "A cat runs across a moonlit rooftop above a neon city, cinematic camera motion",
      "resolution": "1080p",
      "aspect_ratio": "16:9",
      "duration": 5,
      "audio": true
    }
  }'

First and last frames

{
  "model": "wan-3.0-video",
  "input": {
    "prompt": "The expression changes from a smile to laughter as warm light fills the room",
    "first_frame_url": "https://example.com/first.jpg",
    "last_frame_url": "https://example.com/last.jpg",
    "duration": 6
  }
}

Mixed references

{
  "model": "wan-3.0-video",
  "input": {
    "prompt": "Video 1 supplies the camera move, Image 1 supplies the character, and Audio 1 guides the music",
    "image_urls": ["https://example.com/character.png"],
    "video_urls": ["https://example.com/camera.mp4"],
    "audio_urls": ["https://example.com/music.mp3"],
    "resolution": "720p",
    "duration": 5
  }
}

Use file_url for a supported public document or link_url for a public page. Do not send both in one request.

Query task status

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

Task statuses are pending, processing, completed, and failed. Confirmed failures refund the pre-charge once. Completed tasks are never refunded. An expired upstream UNKNOWN record becomes a non-refundable failed task for manual reconciliation. Wan 3.0 tasks do not support cancellation.

Pending response

{
  "id": "cbf6b69d-4f03-4817-8ed7-94c0292184a8",
  "status": "pending",
  "model": "wan-3.0-video",
  "credits_consumed": 0,
  "created_at": 1786330800,
  "estimated_seconds": 300
}

Processing response

{
  "id": "cbf6b69d-4f03-4817-8ed7-94c0292184a8",
  "status": "processing",
  "model": "wan-3.0-video",
  "credits_consumed": 0,
  "created_at": 1786330800,
  "progress": null
}

Completed response

{
  "id": "cbf6b69d-4f03-4817-8ed7-94c0292184a8",
  "status": "completed",
  "model": "wan-3.0-video",
  "credits_consumed": 240,
  "created_at": 1786330800,
  "completed_at": 1786330928,
  "output": {
    "urls": [
      "https://dashscope-result.oss-cn-beijing.aliyuncs.com/example.mp4"
    ],
    "metadata": {
      "usage": {
        "duration": 5,
        "input_video_duration": 0,
        "output_video_duration": 5,
        "video_count": 1,
        "fps": 24,
        "SR": 1080,
        "ratio": "16:9"
      }
    }
  },
  "usage": {
    "total_seconds": 5,
    "input_seconds": 0,
    "output_seconds": 5,
    "video_count": 1,
    "fps": 24,
    "resolution": 1080,
    "ratio": "16:9"
  }
}

credits_consumed is 0 while the task is in progress and after a confirmed failure has been refunded. On success it contains the final charge. usage is returned on successful WAN 3.0 tasks when the provider supplies the corresponding values.

Failed response

{
  "id": "cbf6b69d-4f03-4817-8ed7-94c0292184a8",
  "status": "failed",
  "model": "wan-3.0-video",
  "credits_consumed": 0,
  "created_at": 1786330800,
  "error": {
    "code": "upstream_error",
    "message": "The request failed because an input parameter was rejected."
  }
}

For an expired upstream UNKNOWN record, the response is also failed, but credits_consumed retains the pre-charge because that state is not automatically refundable. If callback_url was supplied, completed and failed callbacks use the same terminal payload shape shown above.

Successful upstream result URLs expire after approximately 24 hours. If your account has Bailian R2 mirroring enabled, the platform stores the result; otherwise download the provider URL promptly.


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.