# AI视频切片 API Documentation

> 智能识别精准切片，自动生成高光短视频 ；按上传视频长度每分钟0.2元；

## Overview

This document describes how to call the **AI视频切片** API.

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

## 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/clip`
- **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 |
|-----------|----------|-------------|
| `url` | Yes | 视频url |
| `scene_id` | Yes | 场景Id |
| `slice_method` | Yes | 切片方式 |
| `slice_length` | 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/clip?key=你的密钥
```

## Details

## 请求HEADER：

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

## 请求参数说明：

| 名称 | 必填 | 类型 | 示例值 | 说明 |
| --- | --- | --- | --- | --- |
| url | 是 | string | https://xxx.mp4 | 预处理视频的URL，必须为可解析的HTTP协议URL；如果URL的path没有文件扩展名，需要额外指定extension参数，比如extension=mp3；最长512个字符串；下载超时5分钟（如果5分钟未下载完成则失败）；视频文件必须带音频信息，文件时长5h，大小4G |
| scene_id | 是 | string | 0 | 场景Id 切片场景，指定视频类型。 0-通用场景(默认) 1-直播内容 2-体育赛事 3-访谈演讲 4-影视综艺 |
| slice_method | 是 | int | 0 | 切片方式，返回的切片效果。 0-连续片段：完整截取视频中的连续段落(默认) 1-智能拼接：自动合并多个片段拼接成完整主题切片 |
| slice_length | 是 | int | 30～60 | 切片长度，指定生成的每个切片的大致长度(默认:30~180） 30～60 60~90 90~120 120~180 180~300 300 |

## Response Example

```json
{
    "code": 200,
    "msg": "任务创建成功",
    "data": {
        "id": 1,
        "task_id": "93e356ce-4b27-428c-ae6c-fe6815f23570"
    },
    "exec_time": 0.418544,
    "ip": "112.49.185.124"
}
```

## Error Codes

| HTTP 响应状态码 | 说明 |
| --- | --- |
| 200 | 请求成功 |
| 400 | 客户端参数传递错误，请检查参数是否缺失或值是否正确 |
| 401 | 认证失败。 请检查X-API-KEY是否正确或者服务是否开通 |
| 404 | 请求的URL或资源不存在。 请检查URL 或 URL中的 task id 是否正确 |
| 413 | 上传的文件超出大小限制。请检查文件大小，参见各个服务的最大文件限制 |
| 429 | 请求频率超出QPS限制。请放缓请求速率，或者联系商务提升QPS限制 |
| 500 | 服务端异常。请反馈给商务或技术对接人员 |

## 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}`)._
