---
title: "Omni Flash 1.2 视频"
url: "/docs/omni-flash"
base_url:
  - "https://api.o1key.com"  # 主地址
auth: "Authorization: Bearer <API Key>"
endpoints:
  - "POST /v1/videos"
  - "GET /v1/videos/{task_id}"
  - "GET /v1/videos/{task_id}/content"
---

# Omni Flash 1.2 视频

文生视频和视频编辑，按次计费。提交后返回任务 ID，查询到 `completed` 后下载 MP4。

## Agent 调用规则

1. POST `/v1/videos`，`model` 固定 `omni_flash-1.2`；传 `source_video_url` 即为视频编辑。记录返回的任务 ID。
2. 定期 GET `/v1/videos/{task_id}`，`queued` 或 `in_progress` 时继续查询。
3. `completed`：GET `/v1/videos/{task_id}/content` 下载 MP4 交给用户。
4. `failed`：把错误信息告诉用户，不要自动重试。

## 简明说明

### 这个接口做什么？

用 Omni Flash 1.2 生成视频，或编辑一段已有视频，按次计费。接口先返回**任务编号**，完成后用内容接口下载视频文件。

### 你需要提供的信息

- **用哪个模型**：`model`，固定 `omni_flash-1.2`。
- **想要什么画面**：`prompt`；编辑视频时写明要改什么。
- **待编辑视频（编辑时必填）**：`source_video_url`，公网 URL，可先用素材上传得到。
- **时长与分辨率（可选）**：`seconds`、`resolution`、`aspect_ratio`。

### 怎么拿到结果

- **状态**：`queued`、`in_progress` 继续等待；`completed` 成功；`failed` 失败。
- **视频文件**：`completed` 后 GET `/v1/videos/{task_id}/content`，响应体就是 MP4。

## 创建 Omni Flash 1.2 视频任务

`POST /v1/videos`

固定使用 `omni_flash-1.2`，请求体为 JSON。

> **时长字段**：只用 `seconds`，且必须是整数（写 `8`，不要写 `"8"`）。传 `duration` 会被拒绝。

### 请求参数

| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| `model` | string | 是 | 固定为 `omni_flash-1.2`。 |
| `prompt` | string | 是 | 视频内容描述；视频编辑时写明要修改的内容。 |
| `seconds` | integer | 否 | 输出时长（秒），整数。 |
| `resolution` | string | 否 | `720p`、`1080p` 或 `4k`。不传按 `720p` 计费。 |
| `aspect_ratio` | string | 否 | `16:9` 或 `9:16`。 |
| `source_video_url` | string | 条件 | 视频编辑时必填，待编辑视频的公网 URL。可先用[素材上传](/docs/temporary-upload.md)得到 URL。也可写作 `video_url`。 |

### 计费

按次计费，与时长无关。传入 `source_video_url` 或 `video_url` 即按视频编辑计费，否则按视频生成计费。密钥若有分组倍率，再乘该倍率。任务失败不扣费。

| 操作 | 720p | 1080p | 4K |
|---|---|---|---|
| 视频生成 | ¥1.00 / 次 | ¥1.00 / 次 | ¥1.50 / 次 |
| 视频编辑 | ¥1.50 / 次 | ¥1.50 / 次 | ¥2.00 / 次 |

### 请求示例

#### 文生视频

```bash
curl https://api.o1key.com/v1/videos \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "omni_flash-1.2",
    "prompt": "一只小猫在阳光下轻轻挥手",
    "seconds": 8,
    "resolution": "720p",
    "aspect_ratio": "16:9"
  }'
```

#### 视频编辑

```bash
curl https://api.o1key.com/v1/videos \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "omni_flash-1.2",
    "prompt": "保持人物动作不变，把背景换成雨夜街道",
    "source_video_url": "https://cdn.example.com/source.mp4",
    "resolution": "1080p"
  }'
```

### 创建响应

```json
{
  "id": "task_xxxxxxxxxx",
  "task_id": "task_xxxxxxxxxx",
  "object": "video",
  "model": "omni_flash-1.2",
  "status": "queued",
  "progress": 0,
  "created_at": 1794490280
}
```

### 参数错误响应

```json
{
  "code": "invalid_request",
  "message": "seconds must be an integer",
  "data": null
}
```

## 查询与下载 Omni Flash 1.2 视频

`GET /v1/videos/{task_id}`
`GET /v1/videos/{task_id}/content`

状态：`queued`、`in_progress`、`completed`、`failed`。

`completed` 后调用内容接口下载 MP4。

### 查询状态

```bash
curl https://api.o1key.com/v1/videos/<task_id> \
  -H "Authorization: Bearer $API_KEY"
```

### 完成响应

```json
{
  "id": "task_xxxxxxxxxx",
  "object": "video",
  "model": "omni_flash-1.2",
  "status": "completed",
  "progress": 100,
  "created_at": 1794490280,
  "completed_at": 1794490324
}
```

### 下载视频

```bash
curl https://api.o1key.com/v1/videos/<task_id>/content \
  -H "Authorization: Bearer $API_KEY" \
  --output omni-flash-result.mp4
```
