> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyfast.com.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# happyhorse-1.0

> 创建并查询 HappyHorse 1.0 文生视频、图生视频、参考生视频和视频编辑任务。

HappyHorse 1.0 的四种能力共用 `POST /v1/video/generations`。选择能力后使用对应模型 ID，并用创建响应返回的任务 ID 查询结果。

<Tabs sync={false}>
  <Tab title="文生视频">
    ## 创建任务

    `POST /v1/video/generations`

    <div className="kling-api-example-panel">
      ```bash cURL theme={null}
      curl --request POST \
        --url https://www.anyfast.com.cn/v1/video/generations \
        --header 'Authorization: Bearer YOUR_API_KEY' \
        --header 'Content-Type: application/json' \
        --data '{
          "model": "happyhorse-1.0-t2v",
          "input": {"prompt": "夜色中的未来城市，镜头贴近地面快速向前推进"},
          "parameters": {
            "resolution": "720P",
            "ratio": "21:9",
            "duration": 3,
            "watermark": false,
            "seed": 0
          }
        }'
      ```
    </div>

    ## 请求头

    <ParamField header="Authorization" type="string" required>Bearer 鉴权，格式为 `Bearer YOUR_API_KEY`。</ParamField>
    <ParamField header="Content-Type" type="string" default="application/json" required>请求体格式。</ParamField>

    ## 请求体

    <ParamField body="model" type="string" required>使用 `happyhorse-1.0-t2v`。</ParamField>
    <ParamField body="input" type="object" required>文生视频输入。</ParamField>
    <ParamField body="input.prompt" type="string" required>视频内容描述。非中文最多 5,000 字符，中文最多 2,500 字符，超出部分自动截断。</ParamField>
    <ParamField body="parameters" type="object">输出控制参数。</ParamField>
    <ParamField body="parameters.resolution" type="string" default="1080P">可选值：`720P`、`1080P`。</ParamField>
    <ParamField body="parameters.ratio" type="string" default="16:9">可选值：`16:9`、`9:16`、`1:1`、`4:3`、`3:4`、`4:5`、`5:4`、`9:21`、`21:9`。</ParamField>
    <ParamField body="parameters.duration" type="integer" default={5}>视频时长，3–15 秒。</ParamField>
    <ParamField body="parameters.watermark" type="boolean" default={true}>是否添加水印。</ParamField>
    <ParamField body="parameters.seed" type="integer">随机种子，范围为 0–2147483647。</ParamField>

    ## 创建响应

    <div className="kling-api-example-panel">
      ```json 200 theme={null}
      {
        "id": "asyntask_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "task_id": "asyntask_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "object": "video",
        "model": "happyhorse-1.0-t2v",
        "status": "queued",
        "progress": 0,
        "created_at": 1785464914
      }
      ```
    </div>

    <ResponseField name="id" type="string">AnyFast 任务 ID。</ResponseField>
    <ResponseField name="task_id" type="string">任务 ID，与 `id` 相同。</ResponseField>
    <ResponseField name="object" type="string">对象类型，固定为 `video`。</ResponseField>
    <ResponseField name="model" type="string">实际使用的模型 ID。</ResponseField>
    <ResponseField name="status" type="string">创建后的初始状态，固定为 `queued`。</ResponseField>
    <ResponseField name="progress" type="integer">创建时的初始进度，固定为 `0`。</ResponseField>
    <ResponseField name="created_at" type="integer">创建时间，Unix 秒级时间戳。</ResponseField>
  </Tab>

  <Tab title="图生视频">
    ## 创建任务

    `POST /v1/video/generations`

    <div className="kling-api-example-panel">
      ```bash cURL theme={null}
      curl --request POST \
        --url https://www.anyfast.com.cn/v1/video/generations \
        --header 'Authorization: Bearer YOUR_API_KEY' \
        --header 'Content-Type: application/json' \
        --data '{
          "model": "happyhorse-1.0-i2v",
          "input": {
            "prompt": "镜头缓缓拉近，画面中的人物自然转头",
            "media": [
              {"type": "first_frame", "url": "https://example.com/first-frame.png"}
            ]
          },
          "parameters": {
            "resolution": "720P",
            "duration": 3,
            "watermark": false,
            "seed": 1
          }
        }'
      ```
    </div>

    ## 请求头

    <ParamField header="Authorization" type="string" required>Bearer 鉴权，格式为 `Bearer YOUR_API_KEY`。</ParamField>
    <ParamField header="Content-Type" type="string" default="application/json" required>请求体格式。</ParamField>

    ## 请求体

    <ParamField body="model" type="string" required>使用 `happyhorse-1.0-i2v`。</ParamField>
    <ParamField body="input" type="object" required>图生视频输入。</ParamField>
    <ParamField body="input.prompt" type="string">动作和镜头描述。非中文最多 5,000 字符，中文最多 2,500 字符，超出部分自动截断。</ParamField>
    <ParamField body="input.media" type="object[]" required>必须且只能包含 1 个首帧图片对象。</ParamField>
    <ParamField body="input.media[].type" type="string" required>固定为 `first_frame`。</ParamField>
    <ParamField body="input.media[].url" type="string" required>公网可下载的首帧图片 URL。</ParamField>
    <ParamField body="parameters" type="object">输出控制参数。图生视频不支持 `ratio`，输出比例跟随首帧。</ParamField>
    <ParamField body="parameters.resolution" type="string" default="1080P">可选值：`720P`、`1080P`。</ParamField>
    <ParamField body="parameters.duration" type="integer" default={5}>视频时长，3–15 秒。</ParamField>
    <ParamField body="parameters.watermark" type="boolean" default={true}>是否添加水印。</ParamField>
    <ParamField body="parameters.seed" type="integer">随机种子，范围为 0–2147483647。</ParamField>

    ## 创建响应

    <div className="kling-api-example-panel">
      ```json 200 theme={null}
      {
        "id": "asyntask_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "task_id": "asyntask_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "object": "video",
        "model": "happyhorse-1.0-i2v",
        "status": "queued",
        "progress": 0,
        "created_at": 1785464914
      }
      ```
    </div>

    <ResponseField name="id" type="string">AnyFast 任务 ID。</ResponseField>
    <ResponseField name="task_id" type="string">任务 ID，与 `id` 相同。</ResponseField>
    <ResponseField name="object" type="string">对象类型，固定为 `video`。</ResponseField>
    <ResponseField name="model" type="string">实际使用的模型 ID。</ResponseField>
    <ResponseField name="status" type="string">创建后的初始状态，固定为 `queued`。</ResponseField>
    <ResponseField name="progress" type="integer">创建时的初始进度，固定为 `0`。</ResponseField>
    <ResponseField name="created_at" type="integer">创建时间，Unix 秒级时间戳。</ResponseField>
  </Tab>

  <Tab title="参考生视频">
    ## 创建任务

    `POST /v1/video/generations`

    <div className="kling-api-example-panel">
      ```bash cURL theme={null}
      curl --request POST \
        --url https://www.anyfast.com.cn/v1/video/generations \
        --header 'Authorization: Bearer YOUR_API_KEY' \
        --header 'Content-Type: application/json' \
        --data '{
          "model": "happyhorse-1.0-r2v",
          "input": {
            "prompt": "让参考人物手持折扇走过灯火通明的长廊",
            "media": [
              {"type": "reference_image", "url": "https://example.com/person.jpg"},
              {"type": "reference_image", "url": "https://example.com/fan.jpg"},
              {"type": "reference_image", "url": "https://example.com/earrings.jpg"}
            ]
          },
          "parameters": {
            "resolution": "720P",
            "ratio": "9:21",
            "duration": 3,
            "watermark": false,
            "seed": 2
          }
        }'
      ```
    </div>

    ## 请求头

    <ParamField header="Authorization" type="string" required>Bearer 鉴权，格式为 `Bearer YOUR_API_KEY`。</ParamField>
    <ParamField header="Content-Type" type="string" default="application/json" required>请求体格式。</ParamField>

    ## 请求体

    <ParamField body="model" type="string" required>使用 `happyhorse-1.0-r2v`。</ParamField>
    <ParamField body="input" type="object" required>参考生视频输入。</ParamField>
    <ParamField body="input.prompt" type="string" required>视频内容描述。非中文最多 5,000 字符，中文最多 2,500 字符，超出部分自动截断。</ParamField>
    <ParamField body="input.media" type="object[]" required>AnyFast 当前节点接受 1–3 张参考图片。</ParamField>
    <ParamField body="input.media[].type" type="string" required>固定为 `reference_image`；不支持参考视频。</ParamField>
    <ParamField body="input.media[].url" type="string" required>公网可下载的参考图片 URL。</ParamField>
    <ParamField body="parameters" type="object">输出控制参数。</ParamField>
    <ParamField body="parameters.resolution" type="string" default="1080P">可选值：`720P`、`1080P`。</ParamField>
    <ParamField body="parameters.ratio" type="string" default="16:9">可选值：`16:9`、`9:16`、`1:1`、`4:3`、`3:4`、`4:5`、`5:4`、`9:21`、`21:9`。</ParamField>
    <ParamField body="parameters.duration" type="integer" default={5}>视频时长，3–15 秒。</ParamField>
    <ParamField body="parameters.watermark" type="boolean" default={true}>是否添加水印。</ParamField>
    <ParamField body="parameters.seed" type="integer">随机种子，范围为 0–2147483647。</ParamField>

    ## 创建响应

    <div className="kling-api-example-panel">
      ```json 200 theme={null}
      {
        "id": "asyntask_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "task_id": "asyntask_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "object": "video",
        "model": "happyhorse-1.0-r2v",
        "status": "queued",
        "progress": 0,
        "created_at": 1785464914
      }
      ```
    </div>

    <ResponseField name="id" type="string">AnyFast 任务 ID。</ResponseField>
    <ResponseField name="task_id" type="string">任务 ID，与 `id` 相同。</ResponseField>
    <ResponseField name="object" type="string">对象类型，固定为 `video`。</ResponseField>
    <ResponseField name="model" type="string">实际使用的模型 ID。</ResponseField>
    <ResponseField name="status" type="string">创建后的初始状态，固定为 `queued`。</ResponseField>
    <ResponseField name="progress" type="integer">创建时的初始进度，固定为 `0`。</ResponseField>
    <ResponseField name="created_at" type="integer">创建时间，Unix 秒级时间戳。</ResponseField>
  </Tab>

  <Tab title="视频编辑">
    ## 创建任务

    `POST /v1/video/generations`

    <div className="kling-api-example-panel">
      ```bash cURL theme={null}
      curl --request POST \
        --url https://www.anyfast.com.cn/v1/video/generations \
        --header 'Authorization: Bearer YOUR_API_KEY' \
        --header 'Content-Type: application/json' \
        --data '{
          "model": "happyhorse-1.0-video-edit",
          "input": {
            "prompt": "让视频中的角色穿上参考图片中的条纹毛衣",
            "media": [
              {"type": "video", "url": "https://example.com/source.mp4"},
              {"type": "reference_image", "url": "https://example.com/sweater.webp"}
            ]
          },
          "parameters": {
            "resolution": "720P",
            "watermark": false,
            "audio_setting": "origin",
            "seed": 2147483647
          }
        }'
      ```
    </div>

    ## 请求头

    <ParamField header="Authorization" type="string" required>Bearer 鉴权，格式为 `Bearer YOUR_API_KEY`。</ParamField>
    <ParamField header="Content-Type" type="string" default="application/json" required>请求体格式。</ParamField>

    ## 请求体

    <ParamField body="model" type="string" required>使用 `happyhorse-1.0-video-edit`。</ParamField>
    <ParamField body="input" type="object" required>视频编辑输入。</ParamField>
    <ParamField body="input.prompt" type="string" required>编辑指令。非中文最多 5,000 字符，中文最多 2,500 字符，超出部分自动截断。</ParamField>
    <ParamField body="input.media" type="object[]" required>必须且只能包含 1 个视频，还可包含 0–5 张参考图片。</ParamField>
    <ParamField body="input.media[].type" type="string" required>视频使用 `video`，图片使用 `reference_image`。</ParamField>
    <ParamField body="input.media[].url" type="string" required>公网可下载的素材 URL。</ParamField>
    <ParamField body="parameters" type="object">输出控制参数。不要传 `ratio` 或 `duration`。</ParamField>
    <ParamField body="parameters.resolution" type="string" default="1080P">可选值：`720P`、`1080P`。</ParamField>
    <ParamField body="parameters.watermark" type="boolean" default={true}>是否添加水印。</ParamField>
    <ParamField body="parameters.audio_setting" type="string" default="auto">`auto` 自动处理音频；`origin` 保留原视频音频。</ParamField>
    <ParamField body="parameters.seed" type="integer">随机种子，范围为 0–2147483647。</ParamField>

    ## 创建响应

    <div className="kling-api-example-panel">
      ```json 200 theme={null}
      {
        "id": "asyntask_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "task_id": "asyntask_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "object": "video",
        "model": "happyhorse-1.0-video-edit",
        "status": "queued",
        "progress": 0,
        "created_at": 1785464914
      }
      ```
    </div>

    <ResponseField name="id" type="string">AnyFast 任务 ID。</ResponseField>
    <ResponseField name="task_id" type="string">任务 ID，与 `id` 相同。</ResponseField>
    <ResponseField name="object" type="string">对象类型，固定为 `video`。</ResponseField>
    <ResponseField name="model" type="string">实际使用的模型 ID。</ResponseField>
    <ResponseField name="status" type="string">创建后的初始状态，固定为 `queued`。</ResponseField>
    <ResponseField name="progress" type="integer">创建时的初始进度，固定为 `0`。</ResponseField>
    <ResponseField name="created_at" type="integer">创建时间，Unix 秒级时间戳。</ResponseField>
  </Tab>

  <Tab title="查询任务">
    ## 查询任务

    `GET /v1/video/generations/{task_id}`

    <div className="kling-api-example-panel">
      ```bash cURL theme={null}
      curl --request GET \
        --url https://www.anyfast.com.cn/v1/video/generations/TASK_ID \
        --header 'Authorization: Bearer YOUR_API_KEY'
      ```
    </div>

    ## 请求头

    <ParamField header="Authorization" type="string" required>Bearer 鉴权，格式为 `Bearer YOUR_API_KEY`。</ParamField>

    ## 路径参数

    <ParamField path="task_id" type="string" required>创建响应返回的任务 ID。</ParamField>

    ## 任务响应

    <div className="kling-api-example-panel">
      ```json 200 theme={null}
      {
        "code": "success",
        "message": "",
        "data": {
          "task_id": "asyntask_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
          "action": "textGenerate",
          "status": "SUCCESS",
          "result_url": "https://example.com/generated-video.mp4",
          "fail_reason": "https://example.com/generated-video.mp4",
          "submit_time": 1785464914,
          "start_time": 1785464918,
          "finish_time": 1785464980,
          "progress": "100%",
          "request_id": "request_xxxxxxxxxxxxxxxx",
          "data": {
            "output": {
              "task_id": "upstream-task-id",
              "task_status": "SUCCEEDED",
              "video_url": "https://example.com/generated-video.mp4",
              "orig_prompt": "夜色中的未来城市",
              "submit_time": "2026-07-31 10:00:00.000",
              "scheduled_time": "2026-07-31 10:00:01.000",
              "end_time": "2026-07-31 10:01:06.000"
            },
            "request_id": "upstream-request-id",
            "usage": {
              "SR": 720,
              "duration": 3,
              "input_video_duration": 0,
              "output_video_duration": 3,
              "ratio": "21:9",
              "video_count": 1
            }
          }
        }
      }
      ```
    </div>

    <ResponseField name="code" type="string">查询成功时为 `success`。</ResponseField>
    <ResponseField name="message" type="string">附加消息。</ResponseField>
    <ResponseField name="data" type="object">任务状态、结果和上游数据。</ResponseField>
    <ResponseField name="data.task_id" type="string">AnyFast 任务 ID。</ResponseField>
    <ResponseField name="data.action" type="string">工作流动作：文生视频为 `textGenerate`，图生视频为 `generate`，参考生视频为 `referenceGenerate`，视频编辑为 `videoEdit`。</ResponseField>
    <ResponseField name="data.status" type="string">`NOT_START`、`QUEUED`、`IN_PROGRESS`、`SUCCESS` 或 `FAILURE`。</ResponseField>
    <ResponseField name="data.result_url" type="string">成功后的结果视频 URL。</ResponseField>
    <ResponseField name="data.fail_reason" type="string">失败详情。兼容层在成功响应中也可能把此字段填为结果 URL，因此应以 `data.status` 判断结果。</ResponseField>
    <ResponseField name="data.submit_time" type="integer">任务提交时间，Unix 秒级时间戳。</ResponseField>
    <ResponseField name="data.start_time" type="integer">任务开始时间；未开始时可为 `0`。</ResponseField>
    <ResponseField name="data.finish_time" type="integer">任务结束时间。</ResponseField>
    <ResponseField name="data.progress" type="string">百分比字符串，例如 `100%`。</ResponseField>
    <ResponseField name="data.request_id" type="string">AnyFast 请求追踪 ID。</ResponseField>
    <ResponseField name="data.data" type="object">上游原始输出和用量；任务未完成时可能缺失。</ResponseField>
    <ResponseField name="data.data.output" type="object">上游输出详情。</ResponseField>
    <ResponseField name="data.data.output.task_id" type="string">上游任务 ID。</ResponseField>
    <ResponseField name="data.data.output.task_status" type="string">上游状态，例如 `PENDING`、`RUNNING`、`SUCCEEDED`、`FAILED` 或 `CANCELED`。</ResponseField>
    <ResponseField name="data.data.output.video_url" type="string">上游结果视频 URL。</ResponseField>
    <ResponseField name="data.data.output.orig_prompt" type="string">原始提示词。</ResponseField>
    <ResponseField name="data.data.output.submit_time" type="string">上游提交时间。</ResponseField>
    <ResponseField name="data.data.output.scheduled_time" type="string">上游调度时间。</ResponseField>
    <ResponseField name="data.data.output.end_time" type="string">上游结束时间。</ResponseField>
    <ResponseField name="data.data.request_id" type="string">上游请求 ID。</ResponseField>
    <ResponseField name="data.data.usage" type="object">上游用量和输出指标。</ResponseField>
    <ResponseField name="data.data.usage.SR" type="integer">输出分辨率档位，例如 `720` 或 `1080`。</ResponseField>
    <ResponseField name="data.data.usage.duration" type="number">计费用量中的总时长。</ResponseField>
    <ResponseField name="data.data.usage.input_video_duration" type="number">输入视频时长；非视频编辑任务通常为 `0`。</ResponseField>
    <ResponseField name="data.data.usage.output_video_duration" type="number">输出视频时长。</ResponseField>
    <ResponseField name="data.data.usage.ratio" type="string">输出比例；图生视频和视频编辑响应可能不返回。</ResponseField>
    <ResponseField name="data.data.usage.video_count" type="integer">生成的视频数量。</ResponseField>
  </Tab>
</Tabs>
