算力卡查询
curl --request GET \
--url https://www.chenyu.cn/api/open/v2/card/list \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.chenyu.cn/api/open/v2/card/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/card/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/card/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/card/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/card/list")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chenyu.cn/api/open/v2/card/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": {
"card_list": [
{
"leave_amount": 123,
"face_amount": 123,
"sale_price": 123,
"bind_time": 123,
"expire_date": 123,
"bind_txt": "<string>",
"card_no": "<string>",
"pods": [
{
"uuid": "<string>",
"title": "<string>"
}
],
"status_txt": "<string>",
"title": "<string>",
"uuid": "<string>",
"valid_days": 123
}
],
"total": 123
}
}财务接口
算力卡查询
查询用户的算力卡信息
GET
/
api
/
open
/
v2
/
card
/
list
算力卡查询
curl --request GET \
--url https://www.chenyu.cn/api/open/v2/card/list \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.chenyu.cn/api/open/v2/card/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/card/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/card/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/card/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/card/list")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chenyu.cn/api/open/v2/card/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": {
"card_list": [
{
"leave_amount": 123,
"face_amount": 123,
"sale_price": 123,
"bind_time": 123,
"expire_date": 123,
"bind_txt": "<string>",
"card_no": "<string>",
"pods": [
{
"uuid": "<string>",
"title": "<string>"
}
],
"status_txt": "<string>",
"title": "<string>",
"uuid": "<string>",
"valid_days": 123
}
],
"total": 123
}
}算力卡查询
查询当前用户的算力卡信息,包括卡类型、余额、到期时间等。请求参数
integer
页码,从1开始
integer
每页数量
响应参数
integer
响应码
string
响应信息
object
代码示例
import requests
url = "https://www.chenyu.cn/api/open/v2/card/list"
headers = {
"Authorization": "Bearer your_api_key"
}
params = {
"page": 1,
"page_size": 10
}
response = requests.get(url, headers=headers, params=params)
result = response.json()
if result['code'] == 0:
card_data = result['data']
print(f"总记录数: {card_data['total']}")
for card in card_data['card_list']:
print(f"算力卡名称: {card['title']}")
print(f"卡号: {card['card_no']}")
print(f"余额: {card['leave_amount']}")
print(f"面值: {card['face_amount']}")
print(f"状态: {card['status_txt']}")
print(f"过期时间: {card['expire_date']}")
print("---")
else:
print(f"查询失败: {result['msg']}")
const axios = require('axios');
const url = 'https://www.chenyu.cn/api/open/v2/card/list';
const headers = {
'Authorization': 'Bearer your_api_key'
};
const params = {
page: 1,
page_size: 10
};
axios.get(url, { headers, params })
.then(response => {
const result = response.data;
if (result.code === 0) {
const cardData = result.data;
console.log(`总记录数: ${cardData.total}`);
cardData.card_list.forEach(card => {
console.log(`算力卡名称: ${card.title}`);
console.log(`卡号: ${card.card_no}`);
console.log(`余额: ${card.leave_amount}`);
console.log(`面值: ${card.face_amount}`);
console.log(`状态: ${card.status_txt}`);
console.log(`过期时间: ${card.expire_date}`);
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/card/list?page=1&page_size=10" \
-H "Authorization: Bearer your_api_key"
响应示例
{
"code": 0,
"msg": "查询成功",
"data": {
"card_list": [
{
"leave_amount": 100.5,
"face_amount": 200.0,
"sale_price": 180.0,
"bind_time": 1705294225,
"expire_date": 1735689599,
"bind_txt": "已绑定",
"card_no": "CARD20240115001",
"pods": [
{
"uuid": "pod_12345678-1234-1234-1234-123456789012",
"title": "PyTorch环境"
}
],
"status_txt": "正常",
"title": "GPU算力卡",
"uuid": "card_12345678-1234-1234-1234-123456789012",
"valid_days": 365
}
],
"total": 1
}
}
{
"code": -1,
"msg": "查询失败"
}
⌘I