# 知格科技 API 文档

通过统一的 API 接入对话、图片与视频生成，可用于应用开发及智能体工具对接。

- 文档地址：[API 文档](https://zhigekeji.com/docs)
- Base URL：`https://zhigekeji.com/api/v1`
- 认证方式：`Authorization: Bearer <API_KEY>`
- JSON 请求使用 `Content-Type: application/json`
- 在[控制台创建 API Key](https://zhigekeji.com/console/api-keys)，示例中的密钥和素材地址均需自行替换。

## 视频状态查询

通过异步接口返回的 `task_id` 轮询视频生成状态和结果。建议轮询间隔 5-10 秒。

```http
GET https://zhigekeji.com/api/v1/videos/generations/status?task_id=6601
Authorization: Bearer sk-xxxx...
```

### 状态码说明

| status | 说明 |
| --- | --- |
| `pending` | 任务排队中 |
| `processing` | 正在生成 |
| `completed` | 生成完成 |
| `failed` | 生成失败 |
| `cancelled` | 任务已取消 |

### 完成状态返回示例

```json
{
  "created": 1786586400,
  "task_id": "6601",
  "status": "completed",
  "data": [
    {
      "url": "https://host/view?filename=video_6601.mp4"
    }
  ],
  "completed_at": 1786586730
}
```

失败或取消时仅向调用方返回通用错误信息，具体执行错误保留在管理端任务详情中。
