> ## Documentation Index
> Fetch the complete documentation index at: https://docs.floodgate.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Wan and Happyhorse video APIs

> Generate Alibaba Wan and Happyhorse videos with nested input and parameters. Poll native tasks, download results, and check reviewed limits and second billing.

Generate Wan and Happyhorse videos with Alibaba's nested request format. Floodgate's native task URL returns a gateway task envelope.

## Operations and limits

| Method | Path | Purpose |
| - | - | - |
| POST | `/alibailian/api/v1/services/aigc/video-generation/video-synthesis` | Submit |
| GET | `/alibailian/api/v1/tasks/{task_id}` | Native polling |
| GET | `/v1/videos/{task_id}` | Compatible polling, when available |
| GET | `/v1/videos/{task_id}/content` | Download |

Reviewed offerings include `wan2.5-i2v-preview` and `wan2.6-i2v` in `Alibaba-1`, `Alibaba-2` and `Alibaba-3`; `wan3.0-video` and the `happyhorse-1.0`/`happyhorse-1.1` text/image offerings use `Alibaba-video-1` or `Alibaba-video-2`. Check the exact model and group in [Model Square](https://floodgate.dev/models).

| Field | Required | Limits |
| - | - | - |
| `model` | Yes | Accepted model ID |
| `input.prompt` | Yes | Text prompt |
| `input.img_url` | For image-to-video models | One HTTPS image URL |
| `parameters.duration` | Yes | Wan 2.5: 5 or 10; Wan 2.6: 5, 10 or 15; Wan 3/Happyhorse: 1 to 15 seconds |
| `parameters.resolution` | Yes | A value in the selected model/group's allowed configurations |
| `parameters.audio` | No | `false` only |
| `parameters.watermark`, `parameters.prompt_extend` | No | Boolean |

Duration and resolution must form a reviewed configuration. Seed and negative-prompt constraints and omitted defaults are undocumented. Uploads, reference video, audio inputs, editing and r2v contracts are outside this reference.

## Submit

Replace the image URL with an accessible file:

```bash theme={null}
curl --fail-with-body https://api.floodgate.dev/alibailian/api/v1/services/aigc/video-generation/video-synthesis \
  -H "Authorization: Bearer $FLOODGATE_API_KEY" -H 'Content-Type: application/json' \
  -d '{"model":"wan2.6-i2v","input":{"prompt":"Animate the scene with a slow camera movement","img_url":"https://example.com/first-frame.png"},"parameters":{"resolution":"720P","duration":5,"audio":false}}'
```

```json theme={null}
{"id":"task_example","task_id":"task_example","object":"video","model":"wan2.6-i2v","status":"queued","progress":0,"created_at":1700000000}
```

## Poll and download

Set `TASK_ID` to the returned `id`:

```bash theme={null}
curl --fail-with-body "https://api.floodgate.dev/alibailian/api/v1/tasks/$TASK_ID" \
  -H "Authorization: Bearer $FLOODGATE_API_KEY"
```

Check `code: "success"`, then `data.status`. Pending states are `NOT_START`, `SUBMITTING`, `SUBMITTED`, `QUEUED`, `IN_PROGRESS` and `UNKNOWN`. Terminal states are `SUCCESS` and `FAILURE`.

```json theme={null}
{"code":"success","message":"","data":{"task_id":"task_example","platform":"task","status":"SUCCESS","progress":"100%","result_url":"/v1/videos/task_example/content","data":null}}
```

```json theme={null}
{"code":"success","message":"","data":{"task_id":"task_example","platform":"task","status":"FAILURE","fail_reason":"Video generation failed","data":null}}
```

Read `data.result_url`. The upstream `output.task_status` and `output.video_url` fields are not this public response. After success:

```bash theme={null}
curl --fail-with-body "https://api.floodgate.dev/v1/videos/$TASK_ID/content" \
  -H "Authorization: Bearer $FLOODGATE_API_KEY" --output video.mp4
```

## Errors and billing

Billing uses verified output seconds at the selected resolution. Follow-ups retain the original group and price. Confirmed failures release reservations; missing final usage can leave settlement pending.

Check `code` and `data.fail_reason` even after HTTP 200. A `400` can mean an invalid configuration, missing image or unfinished download; `410` means the result expired. Keep the original task after a timeout or `submission_uncertain`. See [shared video errors](https://docs.floodgate.dev/videos.md#errors-and-retries).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.