Skip to main content

Billing — Python SDK

Query monthly billing summaries and per-resource detail.

Overview​

The Billing resource exposes a tenant's monthly billing cycle data: total amount summary, paginated breakdowns by GPU spec and by AI service, and the full per-instance billing detail list. All queries are scoped by a YYYY-MM billing cycle.

Accessed via client.billing.

Available Operations​

MethodDescription
queryAllAmount()Query total billing amount for a billing cycle
queryBillByGpu()Query billing details by GPU spec
queryBillByService()Query billing details by AI service
queryBillList()Query billing detail list

queryAllAmount​

Query total billing amount for a given billing cycle.

Example Usage​

from wlt import WltClient

client = WltClient(api_key="your-api-key", base_url="https://console.example.com")

bill = client.billing.query_all_amount(billing_cycle="2026-04")
print(f"Total amount: {bill.data.pretaxAmountSum}")
print(f"Currency: {bill.data.currency}")

Parameters​

ParameterTypeRequiredDefaultDescription
billing_cyclestrYes--Billing cycle, format "YYYY-MM" (e.g. "2026-04")

Response​

Returns BaseResponse[UserBillingMonthResponse].

UserBillingMonthResponse fields:

FieldTypeDescription
afterDiscountAmountSumDecimalAmount after discount
deductedByCouponsSumDecimalCoupon deduction amount
pretaxGrossAmountSumDecimalOriginal amount (list price)
pretaxAmountSumDecimalPayable amount
currencystrCurrency code (e.g. "USD")

Errors​

CodeExceptionWhen
1001ValidationErrorInvalid request parameters
2000 / 2002AuthenticationErrorAPI Key invalid
2007PermissionErrorPermission denied
3001AuthenticationErrorToken expired and refresh failed

queryBillByGpu​

Query billing details by GPU spec with pagination.

Example Usage​

from wlt import WltClient

client = WltClient(api_key="your-api-key", base_url="https://console.example.com")

result = client.billing.query_bill_by_gpu(
billing_cycle="2026-04",
page_size=10,
page_num=1,
)
for item in result.data.list:
print(f"GPU: {item.gpuSpec}, Amount: {item.pretaxAmountSum}")

Parameters​

ParameterTypeRequiredDefaultDescription
billing_cyclestrYes--Billing cycle, format "YYYY-MM"
page_sizeintNo10Items per page
page_numintNo1Page number, starting from 1

Response​

Returns BaseResponse[PageInfo[UserBillingGpuServiceResponse]].

UserBillingGpuServiceResponse fields:

FieldTypeDescription
afterDiscountAmountSumDecimalAmount after discount
deductedByCouponsSumDecimalCoupon deduction amount
pretaxGrossAmountSumDecimalOriginal amount
pretaxAmountSumDecimalPayable amount
listPriceDecimalList price (unit price)
currencystrCurrency code
gpuSpecstrGPU spec (e.g. "A100-80G")
servicePeriodUnitstrService period unit (e.g. "Hour")
servicePeriodSumstrTotal service period
modelResourcestrModel resource identifier

Errors​

CodeExceptionWhen
1001ValidationErrorInvalid request parameters
2000 / 2002AuthenticationErrorAPI Key invalid
2007PermissionErrorPermission denied
3001AuthenticationErrorToken expired and refresh failed

queryBillByService​

Query billing details by AI service with pagination.

Example Usage​

from wlt import WltClient

client = WltClient(api_key="your-api-key", base_url="https://console.example.com")

result = client.billing.query_bill_by_service(
billing_cycle="2026-04",
page_size=10,
page_num=1,
)
for item in result.data.list:
print(f"Service: {item.bizType}, Amount: {item.pretaxAmountSum}")

Parameters​

ParameterTypeRequiredDefaultDescription
billing_cyclestrYes--Billing cycle, format "YYYY-MM"
page_sizeintNo10Items per page
page_numintNo1Page number, starting from 1

Response​

Returns BaseResponse[PageInfo[UserBillingAiServiceResponse]].

UserBillingAiServiceResponse fields:

FieldTypeDescription
afterDiscountAmountSumDecimalAmount after discount
deductedByCouponsSumDecimalCoupon deduction amount
pretaxGrossAmountSumDecimalOriginal amount
pretaxAmountSumDecimalPayable amount
currencystrCurrency code
gpuSpecstrGPU spec
modelResourcestrModel resource identifier
servicePeriodUnitstrService period unit
servicePeriodSumstrTotal service period
bizTypestrBusiness type (e.g. "Deploy", "Finetune")

Errors​

CodeExceptionWhen
1001ValidationErrorInvalid request parameters
2000 / 2002AuthenticationErrorAPI Key invalid
2007PermissionErrorPermission denied
3001AuthenticationErrorToken expired and refresh failed

queryBillList​

Query billing detail list with pagination.

Example Usage​

from wlt import WltClient

client = WltClient(api_key="your-api-key", base_url="https://console.example.com")

result = client.billing.query_bill_list(
billing_cycle="2026-04",
page_size=20,
page_num=1,
)
print(f"Total records: {result.data.total}")
for item in result.data.list:
print(item)

Parameters​

ParameterTypeRequiredDefaultDescription
billing_cyclestrYes--Billing cycle, format "YYYY-MM"
page_sizeintNo10Items per page
page_numintNo1Page number, starting from 1

Response​

Returns BaseResponse[PageInfo[UserBillingResponse]].

UserBillingResponse fields:

FieldTypeDescription
afterDiscountAmountDecimalAmount after discount
deductedByCouponsDecimalCoupon deduction amount
pretaxGrossAmountDecimalOriginal amount
pretaxAmountDecimalPayable amount
instanceIDstrInstance ID
currencystrCurrency code
productCodestrProduct code
regionstrRegion
gpuSpecstrGPU spec
modelResourcestrModel resource identifier
servicePeriodUnitstrService period unit
servicePeriodstrService period
bizTypestrBusiness type (e.g. "Deploy", "Finetune")

Errors​

CodeExceptionWhen
1001ValidationErrorInvalid request parameters
2000 / 2002AuthenticationErrorAPI Key invalid
2007PermissionErrorPermission denied
3001AuthenticationErrorToken expired and refresh failed