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

# 任务式接口：创建、查询、下载

> 所有视频模型共用的异步流程：状态值、轮询频率、下载方式和失败处理

> [!NOTE]
>
> **给 AI 助手的要点**
>
> 1. `POST https://1788.love/v1/videos` 创建任务，保存返回的 `id`。
> 2. 每 3–5 秒 `GET https://1788.love/v1/videos/{id}`，直到 `status` 为 `completed` 或 `failed`。
> 3. `completed` 后 `GET https://1788.love/v1/videos/{id}/content`（带 API Key）下载 MP4，跟随重定向。
> 4. 所有视频模型（Seedance、Grok 等）都按这个流程，不用分别处理。

## 1. 创建任务

```http theme={null}
POST https://1788.love/v1/videos
Authorization: Bearer YOUR_1788_API_KEY
Content-Type: application/json
```

请求体按模型填写，见各模型页面。成功响应：

```json theme={null}
{ "id": "task_xxxxxxxx", "object": "video", "model": "seedance-hc-2.5", "status": "queued", "progress": 0, "created_at": 1793500000 }
```

参数不合法时直接返回 4xx 和错误信息，任务不会创建，也不扣费。

## 2. 查询状态

```http theme={null}
GET https://1788.love/v1/videos/{id}
Authorization: Bearer YOUR_1788_API_KEY
```

| `status` | 含义 | 下一步 |
| - | - | - |
| `queued` | 排队中 | 继续查询 |
| `in_progress`（部分模型为 `processing`） | 生成中，`progress` 为 0–100 | 继续查询 |
| `completed` | 完成 | 下载 |
| `failed` | 失败，原因在 `error.message` | 不扣费；修改后重新提交 |

判断时把 `completed`、`succeeded`、`success` 都当完成，`failed`、`error`、`canceled` 都当失败，其余一律继续查询。生成通常需要 1–10 分钟，长视频和高峰期更久；建议设置 30 分钟以上的总超时。

## 3. 下载视频

```bash theme={null}
curl -L https://1788.love/v1/videos/{id}/content \
  -H "Authorization: Bearer YOUR_1788_API_KEY" \
  -o result.mp4
```

* 返回视频二进制，或重定向到存储地址，请跟随重定向（`curl -L`、`requests` 默认跟随）。
* 查询结果里也可能带 `url` 字段；`/content` 对所有模型都可用，推荐统一用它。
* 结果文件只保留一段时间，请完成后尽快下载到自己的存储。

## 下游也是 New API？

如果你的平台也是 New API，接入 1788 的视频模型时渠道类型选 `Sora`（不要选 `OpenAI`），Base URL 填 `https://1788.love`。详见[下游 New API 对接](https://docs.1788.love/guides/new-api-sora-channel.md)。

## 建议

* 轮询间隔 3–5 秒，不要更频繁；收到 `429` 时等待后重试。
* 同时提交很多任务时，控制并发，按任务 `id` 分别轮询。
* 在你自己的数据库里记录任务 `id`，程序重启后可以继续查询，不必重新提交。


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