跳转到内容
返回主页

Templates

模板定义创建沙箱时使用的运行环境。可以直接使用 base 等官方模板引用,也可以通过 CLI 或 HTTP API 从 Dockerfile、镜像或已有模板构建自定义模板。

GET /api/v1/templates

Query:

Query说明
visibility可选可见性过滤。
limit最大返回数量。
offsetoffset 分页。
Terminal window
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,方便生产工作流固定模板。

MethodPath说明
GET/api/v1/templates/:templateID查询模板详情和可选构建历史。
DELETE/api/v1/templates/:templateID删除模板。

GET /templates/:templateID 支持使用 limitnextToken 分页查询构建历史。

公开集成优先使用 CLI;后端集成可以直接调用同一组 HTTP API:

Terminal window
seacloud template build my-template --dockerfile Dockerfile --cpu-count 2 --memory-mb 2048 --tag v1
seacloud template status <template_id> <build_id>
seacloud template logs <template_id> <build_id> --limit 100

查询模板详情,例如运行时模式、资源规格、工作目录、存储策略、启动行为和就绪检查。

底层构建接口:

MethodPath说明
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 构建。
MethodPath说明
POST/api/v1/templates/tags为模板构建目标分配标签。
GET/api/v1/templates/:templateID/tags列出模板标签。
DELETE/api/v1/templates/tags移除标签。