| Method | Endpoint | Description |
|---|
| POST | /api/v1/generateTask/ltx-2-19b | 创建生成任务 |
| GET | /api/v1/statusTask/ltx-2-19b | 查询任务状态 |
所有请求需在请求头中携带 API 密钥:
Authorization: Bearer YOUR_API_KEY
请求体
{
"request_type": "async",
"callback_url": "https://...",
"provider": "auto",
"input": {
"mode": "text-to-video",
"prompt": "...",
"resolution": "1080p",
"duration": 10,
"aspect_ratio": "16:9",
"image_urls": ["..."],
"seed": 12345,
"loras": [
{"path": "...", "scale": 1.2}
]
}
}
async(轮询)或 callback(webhook)
回调 URL,当 request_type=callback 时必填(条件必填)
路由策略:auto、value 或 official
模型输入参数
mode
string
默认值:"text-to-video"
必填
text-to-video、image-to-video、text-to-video-LoRA 或 image-to-video-LoRA
参考图,仅 1 张(-image-to-video 模式必填)(条件必填)
16:9 或 9:16(仅 -text-to-video 模式)
LoRA 模型数组(仅 *-LoRA 模式),最多 3 个
模式选项:
text-to-video — 从文字生成视频
image-to-video — 从图片生成视频
text-to-video-LoRA — 带 LoRA 的文生视频
image-to-video-LoRA — 带 LoRA 的图生视频
文生视频
curl -X POST "https://api.apixo.ai/api/v1/generateTask/ltx-2-19b" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request_type": "async",
"input": {
"mode": "text-to-video",
"prompt": "a futuristic city with flying cars at sunset",
"resolution": "1080p",
"duration": 10,
"aspect_ratio": "16:9",
"seed": 54248617
}
}'
带 LoRA 的图生视频
curl -X POST "https://api.apixo.ai/api/v1/generateTask/ltx-2-19b" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request_type": "callback",
"callback_url": "https://your-server.com/callback",
"provider": "official",
"input": {
"mode": "image-to-video-LoRA",
"prompt": "make it cinematic with slow pan and dramatic lighting",
"resolution": "720p",
"duration": 8,
"image_urls": ["https://example.com/ref.jpg"],
"loras": [
{
"path": "https://huggingface.co/username/model.safetensors?download=true",
"scale": 1.2
}
]
}
}'
带多 LoRA 的文生视频
curl -X POST "https://api.apixo.ai/api/v1/generateTask/ltx-2-19b" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request_type": "async",
"input": {
"mode": "text-to-video-LoRA",
"prompt": "anime style magical girl transformation sequence",
"resolution": "720p",
"duration": 12,
"aspect_ratio": "9:16",
"loras": [
{"path": "https://huggingface.co/user1/anime_style.safetensors?download=true", "scale": 1.5},
{"path": "https://huggingface.co/user2/magic_effects.safetensors?download=true", "scale": 0.8}
]
}
}'
POST /api/v1/generateTask/ltx-2-19b
成功时返回 taskId,用于后续查询状态。
成功:
{
"code": 200,
"message": "success",
"data": {
"taskId": "task_12345678"
}
}
错误:
{
"code": 400,
"message": "Insufficient credits",
"data": null
}
GET /api/v1/statusTask/ltx-2-19b
通过 taskId 查询任务执行状态与结果。
curl -X GET "https://api.apixo.ai/api/v1/statusTask/ltx-2-19b?taskId=task_12345678" \
-H "Authorization: Bearer YOUR_API_KEY"
成功:
{
"code": 200,
"message": "success",
"data": {
"taskId": "task_12345678",
"state": "success",
"resultJson": "{\"resultUrls\":[\"https://r2.apixo.ai/video.mp4\"]}",
"createTime": 1767965610929,
"completeTime": 1767965652317,
"costTime": 41388
}
}
失败:
{
"code": 200,
"message": "success",
"data": {
"taskId": "task_12345678",
"state": "failed",
"failCode": "CONTENT_VIOLATION",
"failMsg": "Content does not meet safety guidelines"
}
}
状态响应字段
当前任务状态:pending、processing、success 或 failed。
包含 resultUrls 数组的 JSON 字符串。仅在成功时存在。使用 JSON.parse() 解析。
错误码。仅当 state 为 failed 时存在。详见错误码。
可读的错误信息。仅当 state 为 failed 时存在。
错误码
| Code | Description |
|---|
| 400 | 参数无效或请求错误 |
| 401 | API 密钥无效或缺失 |
| 429 | 超过速率限制 |
| Fail Code | Description |
|---|
CONTENT_VIOLATION | 内容违反安全准则 |
INVALID_IMAGE_URL | 无法访问提供的图片 URL |
INVALID_LORA_URL | 无法下载 LoRA 模型 |
速率限制
| Limit | Value |
|---|
| Requests | 10000 / minute |
| Concurrent tasks | 1000 |
超出限制返回 429 错误。请稍后重试。
- 生成时间:
- 480p:约 40-60 秒
- 720p:约 60-90 秒
- 1080p:约 90-120 秒
- LoRA 模式加载增加约 10-20 秒
- 提交任务后等待 60 秒,再每隔 5 秒轮询
- 回调模式:视频生成耗时,强烈建议使用
callback 模式。
- 视频有效期:结果 URL 有效期为 15 天。请及时下载。
- 内容审核:prompt 需符合内容安全准则。
- LoRA 微调:
- 加载自定义 LoRA 以实现特定风格或角色
- LoRA URL 需可公开下载(HuggingFace、Civitai 等)
- URL 建议包含
?download=true 等下载参数
- 最多同时使用 3 个 LoRA
scale 控制 LoRA 影响,建议:0.5-2.0
- 分辨率选择:
480p:快速生成,适合预览
720p:质量与速度平衡
1080p:最高质量,适合最终输出
- 时长:支持 5-20 秒灵活时长,按秒计费。
- 种子复现:相同
seed + prompt + 参数可复现相同结果。
- 图片格式:
image_urls 支持 JPG、PNG、WebP,单张最大 10MB。
- LoRA 兼容:建议使用视频训练的 LoRA;图像 LoRA 效果可能不佳。
视频生成比图像耗时更长 — 生产环境请使用 callback 模式。结果 URL 15 天后失效,请及时下载重要输出。