# Happy Horse 1.1 Reference to Video > Generate a 3-15 second video from up to nine reference photos, addressing each one positionally in the prompt so a specific character, product or prop stays recognizable in the shot. ## Overview - **Endpoint**: `https://queue.modelrunner.run/alibaba/happy-horse/v1.1/reference-to-video` - **Model ID**: `alibaba/happy-horse/v1.1/reference-to-video` - **Category**: image-to-video - **Kind**: inference - **Tags**: happy-horse, happyhorse, alibaba, reference-to-video, reference-image, character-consistency, multi-reference, image-to-video, video-generation, video, audio ## Pricing - **720P**: $0.14 per output second - **1080P**: $0.18 per output second ## Request Lifecycle This model runs on the ModelRunner **asynchronous queue API** — a single POST does not return the output. Every call requires an `Authorization: Key $MODEL_RUNNER_KEY` header. Run three steps: 1. **Submit** — `POST https://queue.modelrunner.run/alibaba/happy-horse/v1.1/reference-to-video` with a JSON body holding the input fields at the top level. The body may also include a reserved top-level `metadata` object — a flat string map (max 16 keys, key ≤64 / value ≤512 chars) stored on the request for your own tagging. It is never sent to the model; filter your request history with `GET https://queue.modelrunner.run/requests?metadata=` (exact key=value matches, AND-ed). The response carries request handles only (no output yet): ```json { "status": "IN_QUEUE", "request_id": "<21-char id>", "status_url": "https://queue.modelrunner.run/alibaba/happy-horse/v1.1/reference-to-video/requests//status", "response_url": "https://queue.modelrunner.run/alibaba/happy-horse/v1.1/reference-to-video/requests/", "cancel_url": "https://queue.modelrunner.run/alibaba/happy-horse/v1.1/reference-to-video/requests//cancel" } ``` 2. **Poll status** — `GET ` until `status` is `COMPLETED`. Possible values are `IN_QUEUE`, `IN_PROGRESS`, `COMPLETED`, `FAILED`, `CANCELLED`. A `FAILED` request responds with HTTP 400 and an `error` field. 3. **Read result** — `GET `. Returns the finished request, including the generated `output`: ```json { "id": "", "status": "COMPLETED", "output": ..., "input": ... } ``` The JavaScript and Python SDKs below perform steps 2–3 for you. In any language without an SDK (Swift, Go, Kotlin, etc.) you must implement the polling loop and the final result fetch yourself — see the cURL example for the full flow. ### Input Schema - **`seed`** (`integer`, _optional_): Random seed for reproducible results. Omit for a different clip each run. - Range: `0` to `2147483647` - **`ratio`** (`RatioEnum`, _optional_): Frame shape (aspect ratio) of the generated video. The output's proportions come from this field, not from the reference images. - Default: `"16:9"` - Options: `"16:9"`, `"9:16"`, `"4:3"`, `"3:4"`, `"1:1"`, `"5:4"`, `"4:5"`, `"9:21"`, `"21:9"`, `"3:1"`, `"1:3"`, `"3.2:1"`, `"1:3.2"`, `"4:1"`, `"1:4"` - **`prompt`** (`string`, _required_): Required. Describe the scene and the action, and refer to each reference image by position - \[Image 1\], \[Image 2\], and so on - naming the specific subject inside the bracket, for example 'the woman in the red dress in \[Image 1\]'. The numbering follows the reference image fields in order. Any language, up to 5000 characters (2500 for Chinese). - **`duration`** (`integer`, _optional_): Length of the generated video in whole seconds (3-15). Cost scales directly with this value. - Default: `5` - Range: `3` to `15` - **`resolution`** (`ResolutionEnum`, _optional_): Output video resolution. 720P bills at $0.14 per second of finished video; 1080P (default) bills at $0.18 per second. - Default: `"1080P"` - Options: `"720P"`, `"1080P"` - **`reference_image_1`** (`string`, _required_): First reference subject - a person, a product, a prop or a location. Refer to it in the prompt as \[Image 1\]. At least one reference image is required. JPEG, JPG, PNG or WEBP; shortest side at least 400 px (720P or larger recommended); up to 20 MB. - **`reference_image_2`** (`string`, _optional_): Optional second reference subject, referred to in the prompt as \[Image 2\]. Same formats and size limits as \[Image 1\]. - **`reference_image_3`** (`string`, _optional_): Optional third reference subject, referred to in the prompt as \[Image 3\]. Same formats and size limits as \[Image 1\]. - **`reference_image_4`** (`string`, _optional_): Optional fourth reference subject, referred to in the prompt as \[Image 4\]. Same formats and size limits as \[Image 1\]. - **`reference_image_5`** (`string`, _optional_): Optional fifth reference subject, referred to in the prompt as \[Image 5\]. Same formats and size limits as \[Image 1\]. - **`reference_image_6`** (`string`, _optional_): Optional sixth reference subject, referred to in the prompt as \[Image 6\]. Same formats and size limits as \[Image 1\]. - **`reference_image_7`** (`string`, _optional_): Optional seventh reference subject, referred to in the prompt as \[Image 7\]. Same formats and size limits as \[Image 1\]. - **`reference_image_8`** (`string`, _optional_): Optional eighth reference subject, referred to in the prompt as \[Image 8\]. Same formats and size limits as \[Image 1\]. - **`reference_image_9`** (`string`, _optional_): Optional ninth reference subject, referred to in the prompt as \[Image 9\]. Nine is the maximum the model accepts. Same formats and size limits as \[Image 1\]. ### Output Schema _No `Output` schema properties are available._ ## Default Example **Input** ```json { "ratio": "21:9", "prompt": "[Image 1] walks slowly down the market street in [Image 2], glancing at the steaming food stall as he passes, lanterns swaying gently overhead.", "duration": 5, "resolution": "1080P", "reference_image_1": "https://media.modelrunner.ai/TE497QS73QIpvExklJBdL.jpeg", "reference_image_2": "https://media.modelrunner.ai/6LBBIbihPDmLwAUFZ8EeF.jpeg" } ``` **Output** ```json "https://media.modelrunner.ai/6zVfrhI5mJfscgHgBHRjq.mp4" ``` ## Usage Examples ### cURL The queue API is asynchronous: submit the request, poll `status_url` until it is `COMPLETED`, then read the result from `response_url`. Requires `jq`. ```bash # 1. Submit the request (returns request handles, not the output) SUBMIT=$(curl --silent --request POST \ --url https://queue.modelrunner.run/alibaba/happy-horse/v1.1/reference-to-video \ --header "Authorization: Key $MODEL_RUNNER_KEY" \ --header "Content-Type: application/json" \ --data '{ "ratio": "21:9", "prompt": "[Image 1] walks slowly down the market street in [Image 2], glancing at the steaming food stall as he passes, lanterns swaying gently overhead.", "duration": 5, "resolution": "1080P", "reference_image_1": "https://media.modelrunner.ai/TE497QS73QIpvExklJBdL.jpeg", "reference_image_2": "https://media.modelrunner.ai/6LBBIbihPDmLwAUFZ8EeF.jpeg" }') STATUS_URL=$(echo "$SUBMIT" | jq -r '.status_url') RESPONSE_URL=$(echo "$SUBMIT" | jq -r '.response_url') # 2. Poll until the request leaves the queue / in-progress state while true; do STATUS=$(curl --silent --url "$STATUS_URL" \ --header "Authorization: Key $MODEL_RUNNER_KEY" | jq -r '.status') echo "Status: $STATUS" case "$STATUS" in COMPLETED) break ;; FAILED|CANCELLED) echo "Request $STATUS"; exit 1 ;; esac sleep 1 done # 3. Read the finished request, including the generated output curl --silent --url "$RESPONSE_URL" \ --header "Authorization: Key $MODEL_RUNNER_KEY" ``` ### JavaScript ```javascript import { modelrunner } from "@modelrunner/client"; const result = await modelrunner.subscribe("alibaba/happy-horse/v1.1/reference-to-video", { input: { "ratio": "21:9", "prompt": "[Image 1] walks slowly down the market street in [Image 2], glancing at the steaming food stall as he passes, lanterns swaying gently overhead.", "duration": 5, "resolution": "1080P", "reference_image_1": "https://media.modelrunner.ai/TE497QS73QIpvExklJBdL.jpeg", "reference_image_2": "https://media.modelrunner.ai/6LBBIbihPDmLwAUFZ8EeF.jpeg" } }); console.log(result.data); ``` ### Python ```python import asyncio import modelrunner_ai async def main(): response = await modelrunner_ai.submit_async( "alibaba/happy-horse/v1.1/reference-to-video", arguments={ "ratio": "21:9", "prompt": "[Image 1] walks slowly down the market street in [Image 2], glancing at the steaming food stall as he passes, lanterns swaying gently overhead.", "duration": 5, "resolution": "1080P", "reference_image_1": "https://media.modelrunner.ai/TE497QS73QIpvExklJBdL.jpeg", "reference_image_2": "https://media.modelrunner.ai/6LBBIbihPDmLwAUFZ8EeF.jpeg" } ) result = await response.get() print(result["output"]) asyncio.run(main()) ``` ## Additional Resources - [Playground](https://modelrunner.ai/models/alibaba/happy-horse/v1.1/reference-to-video) - [OpenAPI Schema](https://modelrunner.ai/models/alibaba/happy-horse/v1.1/reference-to-video/openapi.json) - [LLM Instructions](https://modelrunner.ai/models/alibaba/happy-horse/v1.1/reference-to-video/llms.txt)