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

# Hailuo 2.3 Fast API：快速图生视频

> Hailuo 2.3 Fast 图生视频 API 提供标准和专业模式，可从单个参考图像快速生成剪辑。

## 概览

Hailuo 2.3 Fast 可将单张原图生成为一段短视频。在 APIXO Playground 试用后，可以按本页示例调用 API。

| 功能 | 值 |
| - | - |
| 模型 ID | `hailuo-2-3-fast` |
| 模式 | `standard-image-to-video`, `pro-image-to-video` |
| 输入类型 | 仅图生视频 |
| 参考图片 | 正好 1 个图像 URL |
| 标准时长 | `6` 或 `10` 秒 |
| 专业时长 | 固定 6 秒 |
| 输出分辨率 | 标准：`768p`；专业：`1080p` |
| 结果类型 | 视频 URL 位于 `resultJson.resultUrls` 中 |

## 接口与身份验证

API 基础地址：

```text theme={null}
https://api.apixo.ai/api/v1
```

| 方法 | 端点 | 用途 |
| - | - | - |
| `POST` | `/generateTask/hailuo-2-3-fast` | 提交生成任务 |
| `GET` | `/statusTask/hailuo-2-3-fast?taskId={taskId}` | 查询任务状态并获取结果 |

每个请求都必须携带 APIXO API 密钥：

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

提交任务时，还需要设置以下请求头：

```http theme={null}
Content-Type: application/json
```

## 异步请求示例

此最小请求提交标准图生视频任务并返回 `taskId`

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/hailuo-2-3-fast" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "standard-image-to-video",
      "prompt": "animate this character portrait with a gentle cinematic camera move",
      "image_urls": [
        "https://example.com/input.jpg"
      ],
      "duration": 6
    }
  }'
```

成功响应：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
```

保存 `taskId`，后续轮询结果时需要用到它。

## 轮询结果

```bash theme={null}
curl -X GET "https://api.apixo.ai/api/v1/statusTask/hailuo-2-3-fast?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

任务处理中的响应示例：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "processing",
    "createTime": 1767965610929
  }
}
```

成功响应：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://file.apixo.ai/video.mp4\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965730929,
    "costTime": 120000
  }
}
```

任务失败时的响应示例：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "SensitiveContent",
    "failMsg": "Content was rejected by safety checks, please adjust the prompt",
    "createTime": 1767965610929,
    "completeTime": 1767965620132
  }
}
```

等 `state` 变为 `success` 后，再解析 `resultJson`：

```javascript theme={null}
const payload = JSON.parse(data.resultJson);
const videoUrls = payload.resultUrls;
```

## 请求体

### 标准图生视频

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "standard-image-to-video",
    "prompt": "animate this still image with smooth parallax and lighting changes",
    "image_urls": [
      "https://example.com/input.jpg"
    ],
    "duration": 10
  }
}
```

### 专业图像转视频

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "pro-image-to-video",
    "prompt": "animate this image into a high-energy camera move",
    "image_urls": [
      "https://example.com/input.jpg"
    ]
  }
}
```

## 参数

**request\_type** `string` *required* (default: async)

结果获取方式。选择 `async` 时，通过 `statusTask` 轮询结果；选择 `callback` 时，通过 Webhook 接收结果。

**callback\_url** `string`

当 `request_type` 为 `callback` 时必填。请提供公网可访问的 HTTPS 地址，用于接收任务的最终结果。详见 [Webhook](https://apixo.ai/docs/zh/api-reference/webhooks.md)。

**input** `object` *required*

Hailuo 2.3 Fast 的输入参数。

**属性**

**mode** `string` *required*

生成模式。支持的值：`standard-image-to-video`、`pro-image-to-video`。使用精确的小写值；不支持文本转视频模式。

**prompt** `string` *required*

描述所需动作和场景的文本提示。必须是非空字符串且不超过2,000 UTF-8字节；仅包含空格的提示将被拒绝。最大长度：2000 UTF-8字节。

**image\_urls** `string[]` *required*

源图像 URL。必须恰好包含一个非空字符串。图像应为公共 JPG、JPEG 或 PNG URL，不大于 20 MB，长宽比大于 2:5 且小于 5:2，短边大于 300 像素。

**duration** `integer|string`

`standard-image-to-video` 任务必需。支持的值：`6`、`10`、`"6"` 或 `"10"`。后端将有效值标准化为整数用于生成和计费。`pro-image-to-video` 模式忽略该参数，始终输出 6 秒视频。

> [!TIP]
>
> Hailuo 2.3 Fast仅支持图像转视频。如果您需要文本转视频，请使用明确支持该模式的其他 Hailuo 模型。

## 响应格式

### 提交任务时的响应

任务受理后，`POST /generateTask/hailuo-2-3-fast` 会返回任务 ID：

**code** `integer`

API 状态码。`200` 表示任务已受理。

**message** `string`

状态说明。

**data.taskId** `string`

任务的唯一 ID，用于查询任务状态。

### 状态响应字段

**taskId** `string`

任务的唯一标识符。

**state** `string`

当前任务状态，可能的值为 `processing`、`success`、`failed`。

**resultJson** `string`

包含生成视频 URL 的 JSON 字符串。当 `state` 为 `success` 时返回。

**failCode** `string`

供程序处理的错误码，仅在 `state` 为 `failed` 时返回。

**failMsg** `string`

失败原因说明，仅在 `state` 为 `failed` 时返回。

**createTime** `integer`

任务创建时的 Unix 时间戳，单位为毫秒。

**completeTime** `integer`

任务完成时间戳（以 Unix 毫秒为单位）。任务完成后可用时返回。

**costTime** `integer`

处理耗时，单位为毫秒。任务完成且有该数据时返回。

## Webhook 回调模式

如果希望服务端自动收到最终结果，可以使用回调模式，无需轮询。

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/hailuo-2-3-fast" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/webhooks/apixo",
    "input": {
      "mode": "pro-image-to-video",
      "prompt": "animate this product photo with a polished studio camera move",
      "image_urls": [
        "https://example.com/input.jpg"
      ]
    }
  }'
```

Webhook 接收要求和重试规则见 [Webhook 文档](https://apixo.ai/docs/zh/api-reference/webhooks.md)。

## 计费

新提交的非 LLM 请求按 **1 积分 = `$0.001`** 计费。先按用量和附加项目计算总额，再应用账号折扣，最后将请求总额向上取整到整数积分。如果约定了固定单价，则按该单价的原始精度计算，不再使用标准价或另行打折；最终积分仍向上取整。详见[积分换算与取整](https://apixo.ai/docs/zh/pricing.md#credit-conversion-and-rounding)。

Hailuo 2.3 Fast 计费取决于所选的 `mode`。标准模式按输出时长计费；专业模式按任务计费。

| 模式 | 单位 | APIXO 价格 | 可计费金额 |
| - | - | - | - |
| `standard-image-to-video` | 每输出秒 | `$0.032 / second` | `duration * $0.032` |
| `pro-image-to-video` | 每个任务 | `$0.33 / use` | `$0.33` |

最新的美元费率见 [API 价目表](https://apixo.ai/pricing/api)。

## 延迟与轮询

视频生成是异步的。实际延迟可能因输入图像、提示复杂性、当前队列负载和存储传输时间而异。

| 模式 | 输出持续时间 | 建议首次查询时间 | 轮询间隔 |
| - | - | - | - |
| `standard-image-to-video` | `6` 或 `10` 秒 | 任务创建 30 秒后 | 10s |
| `pro-image-to-video` | 固定 6 秒 | 任务创建 30 秒后 | 10s |

当定时数据可用时，完成后以毫秒为单位返回 `costTime`。当 `state` 为 `processing` 时继续轮询。

> [!TIP]
>
> 对于生产工作负载，请使用回调模式以避免对长时间运行的视频任务进行频繁轮询。

请求频率和并发上限因账号、API 密钥和路由而异。收到 `429` 时，请降低请求频率，逐步延长重试间隔。账号级限制见[系统 API](https://apixo.ai/docs/zh/api-reference/system.md)。

## 错误与排查

### HTTP 错误

| 代码 | 含义 | 处理方式 |
| - | - | - |
| `400` | 请求体无效、缺少必填字段、模式不受支持、持续时间无效或输入 URL 无效 | 在重试前修复请求 |
| `401` | 缺少 API 密钥，或密钥无效 | 检查 `Authorization` 请求头 |
| `402` | 余额或配额不足 | 充值或更换账号或API密钥 |
| `403` | 密钥或路由无权访问该模型 | 检查权限和路由策略 |
| `429` | 已达到速率或并发限制 | 按指数退避策略重试 |
| `500` | 服务器错误或未知任务失败 | 逐步延长间隔后重试 |
| `502` | 服务错误 | 逐步延长间隔后重试 |
| `504` | 服务超时 | 重试；耗时较长的任务可改用回调模式 |

### 任务失败错误码

任务失败代码标识任务失败的原因。常见的例子包括：

| 错误码 | 含义 | 处理方式 |
| - | - | - |
| `PromptInvalid` | 提示词无效或被拒绝 | 修改提示词后重试 |
| `SensitiveContent` | 提示或媒体违反内容安全要求 | 更改提示或输入图像 |
| `NSFW` | 输入或输出被标记为 NSFW | 使用不同的内容 |
| `ProhibitedContentDetected` | 检测到违禁内容 | 更改提示或输入图像 |
| `ImageFormatIncorrect` | 图片格式或上传验证失败 | 使用公共 JPG、JPEG 或 PNG URL |
| `InvalidImageSize` | 图像尺寸或大小无效 | 检查宽高比、短边和文件大小 |
| `RateLimited` | 请求频率达到上限 | 按指数退避策略重试 |
| `Timeout` | 任务超时 | 重试、简化提示或者使用回调方式 |
| `InsufficientBalance` | 生成服务暂时不可用 | 稍后重试或联系支持人员 |
| `Unknown error` | 任务因未知原因失败 | 重试并退避；如果问题仍然存在，请联系支持人员 |

### 请求校验

* 仅发送一件 `image_urls` 项目
* 仅使用 `standard-image-to-video` 或 `pro-image-to-video`。
* 仅当需要标准模式时才包含 `duration`；专业模式会忽略它。
* 对于标准模式，将 `duration` 用作 `6`、`10`、`"6"` 或 `"10"`。
* 使用可公开访问且可直接获取的 JPG、JPEG 或 PNG 图像 URL。

完整列表见[错误码](https://apixo.ai/docs/zh/api-reference/errors.md)。

## MCP 集成

[完整模型 Schema](https://apixo.ai/docs/models/schemas/video/hailuo-2-3-fast.json) 中的 `mcp.result` 指定了结果的解析方式，`mcp.attachments` 列出支持绑定文件的字段。这些元数据供客户端集成使用，无需作为生成参数提交。附件字段为 `image_urls`。请保留用户指定的文件顺序。API 负责校验模型参数。

## 相关链接

* [生成 API 概览](https://apixo.ai/docs/zh/models.md)
* [视频模型](https://apixo.ai/docs/zh/models/video)
* [提交生成任务](https://apixo.ai/docs/zh/api-reference/generate-task.md)
* [查询任务状态](https://apixo.ai/docs/zh/api-reference/status-task.md)
* [Webhook](https://apixo.ai/docs/zh/api-reference/webhooks.md)
* [错误码](https://apixo.ai/docs/zh/api-reference/errors.md)
* [参数规范](https://apixo.ai/docs/zh/api-reference/parameters.md)
* [路由策略](https://apixo.ai/docs/zh/concepts/routing-strategies.md)
* [在 APIXO Playground 尝试 Hailuo 2.3 Fast](https://apixo.ai/models/hailuo-2-3-fast)
* [API定价](https://apixo.ai/pricing/api)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.