获取平台GPU列表
获取平台所有可用的GPU型号列表,包括GPU名称、规格和详细的价格信息。请求参数
无需请求参数。响应参数
响应码
响应信息
代码示例
Copy
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']}")
响应示例
Copy
{
"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
}
}