跳转到内容

模板

模板保存实例启动所依据的配置。这些字段在实际用起来是什么意思,见创建模板

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 密钥
参数类型说明
titlestring必填显示名称。
imagestring必填容器镜像,从目录里选。
instance_typestring选填jupytergradiostreamlitcomfyuivllmsglangcustom
descriptionstring选填更长的描述。
slugstring选填适合放进 URL 的标识符。
categorystring选填分组标签。
tagsarray选填自由填写的标签。
repo_urlstring选填启动时克隆的 Git 仓库。
branchstring选填要检出的分支。默认 main
notebook_pathstring选填启动时打开的 notebook。
start_commandstring选填启动时执行的命令。vllmsglang 必填。
app_portinteger选填应用服务的端口。必须是平台会路由的那几个:Gradio 7860、Streamlit 8501、ComfyUI 8188、vLLM 8000、SGLang 30000
ssh_enabledboolean选填允许 SSH 进入由此模板启动的实例。默认 false
cover_urlstring选填封面图 URL。
sort_orderinteger选填在你列表里的位置。
enabledboolean选填公开发布。需要编辑权限,否则强制为 false
Terminal window
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_countinteger选填124。默认 1
launch_verification_tokenstring选填仅在账户开启了启动验证时需要。

返回和 POST /api/notebook/request 一样的状态对象。之后轮询 GET /api/notebook/status

启动有限流,大致是每分钟一次、每十分钟三次、每小时五次。超了返回 429,并带 Retry-After 头。

GET /api/templates 无需凭据;带凭据能看到更多

返回已发布的模板。带认证的调用方还能看到自己的私有模板。想找个起点又不想先建东西时很好用。