## 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: video-edit ## 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 video editing.\n\nOutput duration follows the input video (videos longer than 15s are\ntruncated to the first 15s).", "properties": { "prompt": { "description": "Text prompt describing the desired edit. Max 2500 chars.", "maxLength": 2500, "title": "Prompt", "type": "string", "x-sr-order": 201 }, "video_url": { "anyOf": [ { "format": "uri", "maxLength": 2083, "minLength": 1, "type": "string" }, { "type": "string" } ], "description": "Source video URL. 3-60s (videos >15s are truncated from start to 15s), min 480p / short side >=360px, aspect ratio between 1:8 and 8:1, >8fps, max 100MB. MP4 or MOV (H.264 recommended).", "title": "Video Url", "x-sr-order": 301 }, "seed": { "anyOf": [ { "maximum": 2147483647, "minimum": 0, "type": "integer" }, { "type": "null" } ], "description": "Random seed for deterministic generation.", "title": "Seed", "x-sr-order": 403 }, "audio_setting": { "default": "auto", "description": "Audio control. \"auto\" lets the model generate audio; \"origin\" keeps the original audio from the input video.", "enum": [ "auto", "origin" ], "title": "Audio Setting", "type": "string", "x-sr-order": 402 }, "reference_image_urls": { "anyOf": [ { "items": { "anyOf": [ { "format": "uri", "maxLength": 2083, "minLength": 1, "type": "string" }, { "type": "string" } ] }, "maxItems": 5, "type": "array" }, { "type": "null" } ], "description": "Up to 5 reference image URLs. Min 300x300px, aspect ratio between 1:2.5 and 2.5:1, max 10MB each. JPEG/JPG/PNG/BMP/WEBP.", "title": "Reference Image Urls", "x-sr-order": 302 }, "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", "video_url" ], "title": "VideoEditInput", "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": "", "video_url": "", "seed": null, "audio_setting": "auto", "reference_image_urls": null, "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/video-edit", { input: { prompt: '', video_url: '', reference_image_urls: null, resolution: '1080P', audio_setting: 'auto', 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/video-edit", arguments={ "prompt": "", "video_url": "", "reference_image_urls": None, "resolution": "1080P", "audio_setting": "auto", "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/video-edit", SubscribeOptions.builder() .input(Map.of( "prompt", "", "video_url", "", "reference_image_urls", null, "resolution", "1080P", "audio_setting", "auto", "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/video-edit", input = mapOf( "prompt" to "", "video_url" to "", "reference_image_urls" to null, "resolution" to "1080P", "audio_setting" to "auto", "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/video-edit \ --header "Authorization: Key $SUNRA_KEY" \ --header "Content-Type: application/json" \ --data '{"prompt":"","video_url":"","reference_image_urls":null,"resolution":"1080P","audio_setting":"auto","seed":null,"watermark":true}' ``` ## Model readme undefined