查询应用市场Pod
curl --request GET \
--url https://www.chenyu.cn/api/open/v2/pod/list \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.chenyu.cn/api/open/v2/pod/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/pod/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/pod/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/pod/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/pod/list")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chenyu.cn/api/open/v2/pod/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": {
"pod_list": [
{
"title": "<string>",
"uuid": "<string>",
"remark": "<string>",
"pod_tag": [
{}
],
"price": {
"hour": 123,
"day": 123,
"week": 123,
"month": 123,
"year": 123
}
}
],
"total": 123
}
}Pod管理
查询应用市场Pod
查询应用市场中可用的Pod列表
GET
/
api
/
open
/
v2
/
pod
/
list
查询应用市场Pod
curl --request GET \
--url https://www.chenyu.cn/api/open/v2/pod/list \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.chenyu.cn/api/open/v2/pod/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/pod/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/pod/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/pod/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/pod/list")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chenyu.cn/api/open/v2/pod/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": {
"pod_list": [
{
"title": "<string>",
"uuid": "<string>",
"remark": "<string>",
"pod_tag": [
{}
],
"price": {
"hour": 123,
"day": 123,
"week": 123,
"month": 123,
"year": 123
}
}
],
"total": 123
}
}查询应用市场Pod
获取应用市场中所有可用的Pod列表,支持分页查询和按名称筛选。无需认证: 此接口为公开接口,无需提供API Key即可访问。
请求参数
integer
页码,从1开始
integer
每页数量
string
Pod名称,支持模糊搜索
响应参数
integer
响应状态码
string
响应消息
object
代码示例
import requests
url = "https://www.chenyu.cn/api/open/v2/pod/list"
headers = {
"Content-Type": "application/json"
}
params = {
"page": 1,
"page_size": 10,
"name": "pytorch"
}
response = requests.get(url, headers=headers, params=params)
result = response.json()
print(f"总共找到 {result['data']['total']} 个Pod")
for pod in result['data']['pod_list']:
print(f"Pod名称: {pod['title']}")
print(f"描述: {pod['remark']}")
print(f"按小时价格: {pod['price']['hour']} 元")
print("---")
const axios = require('axios');
const url = 'https://www.chenyu.cn/api/open/v2/pod/list';
const headers = {
'Content-Type': 'application/json'
};
const params = {
page: 1,
page_size: 10,
name: 'pytorch'
};
axios.get(url, { headers, params })
.then(response => {
const data = response.data.data;
console.log(`总共找到 ${data.total} 个Pod`);
data.pod_list.forEach(pod => {
console.log(`Pod名称: ${pod.title}`);
console.log(`描述: ${pod.remark}`);
console.log(`按小时价格: ${pod.price.hour} 元`);
console.log('---');
});
})
.catch(error => {
console.error('Error:', error.response.data);
});
curl -X GET "https://www.chenyu.cn/api/open/v2/pod/list?page=1&page_size=10&name=pytorch" \
-H "Content-Type: application/json"
响应示例
{
"code": 0,
"msg": "success",
"data": {
"pod_list": [
{
"title": "PyTorch 深度学习环境",
"uuid": "pod_12345678-1234-1234-1234-123456789012",
"remark": "预装PyTorch 2.0,支持CUDA 11.8,适合深度学习训练",
"pod_tag": ["v1.0", "v1.1", "v2.0"],
"price": {
"hour": 2.5,
"day": 50.0,
"week": 300.0,
"month": 1200.0,
"year": 12000.0
}
}
],
"total": 1
}
}
⌘I