消费流水查询
curl --request GET \
--url https://www.chenyu.cn/api/open/v2/bill/list \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.chenyu.cn/api/open/v2/bill/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/bill/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/bill/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/bill/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/bill/list")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chenyu.cn/api/open/v2/bill/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": {
"order_list": [
{
"amount": 123,
"charge_channel": 123,
"order_number": "<string>",
"order_time": 123,
"settle_start_time": 123,
"settle_end_time": 123,
"remark": "<string>"
}
],
"total": 123
}
}财务接口
消费流水查询
查询账户消费流水记录
GET
/
api
/
open
/
v2
/
bill
/
list
消费流水查询
curl --request GET \
--url https://www.chenyu.cn/api/open/v2/bill/list \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.chenyu.cn/api/open/v2/bill/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/bill/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/bill/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/bill/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/bill/list")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chenyu.cn/api/open/v2/bill/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": {
"order_list": [
{
"amount": 123,
"charge_channel": 123,
"order_number": "<string>",
"order_time": 123,
"settle_start_time": 123,
"settle_end_time": 123,
"remark": "<string>"
}
],
"total": 123
}
}消费流水查询
查询账户的消费流水记录,包括实例使用费用、其他服务费用等。请求参数
string
页码,从1开始
string
每页数量
integer
扣费类型
1: 余额消费2: 算力卡消费
string
订单编号
响应参数
integer
响应码
string
响应信息
object
代码示例
import requests
url = "https://www.chenyu.cn/api/open/v2/bill/list"
headers = {
"Authorization": "Bearer your_api_key"
}
params = {
"page": "1",
"page_size": "10",
"charge_channel": 1, # 可选,1.余额消费 2.算力卡消费
"order_number": "ORD123456789" # 可选,按订单编号筛选
}
response = requests.get(url, headers=headers, params=params)
result = response.json()
if result['code'] == 0:
bill_data = result['data']
print(f"总记录数: {bill_data['total']}")
for record in bill_data['order_list']:
print(f"消费金额: {record['amount']}")
print(f"扣费渠道: {record['charge_channel']}")
print(f"订单编号: {record['order_number']}")
print(f"订单时间: {record['order_time']}")
print(f"备注: {record['remark']}")
print("---")
else:
print(f"查询失败: {result['msg']}")
const axios = require('axios');
const url = 'https://www.chenyu.cn/api/open/v2/bill/list';
const headers = {
'Authorization': 'Bearer your_api_key'
};
const params = {
page: "1",
page_size: "10",
charge_channel: 1, // 可选,1.余额消费 2.算力卡消费
order_number: "ORD123456789" // 可选,按订单编号筛选
};
axios.get(url, { headers, params })
.then(response => {
const result = response.data;
if (result.code === 0) {
const billData = result.data;
console.log(`总记录数: ${billData.total}`);
billData.order_list.forEach(record => {
console.log(`消费金额: ${record.amount}`);
console.log(`扣费渠道: ${record.charge_channel}`);
console.log(`订单编号: ${record.order_number}`);
console.log(`订单时间: ${record.order_time}`);
console.log(`备注: ${record.remark}`);
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/bill/list?page=1&page_size=10&charge_channel=1&order_number=ORD123456789" \
-H "Authorization: Bearer your_api_key"
响应示例
{
"code": 0,
"msg": "查询成功",
"data": {
"order_list": [
{
"amount": 25.50,
"charge_channel": 1,
"order_number": "ORD20240115143025001",
"order_time": 1705308625,
"settle_start_time": 1705308000,
"settle_end_time": 1705308625,
"remark": "GPU实例使用费用"
},
{
"amount": 10.00,
"charge_channel": 2,
"order_number": "ORD20240115120000002",
"order_time": 1705299600,
"settle_start_time": 1705299000,
"settle_end_time": 1705299600,
"remark": "存储费用"
}
],
"total": 156
}
}
{
"code": -1,
"msg": "查询失败"
}
⌘I