# HappyHorse 1.0 Video Generation API Documentation

Call the **BeeRoute video generation API** to generate video content. This document applies to the **HappyHorse 1.0** series of video generation models (text-to-video, image-to-video, reference-to-video, video editing).

#### [Download the MD file of this document](https://beeroute.ai/doc/coding/happyhorse-video.md)

---

## 1. Supported Models

### Model List

| Model Name | Type | Description |
| :--- | :--- | :--- |
| `happyhorse-1.1-t2v` | Text-to-video | Generates physically realistic, smoothly moving videos from text prompts |
| `happyhorse-1.1-i2v` | Image-to-video | Generates a video based on a first-frame image combined with a text description |
| `happyhorse-1.1-r2v` | Reference-to-video | Takes multiple reference images and fuses the subjects according to the text prompt to generate a video |
| `happyhorse-1.0-video-edit` | Video editing | Takes a video and reference images, and combines them with text instructions to perform editing tasks such as style transformation and local replacement |

---

### Pricing

#### Text-to-video / Image-to-video / Reference-to-video / Video editing

| Resolution | Price (USD) |
| :--- | :--- |
| 720P | **$0.0993** / sec |
| 1080P | **$0.1765** / sec |

> **Billing notes**:
> - **Text-to-video**: billed by the output video duration.
> - **Image-to-video**: billed by the output video duration.
> - **Reference-to-video**: billed by `duration` (the `input_video_duration` for reference-to-video is fixed at 0, i.e. equivalent to billing by the output video duration).
> - **Video editing**: billed by `duration` (input video duration + output video duration).

---

## 2. Generating Videos

Because video generation tasks take a relatively long time (typically 1–5 minutes), the API uses asynchronous calls. The whole flow consists of two core steps: **"create task → poll for result"**.

### API Endpoint

```
POST /v1/videos
```

### Request Headers

| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| Authorization | string | Yes | User authentication token (Bearer sk-xxxx) |
| Content-Type | string | Yes | **application/json** |

### Request Parameters (JSON Body)

| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **model** | string | Yes | Model name. See the model list above for valid values. |
| **input** | object | Yes | Input information, including the prompt and media materials. See **input parameters** below. |
| **parameters** | object | No | Video generation parameters such as resolution and duration. See **parameters** below. |

---

### input parameters

#### Common fields

| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **prompt** | string | Conditional | Text prompt. Describes the video content and visual characteristics you expect.<br>Supports any language input, with a maximum of 5000 non-Chinese characters or 2500 Chinese characters; anything beyond is automatically truncated.<br>**Text-to-video**: required.<br>**Image-to-video**: optional.<br>**Reference-to-video**: required.<br>**Video editing**: required. |
| **media** | array | Conditional | List of media materials; each element contains the `type` and `url` fields.<br>**Text-to-video**: omit (pure text generation).<br>**Image-to-video / Reference-to-video / Video editing**: required. |

#### media element structure

The valid values of `type` differ by model:

**Image-to-video (happyhorse-1.1-i2v)**

| type value | Description |
| :--- | :--- |
| `first_frame` | First-frame image (required, exactly 1) |

**Reference-to-video (happyhorse-1.1-r2v)**

| type value | Description |
| :--- | :--- |
| `reference_image` | Reference image (required, 1–9) |

Character reference note: in the prompt, use `[Image 1]`, `[Image 2]` markers to refer to the reference images at the corresponding positions in the `media` array, in the same order as the `media` array. When using them, specify the concrete object in the reference image, for example "the woman wearing a red qipao in [Image 1]".

**Video editing (happyhorse-1.0-video-edit)**

| type value | Description |
| :--- | :--- |
| `video` | The video to be edited (required, exactly 1) |
| `reference_image` | Reference image (optional, 0–5) |

**Media material limits**

| Applicable scenario | Material type | Format | Resolution | Duration/Frame rate | Size |
| :--- | :--- | :--- | :--- | :--- | :--- |
| Image-to-video `first_frame` | Image | JPEG, JPG, PNG, WEBP | Width and height ≥ 300 px, aspect ratio 1:2.5–2.5:1 | — | ≤ 10MB |
| Reference-to-video `reference_image` | Image | JPEG, JPG, PNG, WEBP | Short side ≥ 400 px (720P or above recommended) | — | ≤ 10MB |
| Video editing `reference_image` | Image | JPEG, JPG, PNG, WEBP | Width and height ≥ 300 px, aspect ratio 1:2.5–2.5:1 | — | ≤ 10MB |
| Video editing `video` | Video | MP4, MOV (H.264 encoding recommended) | Long side ≤ 2160 px, short side ≥ 320 px, aspect ratio 1:2.5–2.5:1 | Duration 3–60s, frame rate > 8fps | ≤ 100MB |

---

### parameters

| Parameter | Type | Applicable models | Required | Description |
| :--- | :--- | :--- | :--- | :--- |
| **resolution** | string | All | No | Resolution tier, which directly affects the cost.<br>Valid values: `720P`, `1080P` (default). |
| **ratio** | string | t2v / r2v | No | Video aspect ratio.<br>Valid values: `16:9` (default), `9:16`, `1:1`, `4:3`, `3:4`.<br>**Note**: image-to-video automatically matches the aspect ratio of the input first frame, so this parameter is not needed; video editing does not support this parameter, and the output keeps the same ratio as the input video. |
| **duration** | integer | t2v / i2v / r2v | No | Video duration (seconds), which directly affects the cost. An integer in [3, 15], default 5.<br>**Note**: video editing does not support this parameter; the output video duration matches the input video. When the input exceeds 15 seconds, the first 15 seconds are automatically taken, and the maximum output is 15 seconds. |
| **watermark** | boolean | All | No | Whether to add a watermark.<br>`true` (default): adds a "Happy Horse" watermark in the bottom-right corner. `false`: no watermark. |
| **seed** | integer | All | No | Random seed, in [0, 2147483647].<br>If omitted, the system generates one automatically. A fixed seed improves reproducibility but does not guarantee identical results. |
| **audio_setting** | string | video-edit | No | Video audio setting (video editing only).<br>`auto` (default): controlled by the model. `origin`: keep the original audio of the input video. |

#### Output video resolution by ratio and resolution

| Resolution tier | Aspect ratio | Output video resolution (width\*height) |
| :--- | :--- | :--- |
| 720P | 16:9 | 1280\*720 |
| | 9:16 | 720\*1280 |
| | 1:1 | 960\*960 |
| | 4:3 | 1104\*832 |
| | 3:4 | 832\*1104 |
| 1080P | 16:9 | 1920\*1080 |
| | 9:16 | 1080\*1920 |
| | 1:1 | 1440\*1440 |
| | 4:3 | 1648\*1248 |
| | 3:4 | 1248\*1648 |

---

### Request Examples

#### 1. Text-to-video

```bash
curl --location --request POST 'https://beeroute.ai/v1/videos' \
--header 'Authorization: Bearer sk-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "happyhorse-1.1-t2v",
    "input": {
        "prompt": "A kitten running under the moonlight"
    },
    "parameters": {
        "resolution": "720P",
        "ratio": "16:9",
        "duration": 5,
        "watermark": false
    }
}'
```

#### 2. Image-to-video - first frame to video

```bash
curl --location --request POST 'https://beeroute.ai/v1/videos' \
--header 'Authorization: Bearer sk-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "happyhorse-1.1-i2v",
    "input": {
        "prompt": "A cat running on the grass",
        "media": [
            {
                "type": "first_frame",
                "url": "https://example.com/first_frame.png"
            }
        ]
    },
    "parameters": {
        "resolution": "720P",
        "duration": 5,
        "watermark": false
    }
}'
```

#### 3. Reference-to-video - multiple image references

```bash
curl --location --request POST 'https://beeroute.ai/v1/videos' \
--header 'Authorization: Bearer sk-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "happyhorse-1.1-r2v",
    "input": {
        "prompt": "The woman in a red qipao from [Image 1] gently raises her hand to open the folding fan from [Image 2], while the tassel earrings from [Image 3] sway lightly as she turns her head.",
        "media": [
            {
                "type": "reference_image",
                "url": "https://example.com/girl.jpg"
            },
            {
                "type": "reference_image",
                "url": "https://example.com/folding-fan.jpg"
            },
            {
                "type": "reference_image",
                "url": "https://example.com/earrings.jpg"
            }
        ]
    },
    "parameters": {
        "resolution": "720P",
        "ratio": "16:9",
        "duration": 5,
        "watermark": false
    }
}'
```

#### 4. Video editing - style modification

```bash
curl --location --request POST 'https://beeroute.ai/v1/videos' \
--header 'Authorization: Bearer sk-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "happyhorse-1.0-video-edit",
    "input": {
        "prompt": "Convert the entire scene into claymation style",
        "media": [
            {
                "type": "video",
                "url": "https://example.com/input_video.mp4"
            }
        ]
    },
    "parameters": {
        "resolution": "720P",
        "watermark": false
    }
}'
```

#### 5. Video editing - reference image editing

```bash
curl --location --request POST 'https://beeroute.ai/v1/videos' \
--header 'Authorization: Bearer sk-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "happyhorse-1.0-video-edit",
    "input": {
        "prompt": "Replace the clothes of the girl in the video with the clothes in the image",
        "media": [
            {
                "type": "video",
                "url": "https://example.com/input_video.mp4"
            },
            {
                "type": "reference_image",
                "url": "https://example.com/clothes.png"
            }
        ]
    },
    "parameters": {
        "resolution": "720P",
        "watermark": false
    }
}'
```

---

### Response Format

#### 200 - Submission succeeded

```json
{
    "id": "task_20260124220030-9s4dc"
}
```

> **Note**: Please save the `id`, which is used to poll the task status and result. Do not create duplicate tasks.

#### Error response

```json
{
    "code": "InvalidApiKey",
    "message": "No API-key provided.",
    "request_id": "7438d53d-6eb8-4596-8835-xxxxxx"
}
```

---

## 3. Querying Task Status

Video generation usually takes several minutes. Poll the status using the task ID, with a recommended interval of **15 seconds**.

### API Endpoint

```
GET /v1/videos/{video_id}
```

### Path Parameters

| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| video_id | string | Yes | The `id` returned when creating the task |

---

### Request Example

```bash
curl --location --request GET 'https://beeroute.ai/v1/videos/task_20260124220030-9s4dc' \
--header 'Authorization: Bearer sk-xxx'
```

---

### Response Format

#### 200 - Completed successfully (completed)

```json
{
    "id": "task_20260124220030-9s4dc",
    "object": "video.generation",
    "model": "happyhorse-1.1-t2v",
    "status": "completed",
    "progress": "100%",
    "created_at": 1769263230,
    "started_at": 1769263245,
    "completed_at": 1769263322,
    "video_url": "https://example.com/output_video.mp4"
}
```

#### Processing (processing)

```json
{
    "id": "task_20260124220030-9s4dc",
    "object": "video.generation",
    "model": "happyhorse-1.1-t2v",
    "status": "processing",
    "progress": "50%",
    "created_at": 1769263230,
    "started_at": 1769263245
}
```

#### Queued (queued)

```json
{
    "id": "task_20260124220030-9s4dc",
    "object": "video.generation",
    "model": "happyhorse-1.1-t2v",
    "status": "queued",
    "progress": "0%",
    "created_at": 1769263230
}
```

#### Failed (failed)

```json
{
    "id": "task_20260124220030-9s4dc",
    "object": "video.generation",
    "model": "happyhorse-1.1-t2v",
    "status": "failed",
    "progress": "0%",
    "created_at": 1769263230,
    "started_at": 1769263245,
    "completed_at": 1769263322
}
```

---

### Response Field Descriptions

| Field | Type | Description |
| :--- | :--- | :--- |
| **id** | string | Task ID. |
| **object** | string | Fixed value `video.generation`. |
| **model** | string | The model name used. |
| **status** | string | Task status:<br>`queued`: queued<br>`processing`: processing<br>`completed`: completed<br>`failed`: failed |
| **progress** | string | Generation progress percentage (e.g. `"100%"`). |
| **created_at** | integer | Task creation time (Unix timestamp). |
| **started_at** | integer | Task start time (Unix timestamp). |
| **completed_at** | integer | Task completion time (Unix timestamp). |
| **video_url** | string | Video download link (MP4, H.264 encoding). Returned only when status is `completed`. **Valid for 24 hours**; please download promptly. |

---

## 4. Detailed Parameters per Model

### 1. Text-to-video (happyhorse-1.1-t2v)

Generates a video from text prompts.

| Feature | Description |
| :--- | :--- |
| prompt length | ≤ 5000 non-Chinese characters or 2500 Chinese characters (required) |
| Resolution | 720P, 1080P (default) |
| Aspect ratio | 16:9 (default), 9:16, 1:1, 4:3, 3:4 |
| Duration | [3, 15] seconds, default 5 |

### 2. Image-to-video (happyhorse-1.1-i2v)

Generates a video based on the input first-frame image.

| Feature | Description |
| :--- | :--- |
| prompt length | ≤ 5000 non-Chinese characters or 2500 Chinese characters (optional) |
| Resolution | 720P, 1080P (default) |
| Aspect ratio | Automatically matches the input first frame; no need to specify manually |
| Duration | [3, 15] seconds, default 5 |
| First frame | 1 `first_frame` type image required |

### 3. Reference-to-video (happyhorse-1.1-r2v)

Takes multiple reference images and fuses the subjects to generate a video.

| Feature | Description |
| :--- | :--- |
| prompt length | ≤ 5000 non-Chinese characters or 2500 Chinese characters (required) |
| Resolution | 720P, 1080P (default) |
| Aspect ratio | 16:9 (default), 9:16, 1:1, 4:3, 3:4 |
| Duration | [3, 15] seconds, default 5 |
| Reference materials | 1–9 `reference_image` |
| Character reference | Use `[Image 1]`, `[Image 2]` in the prompt to reference the corresponding reference images in the order of the `media` array |

### 4. Video editing (happyhorse-1.0-video-edit)

Takes a video and reference images and performs editing tasks such as style transformation and local replacement according to the instructions.

| Feature | Description |
| :--- | :--- |
| prompt length | ≤ 5000 non-Chinese characters or 2500 Chinese characters (required) |
| Resolution | 720P, 1080P (default) |
| Aspect ratio | Cannot be specified manually; the output matches the input video |
| Output duration | 3–15 seconds; matches the input video. When the input exceeds 15 seconds, the first 15 seconds are automatically taken |
| Input video | 1 `video` type material required |
| Reference images | Optional, 0–5 `reference_image` |
| Audio control | `audio_setting`: `auto` (default) or `origin` (keep the original audio) |

---

## 5. FAQ

#### Q: What is the relationship between resolution and ratio?

**A:** Both are optional parameters. `resolution` controls the clarity tier (affecting cost), and `ratio` controls the aspect ratio. Passing both is recommended for precise control of the output video specifications. The image-to-video model does not require `ratio`; the model automatically matches the aspect ratio of the input material.

#### Q: How is the output resolution of image-to-video determined?

**A:** The model automatically scales to a similar total pixel count based on the selected `resolution` tier, and the video aspect ratio will be as close as possible to that of the input image. The actual output may differ slightly (the video width and height must be multiples of 16).

#### Q: What does the order of the media array mean in reference-to-video?

**A:** The 1st `reference_image` in the `media` array corresponds to `[Image 1]` in the prompt, the 2nd corresponds to `[Image 2]`, and so on. When using them, clearly refer to the concrete object in the reference image in the prompt, such as "the woman wearing a red qipao in [Image 1]".

#### Q: How is the output duration of video editing determined?

**A:** Video editing does not support specifying the output duration via the `duration` parameter; the output video duration matches the input video. When the input video exceeds 15 seconds, the system automatically takes the first 15 seconds from the start as the valid segment, so the maximum output is 15 seconds.

#### Q: Is the watermark enabled by default?

**A:** Yes. The HappyHorse series models add a "Happy Horse" watermark in the bottom-right corner of the video by default. To disable it, explicitly set `"watermark": false` in `parameters`.

#### Q: How can I convert a temporary video link into a permanent link?

**A:** It cannot be converted directly. The correct approach is for the backend service to download the video file after obtaining the URL, then upload it to a permanent object storage service to generate a new permanent access link.
