ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified

compshare-api

管理优云智算CompShare平台的GPU实例全生命周期,包括创建、查询、启动、停止、重启、重置密码和删除实例;当用户需要创建GPU云服务器、查询实例状态、管理实例启停、重置实例密码或删除实例时使用

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/chsengni/compshare-api
Or

CompShare API 技能

任务目标

  • 本技能用于:管理优云智算CompShare平台的GPU实例资源
  • 能力包含:创建GPU实例、查询实例列表、启动/停止/重启实例、重置密码、删除实例
  • 触发条件:用户需要创建或管理CompShare平台的GPU云服务器实例

前置准备

依赖安装

pip install ucloud-sdk-python3 PyYAML paramiko

配置文件

在使用前,需要配置文件

1.编辑配置文件,填入API凭证:

compshare:
  public_key: "your-public-key"
  private_key: "your-private-key"
  region: "cn-wlcb"
  zone: "cn-wlcb-01"
  base_url: "https://api.compshare.cn"
  1. 获取API凭证:

  2. 配置文件查找优先级:

    • 命令行参数 --config 指定的路径
    • 默认路径 assets/config.yaml(Skill目录下)

操作步骤

1. 创建GPU实例

调用 scripts/compshare_client.py 脚本,使用 create 命令:

python scripts/compshare_client.py create \
  --gpu-type 4090 \
  --gpu-count 1 \
  --cpu 16 \
  --memory 64 \
  --disk-size 200 \
  --image-id compshareImage-165jmhx19ik7 \
  --name "my-instance"

2. 查询实例列表

调用脚本使用 list 命令:

python scripts/compshare_client.py list
# 或查询特定实例
python scripts/compshare_client.py list --instance-ids "instance-id-1,instance-id-2"

3. 启动实例

正常开机(带GPU):

python scripts/compshare_client.py start --instance-id <UHostId>

无卡开机(不带GPU,节省费用):

python scripts/compshare_client.py start --instance-id <UHostId> --without-gpu

4. 停止实例

调用脚本使用 stop 命令:

python scripts/compshare_client.py stop --instance-id <UHostId>

5. 重启实例

调用脚本使用 reboot 命令:

python scripts/compshare_client.py reboot --instance-id <UHostId>

6. 重置实例密码

调用脚本使用 reset-password 命令:

python scripts/compshare_client.py reset-password --instance-id <UHostId> --password <new-password>

7. 删除实例

调用脚本使用 delete 命令:

python scripts/compshare_client.py delete --instance-id <UHostId>

8. SSH连接实例

通过实例的 SshLoginCommand 和 Password 连接实例:

  1. 先查询实例获取 SSH 登录信息:
python scripts/compshare_client.py list
# 返回结果中包含 SshLoginCommand 和 Password
  1. 使用 SSH 客户端连接:
python scripts/ssh_client.py connect \
  --ssh-command "ssh -p 12345 [email protected]" \
  --password "your-password"

9. SSH远程执行命令

python scripts/ssh_client.py exec \
  --ssh-command "ssh -p 12345 [email protected]" \
  --password "your-password" \
  --cmd "ls -la /home"

10. SSH文件操作

列出目录

python scripts/ssh_client.py ls \
  --ssh-command "ssh -p 12345 [email protected]" \
  --password "your-password" \
  --path "/home"

上传文件

python scripts/ssh_client.py upload \
  --ssh-command "ssh -p 12345 [email protected]" \
  --password "your-password" \
  --local ./local_file.txt \
  --remote /home/remote_file.txt

下载文件

python scripts/ssh_client.py download \
  --ssh-command "ssh -p 12345 [email protected]" \
  --password "your-password" \
  --remote /home/remote_file.txt \
  --local ./local_file.txt

Metadata

Author@chsengni
Stars3562
Views1
Updated2026-03-29
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-chsengni-compshare-api": {
      "enabled": true,
      "auto_update": true
    }
  }
}
Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.