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

# HappyWan API: Generate Videos up to 45 Seconds

> Generate 480p and 720p videos up to 45 seconds with the HappyWan API using text, keyframes, or image, video, and audio references.

## Overview

HappyWan generates clips from 4 to 45 seconds in 480p or 720p. Create a scene from text, animate first and last frames, or guide a video with mixed-media references. Enable sound to generate synchronized dialogue, effects, or music.

| Setting | Value |
| - | - |
| Model ID | `happywan` |
| Base URL | `https://api.apixo.ai/api/v1` |

## Endpoints and authentication

Send `Authorization: Bearer YOUR_API_KEY` on each request. For task creation, also send `Content-Type: application/json`.

| Method | Endpoint | Purpose |
| - | - | - |
| `POST` | `/generateTask/happywan` | Submit a video generation task |
| `GET` | `/statusTask/happywan?taskId={taskId}` | Query status and retrieve the result |

## Create a video

### Text-to-video

This request creates a 45-second scene with synchronized audio.

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/happywan" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "text-to-video",
      "prompt": "First 15 seconds: follow a cyclist in a yellow raincoat along a wet riverside path. Next 15 seconds: show the cyclist ringing the bell on a bridge. Final 15 seconds: pull back to reveal the bridge lights reflected in the river. Include light rain and a clear bell ring.",
      "resolution": "720p",
      "aspect_ratio": "16:9",
      "duration": 45,
      "sound": true
    }
  }'
```

### First and last frames

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "first_and_last_frames",
    "prompt": "Move smoothly from the street-level view to the wide skyline.",
    "image_urls": ["https://example.com/first-frame.jpg", "https://example.com/last-frame.jpg"],
    "duration": 8,
    "aspect_ratio": "auto"
  }
}
```

### Omni reference

```json theme={null}
{
  "request_type": "callback",
  "callback_url": "https://example.com/webhooks/apixo",
  "input": {
    "mode": "omni_reference",
    "prompt": "Keep the product from the image recognizable, follow the camera movement in the video, and time the reveal to the audio cue.",
    "image_urls": ["https://example.com/product.jpg"],
    "video_urls": ["https://example.com/camera-movement.mp4"],
    "audio_urls": ["https://example.com/reveal-cue.mp3"],
    "duration": 12,
    "resolution": "480p"
  }
}
```

## Parameters

**request\_type** `string` (default: async)

Result delivery mode. Supported values: `async` for polling and `callback` for webhook delivery.

**callback\_url** `string`

Public HTTPS URL that receives the final task payload. Required when `request_type` is `callback`.

**input** `object` *required*

HappyWan generation parameters.

**properties**

**mode** `string` *required*

Generation mode. Supported values: `text-to-video`, `first_and_last_frames`, and `omni_reference`.

**prompt** `string` *required*

Non-empty text describing the desired video. Maximum length is 10,000 characters.

**duration** `integer` (default: 5)

Output duration in seconds. Use an integer from 4 through 45.

**resolution** `string` (default: 720p)

Output resolution. Supported values: `480p` and `720p`.

**aspect\_ratio** `string` (default: auto)

Output aspect ratio. Supported values: `auto`, `16:9`, `4:3`, `1:1`, `3:4`, `9:16`, and `21:9`. Use `auto` or omit this field in `first_and_last_frames` mode.

**sound** `boolean` (default: true)

Set to `false` to generate a silent video.

**watermark** `boolean` (default: false)

Set to `true` to add a visible watermark.

**image\_urls** `string[]`

Public image URLs. Supply one opening frame or two images in first-to-last order for `first_and_last_frames`. In `omni_reference` mode, supply up to 10 reference images.

**video\_urls** `string[]`

Up to five public reference video URLs in `omni_reference` mode. Each clip must last 2–30 seconds. The total duration of all reference videos must be at most 30 seconds.

**audio\_urls** `string[]`

Up to five public reference audio URLs in `omni_reference` mode. Each clip must last 2–30 seconds. The total duration of all reference audio must be at most 30 seconds. Include at least one reference image or video when supplying audio.

### Mode requirements

| Mode | Requirements |
| - | - |
| `text-to-video` | Send a prompt without media fields. |
| `first_and_last_frames` | Send a prompt and one or two `image_urls`. Use `auto` for `aspect_ratio` or omit it. |
| `omni_reference` | Send a prompt and at least one URL in `image_urls` or `video_urls`. Add `audio_urls` to guide the sound. |

## Latency and polling

Task creation returns `data.taskId`. Query the status endpoint with that ID.

```bash theme={null}
curl "https://api.apixo.ai/api/v1/statusTask/happywan?taskId=YOUR_TASK_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

| Result delivery | How to retrieve the result |
| - | - |
| Polling | Continue polling while `data.state` is `pending` or `processing`. On `success`, parse `data.resultJson` as JSON and read the video URL from `resultUrls`. On `failed`, read `data.failCode` and `data.failMsg`. |
| Webhook | Set `request_type` to `callback` and supply `callback_url` to receive the final task payload. |

Longer clips and requests with more references can take more time. Use callback mode to receive the result as soon as the task completes. Result URLs are temporary. Download the MP4 if you need to retain it. See [Status Task](https://apixo.ai/docs/api-reference/status-task.md) and [Webhooks](https://apixo.ai/docs/api-reference/webhooks.md) for the shared lifecycle and delivery formats.

## Billing

The per-second rate depends on the resolution and whether the request includes a reference video. See [API pricing](https://apixo.ai/pricing/api) for rates and [credit conversion and rounding](https://apixo.ai/docs/pricing.md#credit-conversion-and-rounding) for how request totals are rounded.

## MCP integration

The [model schema](https://apixo.ai/docs/models/schemas/video/happywan.json) declares video result decoding in `mcp.result` and ordered attachment bindings for `image_urls`, `video_urls`, and `audio_urls` in `mcp.attachments`. Preserve the order of frame images.


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