APIMODELSAPIMODELS
API 문서

apimodels.app

View .md

HappyWan API

HappyWan is Alibaba's limited-time preview video model, open on apimodels.app until 2026-12-07 23:59 (GMT+8). One model name covers text-to-video, first-frame / last-frame / first+last-frame video, and an all-in-one reference mode with up to 50 reference images, 10 reference videos and 10 audio clips; with reference_task_type it can also edit or extend a reference video. Clips run 2 to 45 seconds (or -1 to let the model decide) at 480P, 720P or 1080P in seven aspect ratios, with an audio track. Billed per second from $0.074; failed tasks are not charged. It runs on the unified apimodels.app video endpoint.

Limited-time preview

  • Open until 2026-12-07 23:59 GMT+8 (15:59 UTC). After that, new tasks return a 400 immediately — no balance is held and nothing is charged.
  • Upstream capacity is limited during the preview, so tasks may queue longer at peak times; prefer callback_url over aggressive polling.

Pricing (per second)

Billed on the seconds the upstream reports: output seconds, plus the seconds of any reference video at the same rate. Reference images and audio cost nothing extra, and switching the audio track off does not change the price.

ResolutionRate5s15s45s
480P$0.074/s$0.37$1.11$3.33
720P$0.148/s$0.74$2.22$6.66
1080P$0.295/s$1.475$4.425$13.275
  • Cost = rate × billable seconds. A 5-second 720P clip is $0.74; extending a 10-second reference video by 10 seconds bills as 20 seconds, $2.96.
  • With duration -1 (or omitted) the model picks the length: we hold the 45-second worst case, then charge the real seconds once known and refund the difference.
  • Failed tasks are not billed, including tasks refused by moderation.

Create a task

POST /api/v1/video/generations — async: create, then poll the same endpoint for the result.

# Step 1: Create task (text-to-video)
curl -X POST https://api.apimodels.app/v1/video/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "happywan",
    "prompt": "A red paper boat drifting down a rain-soaked city street at dusk, neon reflections, gentle camera follow",
    "resolution": "720P",
    "ratio": "16:9",
    "duration": 5
  }'

# Edit a reference video (duration must be -1: editing follows the source length)
curl -X POST https://api.apimodels.app/v1/video/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "happywan",
    "prompt": "Turn the scene in video 1 into a snowy winter night, keep the motion and camera",
    "reference_video_urls": ["https://example.com/your-clip.mp4"],
    "reference_task_type": "edit",
    "ratio": "adaptive",
    "duration": -1
  }'

# Step 2: Poll status
curl "https://api.apimodels.app/v1/video/generations?task_id=TASK_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"

Ways to drive it

ModeWhat you send
Text to videoprompt only
First / last / first+last framefirst_frame_url / last_frame_url
All-in-one referencereference_image_urls / reference_video_urls / reference_audio_urls, reference_task_type auto or reference
Video editreference_video_urls + reference_task_type: "edit", ratio adaptive, duration -1
Video extendreference_video_urls + reference_task_type: "extend", ratio adaptive; returns only the new segment
Character replacementreference_video_urls + reference_image_urls + reference_task_type: "edit", prompt like "replace the woman in video 1 with the character from figure 1"

Frame mode and reference mode are mutually exclusive in one request. In reference mode the prompt addresses materials positionally — "figure 1", "video 1", "audio 1", each type numbered on its own. reference_task_type defaults to auto, where the model infers from the prompt whether to generate from references, edit or extend; pass reference / edit / extend explicitly when you need a fixed behaviour.

Request parameters

FieldRequiredTypeDescription
modelYesstring"happywan" (alias "happywan-preview")
promptNostringText description, up to 20000 characters. Send at least one of prompt / media
first_frame_urlNostringFirst frame. Mutually exclusive with reference media
last_frame_urlNostringLast frame, on its own or together with a first frame
reference_image_urlsNostring[]Reference images, up to 50. Addressed in the prompt as "figure 1", "figure 2", …
reference_video_urlsNostring[]Reference videos, up to 10; their seconds are billed at the same rate. Required for edit and extend
reference_audio_urlsNostring[]Reference audio clips, up to 10
reference_task_typeNostring"auto" (default) / "reference" / "edit" / "extend". Anything but auto needs reference media; edit and extend need a reference video
resolutionNostring"480P" / "720P" / "1080P". Defaults to 720P when omitted
ratioNostring"adaptive", "21:9", "16:9", "4:3", "1:1", "3:4", "9:16". Edit and extend only accept adaptive (they keep the source aspect ratio)
durationNonumberWhole seconds from 2 to 45; -1 or omitted lets the model decide (45-second hold, settled on the real length). Edit requires -1
audioNobooleanWhether the output carries an audio track. Turning it off does not reduce the price
return_last_frameNobooleanWhen true, also returns the last frame of the clip as an image, in the task result as resultJson.lastFrameUrl
output_formatNostring"mp4" (default) or "mov"
watermarkNobooleanWhether to add a watermark
callback_urlNostringWebhook URL called when the task completes

seed and prompt_extend are not supported on this model and return a 400 instead of being silently ignored.

Getting the result

The create call returns data.taskId right away and the video renders in the background. GET the same endpoint with that task_id and read data.state: pending means still running, completed puts the video URL in data.resultUrls[0], and failed puts the reason in data.failMsg. Pass callback_url to skip polling.

  • Measured on our platform (2026-12-05, 720P): a 5-second text-to-video took 82 seconds; on a 4.7-second source clip, character replacement took 185 seconds, a scene edit 137 seconds and a 5-second extension 540 seconds (9 minutes). Extension is much slower — allow at least 15 minutes before timing out, or use callback_url. Poll every 10-15 seconds.
  • Extension (extend) returns only the newly generated segment, not the source clip. Its first frame continues from the source's last frame, so append it after your original yourself (for example with ffmpeg concat). Edit returns a complete new clip the same length as the source, and keeps the source's speech track.
  • Result videos are kept for 30 days and then deleted — download or re-host anything you want to keep.

Related

FAQ

How much does the HappyWan API cost?

Per second of output: $0.074 at 480P, $0.148 at 720P, $0.295 at 1080P, so a 5-second 720P clip is $0.74. Seconds of a reference video are billed at the same rate; reference images and audio are free. Failed or refused tasks are not charged.

How long is HappyWan available?

HappyWan is a limited-time preview open until 2026-12-07 23:59 GMT+8 (15:59 UTC). After that, new requests return a 400 immediately and nothing is held or charged.

Can HappyWan edit or extend an existing video?

Yes. Pass the clip in reference_video_urls and set reference_task_type to edit or extend. Both keep the source aspect ratio, so ratio must be adaptive, and editing follows the source length, so duration must be -1. The reference video seconds are billed together with the output. Extend returns only the new segment, not the source, so append it after your original yourself; edit returns a full clip the same length as the source and keeps its speech. In our 720P test on a 4.7-second clip, character replacement took 185 seconds, a scene edit 137 seconds and a 5-second extension 540 seconds.

How long can a HappyWan clip be?

2 to 45 seconds in whole seconds, or -1 to let the model choose. With -1 we hold the 45-second worst case and refund the difference after the real length is known. In our test a 5-second 720P clip came back in 82 seconds.