模板
模板保存实例启动所依据的配置。这些字段在实际用起来是什么意思,见创建模板。
GET
/api/profile/templates
会话或 API 密钥
返回你的模板,以及你可以选的容器镜像。
{ "templates": [ { "id": 87, "title": "ROCm PyTorch dev", "slug": "rocm-pytorch-dev", "image": "rocm/pytorch:latest", "instance_type": "jupyter", "ssh_enabled": true, "enabled": false, "sort_order": 0 } ], "images": [ { "name": "ROCm PyTorch", "image": "rocm/pytorch:latest", "enabled": true } ]}
POST
/api/profile/templates
会话或 API 密钥
| 参数 | 类型 | 说明 | |
|---|---|---|---|
title | string | 必填 | 显示名称。 |
image | string | 必填 | 容器镜像,从目录里选。 |
instance_type | string | 选填 | jupyter、gradio、streamlit、comfyui、vllm、sglang、custom。 |
description | string | 选填 | 更长的描述。 |
slug | string | 选填 | 适合放进 URL 的标识符。 |
category | string | 选填 | 分组标签。 |
tags | array | 选填 | 自由填写的标签。 |
repo_url | string | 选填 | 启动时克隆的 Git 仓库。 |
branch | string | 选填 | 要检出的分支。默认 main。 |
notebook_path | string | 选填 | 启动时打开的 notebook。 |
start_command | string | 选填 | 启动时执行的命令。vllm 和 sglang 必填。 |
app_port | integer | 选填 | 应用服务的端口。必须是平台会路由的那几个:Gradio 7860、Streamlit 8501、ComfyUI 8188、vLLM 8000、SGLang 30000。 |
ssh_enabled | boolean | 选填 | 允许 SSH 进入由此模板启动的实例。默认 false。 |
cover_url | string | 选填 | 封面图 URL。 |
sort_order | integer | 选填 | 在你列表里的位置。 |
enabled | boolean | 选填 | 公开发布。需要编辑权限,否则强制为 false。 |
curl -X POST https://radeon-global.anruicloud.com/api/profile/templates \ -H "Authorization: Bearer $RADEON_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "title": "Qwen 7B on vLLM", "image": "rocm/vllm:latest", "instance_type": "vllm", "start_command": "vllm serve Qwen/Qwen2.5-7B-Instruct --host 0.0.0.0 --port 8000", "app_port": 8000 }'app_port 不在可路由的集合里会被 400 拒绝。
PUT
/api/profile/templates/{template_id}
会话或 API 密钥
请求体和创建时一样。模板不存在或者不是你的,返回 404。
改动对之后的启动生效。已经在跑的实例仍用它启动时的配置。
DELETE
/api/profile/templates/{template_id}
会话或 API 密钥
{ "success": true }删掉模板不影响已经从它启动的实例。
POST
/api/templates/{template_id}/launch
会话或 API 密钥
| 参数 | 类型 | 说明 | |
|---|---|---|---|
gpu_count | integer | 选填 | 1、2 或 4。默认 1。 |
launch_verification_token | string | 选填 | 仅在账户开启了启动验证时需要。 |
返回和 POST /api/notebook/request 一样的状态对象。之后轮询 GET /api/notebook/status。
启动有限流,大致是每分钟一次、每十分钟三次、每小时五次。超了返回 429,并带 Retry-After 头。
浏览公开模板
Section titled “浏览公开模板”
GET
/api/templates
无需凭据;带凭据能看到更多
返回已发布的模板。带认证的调用方还能看到自己的私有模板。想找个起点又不想先建东西时很好用。