QwenCloudBRASIL
Tradução de apoio para consulta. Código e identificadores técnicos preservados. Consultar referência original ↗

HappyHorse - Recuperar resultado de edição de vídeo

Verifique HappyHorse status da tarefa de edição de vídeo

Pesquise o status da tarefa e baixe o vídeo quando estiver pronto.

Estratégia de votação

  1. Salve o task_id de enviar resposta.
  2. Pesquise este endpoint a cada 15 segundos até task_status é SUCCEEDED ou FAILED.
  3. Baixe o vídeo de video_url dentro de 24 horas -- o URL expira depois disso.

OpenAPI

openapi: 3.1.0
info:
  title: HappyHorse Video Editing API
  description: Edit videos using the HappyHorse model with text instructions and optional reference images. Submit a task asynchronously, then poll `GET /tasks/{task_id}` for the result.
  version: 1.0.0
servers:
  - url: https://maas.qwencloudapi.com/api/v1
    description: Singapore
security:
  - BearerAuth: []
paths:
  /tasks/{task_id}:
    get:
      operationId: getHappyHorseVideoEditingTaskStatus
      summary: Query task result
      description: Poll the status of a submitted task and retrieve the video URL on completion.
      parameters:
        - name: task_id
          in: path
          required: true
          description: Task ID from the POST response.
          schema:
            type: string
      responses:
        "200":
          description: Task status retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HappyHorseVideoEditTaskStatusResponse"
              examples:
                SUCCEEDED:
                  summary: Task succeeded
                  value:
                    request_id: c11018a8-3f83-9591-a636-xxxxxx
                    output:
                      task_id: 051c7b40-b2c5-4341-aee4-xxxxxx
                      task_status: SUCCEEDED
                      submit_time: 2026-04-26 14:13:14.373
                      scheduled_time: 2026-04-26 14:13:14.419
                      end_time: 2026-04-26 14:14:13.679
                      orig_prompt: Make the horse-headed humanoid character in the video wear the striped sweater from the image
                      video_url: https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxxx.mp4?Expires=xxx
                    usage:
                      duration: 13.24
                      input_video_duration: 6.62
                      output_video_duration: 6.62
                      video_count: 1
                      SR: 720
                FAILED:
                  summary: Task failed
                  value:
                    request_id: e5d70b02-ebd3-98ce-9fe8-759d7d7b107d
                    output:
                      task_id: 86ecf553-d340-4e21-af6e-a0c6a421c010
                      task_status: FAILED
                      code: InvalidParameter
                      message: The resolution is not valid xxxxxx
                RUNNING:
                  summary: Task running
                  value:
                    request_id: c1209113-8437-424f-a386-xxxxxx
                    output:
                      task_id: 051c7b40-b2c5-4341-aee4-xxxxxx
                      task_status: RUNNING
                      submit_time: 2026-04-26 14:13:14.373
                      scheduled_time: 2026-04-26 14:13:14.419
                UNKNOWN:
                  summary: Task expired
                  value:
                    request_id: a4de7c32-7057-9f82-8581-xxxxxx
                    output:
                      task_id: 051c7b40-b2c5-4341-aee4-xxxxxx
                      task_status: UNKNOWN
        "400":
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DashScopeErrorResponse"
      x-codeSamples:
        - lang: curl
          label: cURL - Query task result
          source: |-
            # Replace {task_id} with the actual task ID from the submit response
            curl -X GET 'https://maas.qwencloudapi.com/api/v1/tasks/{task_id}' \
              -H "Authorization: Bearer $DASHSCOPE_API_KEY"
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: DashScope API Key. Get one from the [QwenCloud console](https://home.qwencloud.com/api-keys).
  schemas:
    HappyHorseVideoEditingRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: "Model identifier. Fixed value: `happyhorse-1.0-video-edit`."
          enum:
            - happyhorse-1.0-video-edit
          example: happyhorse-1.0-video-edit
        input:
          type: object
          required:
            - prompt
            - media
          description: Input content including the video to edit, optional reference images, and the editing prompt.
          properties:
            prompt:
              type: string
              description: Text prompt describing the intended edit (style transfer, local replacement, etc.). Supports any language. Maximum 5,000 non-Chinese characters or 2,500 Chinese characters (auto-truncated if exceeded).
              example: Make the horse-headed humanoid character in the video wear the striped sweater from the image
            media:
              type: array
              description: List of media assets. Must contain exactly 1 `video` element and optionally 0-5 `reference_image` elements.
              items:
                type: object
                required:
                  - type
                  - url
                properties:
                  type:
                    type: string
                    description: "Media asset type: `video` (the video to edit, exactly 1 required) or `reference_image` (optional, 0-5)."
                    enum:
                      - video
                      - reference_image
                  url:
                    type: string
                    format: uri
                    description: |-
                      URL or Base64-encoded data of the media asset.

                      **Video** (`type=video`): Publicly accessible URL (HTTP/HTTPS). MP4/MOV (H.264 recommended). Duration: 3-60 seconds. Resolution: longer side <= 4,096 px, shorter side >= 360 px. Aspect ratio: 1:2.5 to 2.5:1. File size: up to 100 MB. Frame rate: 8-60 fps (for variable-frame-rate input, the frame rate must stay within this range throughout). Output duration is capped at 15 seconds (longer inputs are auto-trimmed).

                      **Image** (`type=reference_image`): URL or Base64-encoded data. JPEG/JPG/PNG/WEBP. Width and height >= 300 px. Aspect ratio: 1:2.5 to 2.5:1. File size: up to 20 MB.

                      **Base64 format**: `data:{MIME_type};base64,{base64_data}` (supported MIME types: `image/jpeg`, `image/png`, `image/webp`).
        parameters:
          $ref: "#/components/schemas/HappyHorseVideoEditingParameters"
    HappyHorseVideoEditingParameters:
      type: object
      description: Video editing parameters.
      properties:
        resolution:
          type: string
          description: Resolution of the generated video.
          enum:
            - 720P
            - 1080P
          default: 1080P
        watermark:
          type: boolean
          description: 'Whether to add a watermark to the generated video. `true` (default): adds a "Happy Horse" watermark in the bottom-right corner. `false`: no watermark.'
          default: true
        audio_setting:
          type: string
          description: Audio control for the output video.
          enum:
            - auto
            - origin
          default: auto
          x-enumDescriptions:
            auto: Determined by the model.
            origin: Preserves the original audio from the input video.
        seed:
          type: integer
          description: Seed for reproducible results. Same seed + same parameters produces similar (not identical) output.
          minimum: 0
          maximum: 2147483647
    AsyncTaskSubmitResponse:
      type: object
      description: Response from an asynchronous task submission.
      properties:
        request_id:
          type: string
          description: Unique request identifier for tracing and troubleshooting.
          example: 4909100c-7b5a-9f92-bfe5-xxxxxx
        output:
          type: object
          properties:
            task_id:
              type: string
              description: Task ID for polling status. Use with `GET /tasks/{task_id}`.
              example: 0385dc79-5ff8-4d82-bcb6-xxxxxx
            task_status:
              type: string
              description: Initial task status, typically `PENDING`.
              enum:
                - PENDING
                - RUNNING
                - SUCCEEDED
                - FAILED
    HappyHorseVideoEditTaskStatusResponse:
      type: object
      description: Task status response for HappyHorse video editing.
      properties:
        request_id:
          type: string
          description: Request ID for troubleshooting. Include this when contacting support.
        output:
          type: object
          properties:
            task_id:
              type: string
              description: Task ID. Queryable for 24 hours after submission.
            task_status:
              type: string
              description: "Task lifecycle: `PENDING` -> `RUNNING` -> `SUCCEEDED` or `FAILED`. `CANCELED` if manually stopped. `UNKNOWN` if expired."
              enum:
                - PENDING
                - RUNNING
                - SUCCEEDED
                - FAILED
                - CANCELED
                - UNKNOWN
            submit_time:
              type: string
              description: When the task was submitted (UTC+8, `YYYY-MM-DD HH:mm:ss.SSS`).
            scheduled_time:
              type: string
              description: When the task started executing (UTC+8, `YYYY-MM-DD HH:mm:ss.SSS`).
            end_time:
              type: string
              description: When the task finished (UTC+8). Only present for `SUCCEEDED` or `FAILED` tasks.
            orig_prompt:
              type: string
              description: Your original prompt text.
            video_url:
              type: string
              format: uri
              description: URL of the generated video (MP4, H.264 encoding). Only present when `task_status` is `SUCCEEDED`. **Valid for 24 hours** -- download promptly.
            code:
              type: string
              description: Error code. Only present when `task_status` is `FAILED`.
            message:
              type: string
              description: Error message. Only present when `task_status` is `FAILED`.
        usage:
          type: object
          description: Resource consumption. Only present when `task_status` is `SUCCEEDED`.
          properties:
            duration:
              type: number
              description: Total billable video duration in seconds.
            input_video_duration:
              type: number
              description: Duration of the input video in seconds.
            output_video_duration:
              type: number
              description: Duration of the output video in seconds.
            video_count:
              type: integer
              description: Number of videos generated. Always `1`.
            SR:
              type: integer
              description: Resolution tier used (e.g., `720` for 720P, `1080` for 1080P).
    DashScopeErrorResponse:
      type: object
      description: DashScope API error response.
      properties:
        request_id:
          type: string
          description: Unique request identifier for tracing and support.
        code:
          type: string
          description: Machine-readable error code (e.g., `InvalidParameter`, `Throttling`, `Unauthorized`).
          example: InvalidParameter
        message:
          type: string
          description: Human-readable error message.
          example: Invalid model name