# AI视频接口 API Documentation

> AI短视频生成V2.0

## Overview

This document describes how to call the **AI视频接口** API.

- **Model / path slug**: `video/create`
- **Task type**: `sync` (`sync` = synchronous, `async` = create task then poll / callback)
- **HTML docs**: `/doc/6`

## Authentication

All API requests require your platform API key as the query parameter `key`:

```
?key=YOUR_API_KEY
```

Get API Key:
1. Sign in to the console
2. Open [API Key Management](/user/key) and create or copy your key
3. Append `key=YOUR_API_KEY` to the request URL (or pass it in form/JSON when the endpoint accepts it)

---

## API Information

- **URL**: `POST https://apis.xiaobao.ink/api/video/create`
- **Content-Type**: `application/json` (request body commonly `application/json` or `application/x-www-form-urlencoded` for POST)
- **HTTP Method**: `POST`

### Request Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `prompt` | Yes | 提示词。 须避免出现黄、暴、政相关内容 |
| `image_urls` | Yes | 参考图URL；多张用，隔开 、图片须避免出现真人形象 上传后的文件 URL；最大大小：10.0MB |
| `aspect_ratio` | Yes | 输出视频比例, 支持的比例:   9:16（竖屏），   16:9（横屏） 默认：9:16 |
| `remixid` | Yes | 视频续作 remix目标id 可参考返回结果的pid值: s_xxxxxxxxx |
| `characters` | Yes | 上传角色视频，支持多角色 (不可上传真人视频) ----------- url: 角色视频URL ----------- timestamps: 角色视频范围 格式为: 开始秒数,结束秒数。例如: 0,3。最多3秒 ----------- 角色上传后自动引用，如需指定引用角色A或角色B，请在提示词里添加@character1或@character2，格式为：@character+角色位置 |
| `notify` | Yes | 回调地址 （ 任务推送地址） |

> **Note**: `key` (API key) is required for authenticated calls even if omitted from the parameter list above.

### Request Example

```
https://apis.xiaobao.ink/api/video/create?key=你的密钥
```

## Details

## 请求HEADER：

| 名称 | 值 |
| --- | --- |
| Content-Type | application/json |

## 请求参数说明：

| 名称 | 必填 | 类型 | 示例值 | 说明 |
| --- | --- | --- | --- | --- |
| prompt | 是 | string |  一个美女在喝茶 | 提示词 须避免出现黄、暴、政相关内容 |
| image_urls | 否 | string | ['https://xx.png','https://xxx.png'] | 隔开 、图片须避免出现真人形象 上传后的文件 URL；最大大小：10.0MB |
| aspect_ratio | 否 | string | 9:16 | 输出视频比例, 支持的比例:   9:16（竖屏），   16:9（横屏） 默认：9:16 |
| remixid | 否 | string | s_xxxxxxxxx | 视频续作 remix目标id 可参考返回结果的pid值: s_xxxxxxxxx |
| duration | 否 | int | 10 | 视频长度：10秒，15秒；填写 10，15 |
| notify | 是 | string | https://xx.com/xxx | 回调地址 （ 任务推送地址） |

## 返回参数说明：

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| code | int | 状态码 |
| msg | string | 状态信息 |
| data | array | 请求结果数据集 |
| - task_id | string | 任务ID |
| exec_time | float | 执行耗时 |
| user_ip | string | 客户端IP |

回调参数说明：

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| code | int | 200 |
| data | array |  |
| - task_id | string | 任务ID |
| - video_url | string | https://v.xiaobao.ink/video20251016/53128775-1853-4502-965a-f3492841cbf4.mp4 |
| - pid | string | s_xxxxxxxxxxxxxxx |
| msg | string | success |
| fail_reason | string | 失败原因 |

## Response Example

```json
{
    "status": 0,
    "data": {
        "task_id": "string"
    },
    "msg": "string"
}
```

## Error Codes

| Status / code | Description |
|---------------|-------------|
| 200 / success | Request successful |
| 400 | Invalid request parameters |
| 401 | Authentication failed, please check API Key |
| 402 | Insufficient account balance / points |
| 429 | Request rate limit exceeded |
| 500 | Internal server error |

## Usage Flow

1. Obtain your API Key from the console
2. Call the endpoint with `key` and required parameters
3. Parse the JSON (or binary) response according to the examples above

---

_Generated for AI / LLM consumption. Source of truth: `api_list` (same as HTML `/doc/{id}`)._
