## Basic model info - Model name: alibaba/alibaba happy-horse - Model description: HappyHorse: text-to-video, image-to-video, reference-to-video and video editing with native audio output. - Endpoint name: reference-to-video ## Model schema The model schema is defined in the OpenAPI schema: [OpenAPI Schema](https://oapi.sunra.ai/main/alibaba/happy-horse/latest.json) ### Model input schema The model input schema is: ```json { "description": "Input for HappyHorse 1.0 reference-to-video (1-9 reference images).", "properties": { "prompt": { "description": "Text prompt describing the desired video. Max 2500 chars.", "maxLength": 2500, "title": "Prompt", "type": "string", "x-sr-order": 201 }, "aspect_ratio": { "default": "16:9", "description": "Video aspect ratio.", "enum": [ "16:9", "9:16", "1:1", "4:3", "3:4" ], "title": "Aspect Ratio", "type": "string", "x-sr-order": 402 }, "seed": { "anyOf": [ { "maximum": 2147483647, "minimum": 0, "type": "integer" }, { "type": "null" } ], "description": "Random seed for deterministic generation.", "title": "Seed", "x-sr-order": 404 }, "duration": { "default": 5, "description": "Video duration in seconds (3-15).", "enum": [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ], "title": "Duration", "type": "integer", "x-sr-order": 403 }, "reference_image_urls": { "description": "1-9 reference image URLs. Short side >=400px (720p+ recommended), short:long ratio >=0.4 (ideally matching target video ratio), max 10MB each. JPEG/JPG/PNG/BMP/WEBP.", "items": { "anyOf": [ { "format": "uri", "maxLength": 2083, "minLength": 1, "type": "string" }, { "type": "string" } ] }, "maxItems": 9, "minItems": 1, "title": "Reference Image Urls", "type": "array", "x-sr-order": 301 }, "resolution": { "default": "1080P", "description": "Video resolution.", "enum": [ "1080P", "720P" ], "title": "Resolution", "type": "string", "x-sr-order": 401 }, "watermark": { "default": true, "description": "Whether to add a watermark to the generated video.", "title": "Watermark", "type": "boolean", "x-sr-order": 501 } }, "required": [ "prompt", "reference_image_urls" ], "title": "ReferenceToVideoInput", "type": "object" } ``` ### Model output schema The model output schema is: ```json { "description": "Output model with video duration for post_calculated pricing.", "properties": { "output_video_dur": { "description": "Duration of the output video in seconds (rounded)", "title": "Output Video Dur", "type": "integer" }, "video": { "properties": { "content_type": { "description": "The mime type of the file.", "title": "Content Type", "type": "string" }, "file_name": { "description": "The name of the file. It will be auto-generated if not provided.", "title": "File Name", "type": "string" }, "file_size": { "description": "The size of the file in bytes.", "title": "File Size", "type": "integer" }, "url": { "description": "The URL where the file can be downloaded from.", "title": "Url", "type": "string" } }, "required": [ "content_type", "file_name", "file_size", "url" ], "title": "SunraFile", "type": "object" } }, "required": [ "video", "output_video_dur" ], "title": "HappyhorseVideoOutput", "type": "object" } ``` ## Example inputs and outputs Use the following example inputs and outputs to understand the model. ### Input example ```json { "prompt": "", "aspect_ratio": "16:9", "seed": null, "duration": 5, "reference_image_urls": [ ], "resolution": "1080P", "watermark": true } ``` ### Output example ```json { } ``` ## Model code examples ### JavaScript ```javascript import { sunra } from "@sunra/client"; const result = await sunra.subscribe("alibaba/happy-horse/reference-to-video", { input: { prompt: '', reference_image_urls: [], resolution: '1080P', aspect_ratio: '16:9', duration: 5, seed: null, watermark: true }, logs: true, onQueueUpdate: (update) => { console.log(`Status Update: ${update.status}, Request ID: ${update.request_id}`); }, }); console.log(result.data); console.log(result.requestId); ``` ### Python ```python import sunra_client result = sunra_client.subscribe( "alibaba/happy-horse/reference-to-video", arguments={ "prompt": "", "reference_image_urls": [], "resolution": "1080P", "aspect_ratio": "16:9", "duration": 5, "seed": None, "watermark": True }, with_logs=True, on_enqueue=print, on_queue_update=print, ) print(result) ``` ### Java ```java import ai.sunra.client.*; import java.util.Map; import com.google.gson.JsonObject; var client = SunraClient.withEnvCredentials(); var response = client.subscribe( "alibaba/happy-horse/reference-to-video", SubscribeOptions.builder() .input(Map.of( "prompt", "", "reference_image_urls", , "resolution", "1080P", "aspect_ratio", "16:9", "duration", 5, "seed", null, "watermark", true)) .resultType(JsonObject.class) .onQueueUpdate(update -> System.out.printf( "\nStatus Update: %s, Request ID: %s%n", update.getStatus(), update.getRequestId() )) .logs(true) .build() ); System.out.println("Completed!"); System.out.println(response.getData()); ``` ### Kotlin ```kotlin import ai.sunra.client.kt.* import com.google.gson.JsonObject val client = createSunraClient() val response = client.subscribe( endpointId = "alibaba/happy-horse/reference-to-video", input = mapOf( "prompt" to "", "reference_image_urls" to , "resolution" to "1080P", "aspect_ratio" to "16:9", "duration" to 5, "seed" to null, "watermark" to true), options = ai.sunra.client.kt.SubscribeOptions(logs = true), onUpdate = { update -> println("\nStatus Update: ${update.status}, Request ID: ${update.requestId}") } ) println("Completed!") println(response.data) ``` ### Curl ```bash curl --request POST \ --url https://api.sunra.ai/v1/queue/alibaba/happy-horse/reference-to-video \ --header "Authorization: Key $SUNRA_KEY" \ --header "Content-Type: application/json" \ --data '{"prompt":"","reference_image_urls":[],"resolution":"1080P","aspect_ratio":"16:9","duration":5,"seed":null,"watermark":true}' ``` ## Model readme undefined