Templates
模板定义创建沙箱时使用的运行环境。可以直接使用 base 等官方模板引用,也可以通过 CLI 或 HTTP API 从 Dockerfile、镜像或已有模板构建自定义模板。
GET /api/v1/templatesQuery:
| Query | 说明 |
|---|---|
visibility | 可选可见性过滤。 |
limit | 最大返回数量。 |
offset | offset 分页。 |
export SEACLOUD_API_BASE_URL="https://sandbox-service.real-cloud.seaart.ai/api/v1/sandbox"
curl -sS "$SEACLOUD_API_BASE_URL/templates?limit=20" \ -H "X-API-Key: $SEACLOUD_API_KEY"创建沙箱时可以使用返回的别名、标签或 templateID。
GET /api/v1/templates/resolve/:ref用于把官方别名、名称和标签解析为稳定的 templateID,方便生产工作流固定模板。
查询或删除模板
Section titled “查询或删除模板”| Method | Path | 说明 |
|---|---|---|
GET | /api/v1/templates/:templateID | 查询模板详情和可选构建历史。 |
DELETE | /api/v1/templates/:templateID | 删除模板。 |
GET /templates/:templateID 支持使用 limit 和 nextToken 分页查询构建历史。
公开集成优先使用 CLI;后端集成可以直接调用同一组 HTTP API:
seacloud template build my-template --dockerfile Dockerfile --cpu-count 2 --memory-mb 2048 --tag v1seacloud template status <template_id> <build_id>seacloud template logs <template_id> <build_id> --limit 100查询模板详情,例如运行时模式、资源规格、工作目录、存储策略、启动行为和就绪检查。
底层构建接口:
| Method | Path | 说明 |
|---|---|---|
POST | /api/v1/templates | 创建模板元数据。 |
POST | /api/v1/templates/:templateID/builds/:buildID | 启动构建。 |
GET | /api/v1/templates/:templateID/builds | 列出构建历史。 |
GET | /api/v1/templates/:templateID/builds/:buildID/status | 轮询状态和可选日志。 |
GET | /api/v1/templates/:templateID/builds/:buildID/logs | 读取构建日志。 |
POST | /api/v1/templates/:templateID/rollback | 回滚到 ready 构建。 |
| Method | Path | 说明 |
|---|---|---|
POST | /api/v1/templates/tags | 为模板构建目标分配标签。 |
GET | /api/v1/templates/:templateID/tags | 列出模板标签。 |
DELETE | /api/v1/templates/tags | 移除标签。 |