curl --request GET \
--url https://www.chenyu.cn/api/open/v2/gpu/list \
--header 'Authorization: Bearer <token>'{
"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型号列表及价格信息
curl --request GET \
--url https://www.chenyu.cn/api/open/v2/gpu/list \
--header 'Authorization: Bearer <token>'{
"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
}
}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']}")
{
"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
}
}