认证
后台页面使用用户名密码登录。外部 API 继续使用 Bearer token。
Authorization: Bearer <KIE_API_TOKEN 或 UNIFIED_API_TOKEN>
后台入口:/admin/login
异步任务
| Method | Path | 说明 |
| POST | /api/v1/jobs/createTask | 创建图片生成任务。 |
| GET | /api/v1/jobs/recordInfo?taskId= | 查询任务结果。 |
| GET | /api/v1/jobs/result/<taskId>/<filename> | 读取本地结果图片。 |
createTask 示例
curl -X POST https://gen.bunjs.dev/api/v1/jobs/createTask \
-H 'Authorization: Bearer <TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"engine": "web",
"model": "gpt-image-2-text-to-image",
"input": {
"prompt": "a green apple on a white table",
"aspect_ratio": "1:1",
"resolution": "auto"
}
}'
后台接口
| Method | Path | 说明 |
| GET | /health | 健康检查。 |
| GET | /admin-data/overview | 任务和账号总览。 |
| GET | /admin-data/tasks | 后台任务列表。 |
| GET | /admin-data/prompts | 示例 prompt 列表。 |
| POST | /admin-data/playground-sync | 后台同步测试。 |
账号管理
| Method | Path | 说明 |
| GET | /accounts | 账号列表,不回显敏感 secret。 |
| POST | /accounts | 新增账号。 |
| PATCH | /accounts/{account_id} | 更新账号状态或 secret。 |
| POST | /accounts/{account_id}/check | 检查账号健康状态。 |
图片存储
容器内:/app/output/unified_tasks/<task_id>/
宿主机:/opt/chatgpt_image_gen/output/unified_tasks/<task_id>/
访问:/api/v1/jobs/result/<task_id>/<filename>