GPU服务API文档
实例镜像
获取社区镜像列表

DescribeCommunityImages — 获取社区镜像列表

接口说明

获取算力共享平台的社区镜像列表,支持按名称、作者、标签等条件筛选,支持排序和分页。


请求参数

名称类型必填描述示例值
ActionString接口名称DescribeCommunityImages
RegionString地域cn-wlcb
CompShareImageIdString按镜像 ID 精确查询compshareImage-xxxx
GroupIdString按版本组 ID 筛选group-xxxx
NameString按镜像名称模糊搜索Stable Diffusion
AuthorString按作者精确匹配UCloud
FuzzySearchString按镜像名称或作者模糊搜索PyTorch
TagArray of String按标签筛选(多个标签取交集)["深度学习"]
IsFreeBoolean是否只查询免费镜像true
IsOfficialBoolean是否只查询官方镜像false
IfAutoStartBoolean是否只查询支持自启动的镜像false
SortConditionObject排序条件。Field 可选:Favor(收藏数)、PubTime(发布时间)、ImageUseTime(使用次数)、FavoritesCount(收藏数);ASC 为是否升序{"Field":"PubTime","ASC":false}
OffsetInteger偏移量,默认 00
LimitInteger每页数量,默认 2020

响应参数

名称类型描述示例值
ActionString响应名称DescribeCommunityImagesResponse
RetCodeInteger返回码,0 为成功0
TotalCountInteger满足条件的镜像总数100
AvailableTotalCountInteger已发布的镜像总数95
CompshareImageGroupArray of CompshareImageGroup镜像分组列表

CompshareImageGroup 结构

社区镜像按版本组分组,每个组包含一个或多个版本。

名称类型描述
GroupIdString版本组 ID
ImageNameString镜像名称
ImageDescString镜像描述
CreatedCountInteger引用创建次数
FavoritesCountInteger收藏数
RecommendCountInteger推荐数
ImageUseTimeInteger镜像使用时长
IsFavoriteBoolean当前用户是否已收藏
StatusString组状态。Available:可用(至少有一个已上线版本);UnAvailable:不可用
DataArray of CompShareImage该组下的版本列表

CompShareImage 结构

每个版本的详细信息。

名称类型描述
CompShareImageIdString镜像 ID
NameString版本名称
AuthorString作者昵称
AuthInfoInteger作者认证信息。0:普通创作者,1:官方账号,2:认证作者
StatusString版本状态。Available:已上线,Offline:已下线,Reviewing:审核中
PriceFloat价格(元/小时),0 为免费
VersionNameString版本号
VersionDescString版本描述
DescriptionString镜像描述
TagsArray of String标签列表
SupportedGpuTypesArray of String支持的 GPU 类型
CoverString封面图 URL
ContainerString"True":容器镜像,"False":虚机镜像
AutoStartBoolean是否支持自启动
CreateTimeInteger创建时间(Unix 时间戳)
UpdateTimeInteger更新时间(Unix 时间戳)
PubTimeInteger发布时间(Unix 时间戳)
SizeInteger镜像大小(MB)
ReadmeString使用说明(富文本)
QrCodeUrlString作者二维码 URL
SoftwarePortsArray of Object软件端口列表,含 Software(名称)和 Port(端口号)

请求示例

Python(使用 UCloud SDK)

from ucloud.core import exc
from ucloud.client import Client
 
 
def main():
    client = Client({
        "region": "cn-wlcb",
        "public_key": "my_public_key",    # 替换为你的公钥,从 https://console.compshare.cn/uaccount/api_manage 获取
        "private_key": "my_private_key",   # 替换为你的私钥
        "base_url": "https://api.compshare.cn",
    })
 
    try:
        resp = client.ucompshare().describe_community_images({
            "Tag": ["深度学习"],
            "SortCondition": {"Field": "PubTime", "ASC": False},
            "Limit": 20,
        })
        print(f"总数: {resp.get('TotalCount')}")
    except exc.UCloudException as e:
        print(e)
 
 
if __name__ == "__main__":
    main()

Go(使用 UCloud SDK)

package main
 
import (
	"fmt"
 
	"github.com/ucloud/ucloud-sdk-go/services/ucompshare"
	"github.com/ucloud/ucloud-sdk-go/ucloud"
	"github.com/ucloud/ucloud-sdk-go/ucloud/auth"
)
 
func main() {
	cfg := ucloud.NewConfig()
	cfg.Region = "cn-wlcb"
	cfg.BaseUrl = "https://api.compshare.cn"
 
	credential := auth.NewCredential()
	credential.PublicKey = "my_public_key"   // 替换为你的公钥,从 https://console.compshare.cn/uaccount/api_manage 获取
	credential.PrivateKey = "my_private_key" // 替换为你的私钥
	client := ucompshare.NewClient(&cfg, &credential)
 
	req := client.NewDescribeCommunityImagesRequest()
	req.Limit = ucloud.Int(20)
 
	resp, err := client.DescribeCommunityImages(req)
	if err != nil {
		fmt.Printf("查询失败: %s\n", err)
		return
	}
	fmt.Printf("总数: %d\n", resp.TotalCount)
}

响应示例

{
  "Action": "DescribeCommunityImagesResponse",
  "RetCode": 0,
  "TotalCount": 50,
  "AvailableTotalCount": 48,
  "CompshareImageGroup": []
}
Copyright © 2026 沪ICP备12020087号-61