# 知格科技 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` 查询图片生成状态和结果。

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

### 状态码说明

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

### 完成状态返回示例

```json
{
  "created": 1783476000,
  "task_id": "42",
  "status": "completed",
  "data": [
    {
      "url": "http://host/view?filename=00001_.png"
    }
  ],
  "completed_at": 1783476090
}
```

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