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
| Method | Description |
|---|---|
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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| billing_cycle | str | Yes | -- | Billing cycle, format "YYYY-MM" (e.g. "2026-04") |
Response
Returns BaseResponse[UserBillingMonthResponse].
UserBillingMonthResponse fields:
| Field | Type | Description |
|---|---|---|
| afterDiscountAmountSum | Decimal | Amount after discount |
| deductedByCouponsSum | Decimal | Coupon deduction amount |
| pretaxGrossAmountSum | Decimal | Original amount (list price) |
| pretaxAmountSum | Decimal | Payable amount |
| currency | str | Currency code (e.g. "USD") |
Errors
| Code | Exception | When |
|---|---|---|
1001 | ValidationError | Invalid request parameters |
2000 / 2002 | AuthenticationError | API Key invalid |
2007 | PermissionError | Permission denied |
3001 | AuthenticationError | Token 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| billing_cycle | str | Yes | -- | Billing cycle, format "YYYY-MM" |
| page_size | int | No | 10 | Items per page |
| page_num | int | No | 1 | Page number, starting from 1 |
Response
Returns BaseResponse[PageInfo[UserBillingGpuServiceResponse]].
UserBillingGpuServiceResponse fields:
| Field | Type | Description |
|---|---|---|
| afterDiscountAmountSum | Decimal | Amount after discount |
| deductedByCouponsSum | Decimal | Coupon deduction amount |
| pretaxGrossAmountSum | Decimal | Original amount |
| pretaxAmountSum | Decimal | Payable amount |
| listPrice | Decimal | List price (unit price) |
| currency | str | Currency code |
| gpuSpec | str | GPU spec (e.g. "A100-80G") |
| servicePeriodUnit | str | Service period unit (e.g. "Hour") |
| servicePeriodSum | str | Total service period |
| modelResource | str | Model resource identifier |
Errors
| Code | Exception | When |
|---|---|---|
1001 | ValidationError | Invalid request parameters |
2000 / 2002 | AuthenticationError | API Key invalid |
2007 | PermissionError | Permission denied |
3001 | AuthenticationError | Token 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| billing_cycle | str | Yes | -- | Billing cycle, format "YYYY-MM" |
| page_size | int | No | 10 | Items per page |
| page_num | int | No | 1 | Page number, starting from 1 |
Response
Returns BaseResponse[PageInfo[UserBillingAiServiceResponse]].
UserBillingAiServiceResponse fields:
| Field | Type | Description |
|---|---|---|
| afterDiscountAmountSum | Decimal | Amount after discount |
| deductedByCouponsSum | Decimal | Coupon deduction amount |
| pretaxGrossAmountSum | Decimal | Original amount |
| pretaxAmountSum | Decimal | Payable amount |
| currency | str | Currency code |
| gpuSpec | str | GPU spec |
| modelResource | str | Model resource identifier |
| servicePeriodUnit | str | Service period unit |
| servicePeriodSum | str | Total service period |
| bizType | str | Business type (e.g. "Deploy", "Finetune") |
Errors
| Code | Exception | When |
|---|---|---|
1001 | ValidationError | Invalid request parameters |
2000 / 2002 | AuthenticationError | API Key invalid |
2007 | PermissionError | Permission denied |
3001 | AuthenticationError | Token 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| billing_cycle | str | Yes | -- | Billing cycle, format "YYYY-MM" |
| page_size | int | No | 10 | Items per page |
| page_num | int | No | 1 | Page number, starting from 1 |
Response
Returns BaseResponse[PageInfo[UserBillingResponse]].
UserBillingResponse fields:
| Field | Type | Description |
|---|---|---|
| afterDiscountAmount | Decimal | Amount after discount |
| deductedByCoupons | Decimal | Coupon deduction amount |
| pretaxGrossAmount | Decimal | Original amount |
| pretaxAmount | Decimal | Payable amount |
| instanceID | str | Instance ID |
| currency | str | Currency code |
| productCode | str | Product code |
| region | str | Region |
| gpuSpec | str | GPU spec |
| modelResource | str | Model resource identifier |
| servicePeriodUnit | str | Service period unit |
| servicePeriod | str | Service period |
| bizType | str | Business type (e.g. "Deploy", "Finetune") |
Errors
| Code | Exception | When |
|---|---|---|
1001 | ValidationError | Invalid request parameters |
2000 / 2002 | AuthenticationError | API Key invalid |
2007 | PermissionError | Permission denied |
3001 | AuthenticationError | Token expired and refresh failed |