获取平台GPU列表
curl --request GET \
--url https://www.chenyu.cn/api/open/v2/gpu/list \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.chenyu.cn/api/open/v2/gpu/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/gpu/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/gpu/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/gpu/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/gpu/list")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chenyu.cn/api/open/v2/gpu/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": {
"gpu_list": [
{
"gpu_name": "<string>",
"gpu_uuid": "<string>",
"status": 123,
"price": {
"hour": 123,
"day": 123,
"week": 123,
"month": 123,
"year": 123
}
}
],
"total": 123
}
}GPU管理
获取平台GPU列表
获取平台可用的GPU型号列表及价格信息
GET
/
api
/
open
/
v2
/
gpu
/
list
获取平台GPU列表
curl --request GET \
--url https://www.chenyu.cn/api/open/v2/gpu/list \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.chenyu.cn/api/open/v2/gpu/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/gpu/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/gpu/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/gpu/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/gpu/list")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chenyu.cn/api/open/v2/gpu/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": {
"gpu_list": [
{
"gpu_name": "<string>",
"gpu_uuid": "<string>",
"status": 123,
"price": {
"hour": 123,
"day": 123,
"week": 123,
"month": 123,
"year": 123
}
}
],
"total": 123
}
}获取平台GPU列表
获取平台所有可用的GPU型号列表,包括GPU名称、规格和详细的价格信息。请求参数
无需请求参数。响应参数
integer
响应码
string
响应信息
object
代码示例
import requests
url = "https://www.chenyu.cn/api/open/v2/gpu/list"
headers = {
"Authorization": "Bearer your_api_key"
}
response = requests.get(url, headers=headers)
result = response.json()
if result['code'] == 0:
gpu_data = result['data']
print(f"总GPU型号数: {gpu_data['total']}")
for gpu in gpu_data['gpu_list']:
print(f"GPU名称: {gpu['gpu_name']}")
print(f"GPU UUID: {gpu['gpu_uuid']}")
print(f"状态: {gpu['status']}")
print(f"小时价格: {gpu['price']['hour']}")
if 'day' in gpu['price']:
print(f"天价格: {gpu['price']['day']}")
if 'month' in gpu['price']:
print(f"月价格: {gpu['price']['month']}")
print("---")
else:
print(f"查询失败: {result['msg']}")
const axios = require('axios');
const url = 'https://www.chenyu.cn/api/open/v2/gpu/list';
const headers = {
'Authorization': 'Bearer your_api_key'
};
axios.get(url, { headers })
.then(response => {
const result = response.data;
if (result.code === 0) {
const gpuData = result.data;
console.log(`总GPU型号数: ${gpuData.total}`);
gpuData.gpu_list.forEach(gpu => {
console.log(`GPU名称: ${gpu.gpu_name}`);
console.log(`GPU UUID: ${gpu.gpu_uuid}`);
console.log(`状态: ${gpu.status}`);
console.log(`小时价格: ${gpu.price.hour}`);
if (gpu.price.day) {
console.log(`天价格: ${gpu.price.day}`);
}
if (gpu.price.month) {
console.log(`月价格: ${gpu.price.month}`);
}
console.log('---');
});
} else {
console.log(`查询失败: ${result.msg}`);
}
})
.catch(error => {
console.error('Error:', error.response.data);
});
curl -X GET "https://www.chenyu.cn/api/open/v2/gpu/list" \
-H "Authorization: Bearer your_api_key"
响应示例
{
"code": 0,
"msg": "查询成功",
"data": {
"gpu_list": [
{
"gpu_name": "NVIDIA RTX 4090",
"gpu_uuid": "gpu_12345678-1234-1234-1234-123456789012",
"status": 1,
"price": {
"hour": 5.50,
"day": 120.00,
"week": 800.00,
"month": 3200.00,
"year": 35000.00
}
},
{
"gpu_name": "NVIDIA RTX 3080",
"gpu_uuid": "gpu_87654321-4321-4321-4321-210987654321",
"status": 1,
"price": {
"hour": 3.20,
"day": 70.00,
"week": 450.00,
"month": 1800.00,
"year": 20000.00
}
}
],
"total": 2
}
}
{
"code": -1,
"msg": "查询失败"
}
⌘I