查询算力市场镜像
curl --request GET \
--url https://www.chenyu.cn/api/open/v2/image/market/list \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.chenyu.cn/api/open/v2/image/market/list"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.chenyu.cn/api/open/v2/image/market/list', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.chenyu.cn/api/open/v2/image/market/list",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://www.chenyu.cn/api/open/v2/image/market/list"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://www.chenyu.cn/api/open/v2/image/market/list")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chenyu.cn/api/open/v2/image/market/list")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": 123,
"msg": "<string>",
"data": {
"image_list": [
{
"uuid": "<string>",
"components": {
"CUDA": "<string>",
"PaddlePaddle": "<string>",
"PyTorch": "<string>",
"Python": "<string>",
"TensorFlow": "<string>",
"Ubuntu": "<string>"
},
"size": 123,
"created_at": 123,
"updated_at": 123
}
],
"total": 123,
"page": 123,
"page_size": 123
}
}镜像管理
查询算力市场镜像
查询算力市场中可用的镜像列表
GET
/
api
/
open
/
v2
/
image
/
market
/
list
查询算力市场镜像
curl --request GET \
--url https://www.chenyu.cn/api/open/v2/image/market/list \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.chenyu.cn/api/open/v2/image/market/list"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.chenyu.cn/api/open/v2/image/market/list', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.chenyu.cn/api/open/v2/image/market/list",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://www.chenyu.cn/api/open/v2/image/market/list"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://www.chenyu.cn/api/open/v2/image/market/list")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chenyu.cn/api/open/v2/image/market/list")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": 123,
"msg": "<string>",
"data": {
"image_list": [
{
"uuid": "<string>",
"components": {
"CUDA": "<string>",
"PaddlePaddle": "<string>",
"PyTorch": "<string>",
"Python": "<string>",
"TensorFlow": "<string>",
"Ubuntu": "<string>"
},
"size": 123,
"created_at": 123,
"updated_at": 123
}
],
"total": 123,
"page": 123,
"page_size": 123
}
}查询算力市场镜像
获取算力市场中所有可用的镜像列表。无需认证: 此接口为公开接口,无需提供API Key即可访问。
请求参数
integer
页码,从1开始
integer
每页数量
string
CUDA版本,如:11.8.0等
string
Python版本,如:3.8、3.9、3.10等
响应参数
integer
响应码
string
响应信息
object
代码示例
import requests
url = "https://www.chenyu.cn/api/open/v2/image/market/list"
headers = {
"Authorization": "Bearer your_api_key",
"Content-Type": "application/json"
}
params = {
"page": 1,
"page_size": 20,
"cuda_version": "11.8",
"python_version": "3.9"
}
response = requests.get(url, headers=headers, params=params)
result = response.json()
print("算力市场镜像列表:")
print(f"总数: {result['data']['total']}, 当前页: {result['data']['page']}")
for image in result['data']['image_list']:
print(f"UUID: {image['uuid']}")
print(f"CUDA版本: {image['components']['CUDA']}")
print(f"Python版本: {image['components']['Python']}")
print(f"PyTorch版本: {image['components']['PyTorch']}")
print(f"TensorFlow版本: {image['components']['TensorFlow']}")
print(f"镜像大小: {image['size']} 字节")
print("---")
const axios = require('axios');
const url = 'https://www.chenyu.cn/api/open/v2/image/market/list';
const headers = {
'Authorization': 'Bearer your_api_key',
'Content-Type': 'application/json'
};
const params = {
page: 1,
page_size: 20,
cuda_version: '11.8',
python_version: '3.9'
};
axios.get(url, { headers, params })
.then(response => {
const data = response.data.data;
console.log('算力市场镜像列表:');
console.log(`总数: ${data.total}, 当前页: ${data.page}`);
data.image_list.forEach(image => {
console.log(`UUID: ${image.uuid}`);
console.log(`CUDA版本: ${image.components.CUDA}`);
console.log(`Python版本: ${image.components.Python}`);
console.log(`PyTorch版本: ${image.components.PyTorch}`);
console.log(`TensorFlow版本: ${image.components.TensorFlow}`);
console.log(`镜像大小: ${image.size} 字节`);
console.log('---');
});
})
.catch(error => {
console.error('Error:', error.response.data);
});
curl -X GET "https://www.chenyu.cn/api/open/v2/image/market/list?page=1&page_size=20&cuda_version=11.8&python_version=3.9" \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json"
响应示例
{
"code": 0,
"msg": "查询成功",
"data": {
"image_list": [
{
"uuid": "ceb70da2df074c9e99905b6a4f4db032",
"components": {
"CUDA": "11.8.0",
"PaddlePaddle": "2.5.2",
"PyTorch": "2.1.2",
"Python": "3.10",
"TensorFlow": "2.16.2",
"Ubuntu": "22.04"
},
"size": 19372840210,
"created_at": 1743213028,
"updated_at": 1743215603
}
],
"total": 84,
"page": 1,
"page_size": 1
}
}
⌘I