Huawei Cloud Billing Bill Query Skill
Overview
This skill queries the Huawei Cloud BSS (Business Support System) bills and fees of the current account within one billing cycle (one month) via the BSS v2 API and returns a report. It supports three read-only actions:
| Action | What it returns | BSS v2 API |
|---|---|---|
fee-records |
Bill fee records (账单费用记录/账单明细) for a billing cycle: service, resource, region, consume/trade time, consume amount, cash/credit/coupon amounts | list_customer_bills_fee_records |
res-fee-records |
Resource fee records / 流水账单 for a billing cycle: per-resource usage, unit price, amount, cash/credit/coupon amounts | list_customerself_resource_records |
breakdown |
Monthly cost breakdown (月度成本分析) for a shared month: amortized amounts per resource | list_customer_bills_monthly_break_down |
The time scope is deliberately limited to one month: the default billing
cycle is the current month (YYYY-MM), and the user can pick any single month.
Multi-month or unbounded range queries are not supported.
It is a read-only inspection skill: it never creates, modifies, or deletes any billing resource.
Architecture:
Agent → scripts/query_bills.py (quality-reporting wrapper)
→ huaweicloudsdkbss Python SDK (BssClient)
→ Huawei Cloud BSS v2 API (global endpoint https://bss.myhuaweicloud.com)
API paths (verified from huaweicloudsdkbss v2 SDK _http_info):
| Operation | Method | API Path |
|---|---|---|
| Query bill fee records | GET | /v2/bills/customer-bills/fee-records |
| Query resource fee records (流水账单) | GET | /v2/bills/customer-bills/res-fee-records |
| Query monthly cost breakdown | GET | /v2/costs/cost-analysed-bills/monthly-breakdown |
Execution-quality reporting: every invocation of
scripts/query_bills.py reports a trace_id, status
(success / biz_fail / sys_fail), error code and cost to the skillsopr
operations console via the vendored scripts/skill_quality_sdk.py. Reporting
is non-blocking and fails silently; it never affects the query result.
Applicable Scenarios:
- Monthly expense check: "how much did I spend last month" / "查一下这个月的账单"
- Cost review: enumerate consumption per service / resource for one month
- 流水账单 inspection: per-resource usage and unit prices for one billing cycle
- Budget check: monthly cost breakdown with amortized amounts
- Daily inspection: quick bill snapshot of the current month
能力边界(Capability Boundary): 本 Skill 仅查询当前账号一个月内的账单/费用(账单费用记录、流水账单、 月度成本分析)。不查询余额/余额变动,不创建、修改、删除任何账单或资源, 不支持跨多个月的查询。 若用户询问"查余额"、"导出账单"、"开票"、"充值/退款"等,请明确告知本 Skill 不提供该能力。
Prerequisites
- Python 3.8+ with
huaweicloudsdkbssandhuaweicloudsdkcorepackages — Seereferences/cli-installation-guide.md(KooCLI does NOT support BSS, so the SDK is the only execution path) - Huawei Cloud AK/SK in environment variables
(
HUAWEI_ACCESS_KEY/HUAWEI_SECRET_KEYorHUAWEICLOUD_SDK_AK/HUAWEICLOUD_SDK_SK) — must belong to the account whose bills are queried - IAM permissions —
bss:bill:view(or the system policyBSS ReadOnlyAccess) is required to query bills. Seereferences/iam-policies.md - BSS is a global service — no region parameter is required; the client
uses
GlobalCredentialsagainsthttps://bss.myhuaweicloud.com
Workflow
- Identify the intent — Confirm the user wants to query bills/fees (账单/费用/流水账单/月度成本) of the current account.
- Determine the billing cycle — Default to the current month (
YYYY-MM); let the user override with a single month. Only one month is supported. - Choose the action —
fee-records(账单费用记录) is the default; useres-fee-recordsfor 流水账单 orbreakdownfor monthly cost analysis. - Run the query — Execute
scripts/query_bills.pywith the requested action and cycle; optionally narrow the date range with--bill-date-begin/--bill-date-end. - Present the results — Show the per-record amounts and totals
(consume/cash/coupon), or the raw JSON with
--format json. - Handle errors — Missing AK/SK (
C01), invalid cycle/date format (U02), missing cycle (U01), or no records (U03) are reported with the quality SDK error codes. Parameter validation is client-side and fail-fast: dates must fall within the selected billing cycle,--limitmust be 1-100,--offsetmust be >= 1, and action-specific parameters (--shared-month,--bill-date-*,--bill-type) are rejected with a clearU02message when used with an incompatible action.
Core Commands
This skill uses the Python SDK (KooCLI does not support BSS). Run from the skill directory:
python3 scripts/query_bills.py [options]
Query bill fee records (default action, current month)
python3 scripts/query_bills.py
Query bill fee records for a specific month (JSON)
python3 scripts/query_bills.py --action fee-records --bill-cycle 2026-07 --format json
Query resource fee records (流水账单) for one month
python3 scripts/query_bills.py --action res-fee-records --cycle 2026-07
Narrow to a date range within the month
python3 scripts/query_bills.py --action res-fee-records --cycle 2026-07 \
--bill-date-begin 2026-07-01 --bill-date-end 2026-07-31
Query monthly cost breakdown (月度成本分析)
python3 scripts/query_bills.py --action breakdown --shared-month 2026-07 --limit 20
Filter by bill type (1=consumption, 2=refund, 3=adjustment, 4=timed, 5=arrears)
python3 scripts/query_bills.py --action fee-records --bill-cycle 2026-07 --bill-type 1
Parameter Confirmation
| Parameter | Required | Description | Example |
|---|---|---|---|
--action |
No | Query action: fee-records (default), res-fee-records, breakdown |
fee-records |
--bill-cycle |
No | Billing cycle YYYY-MM (fee-records); default current month |
2026-07 |
--cycle |
No | Billing cycle YYYY-MM (res-fee-records); default current month |
2026-07 |
--shared-month |
No | Shared month YYYY-MM (breakdown); default current month |
2026-07 |
--bill-date-begin |
No | Start date YYYY-MM-DD within the month (fee-records / res-fee-records) |
2026-07-01 |
--bill-date-end |
No | End date YYYY-MM-DD within the month (fee-records / res-fee-records) |
2026-07-31 |
--bill-type |
No | Bill type: 1=consumption, 2=refund, 3=adjustment, 4=timed, 5=arrears | 1 |
--offset |
No | Page offset (>=1) | 1 |
--limit |
No | Max records per page (1-100) | 10 |
--format |
No | Output format: text (default) or json |
json |
Reference Documents
references/cli-installation-guide.md— Python SDK installation and AK/SK configuration (KooCLI does not support BSS)references/iam-policies.md— Least-privilege IAM policies (bss:bill:view)references/verification-method.md— Verification method and manual checksreferences/dataflow-diagram.md— Mermaid data flow diagramreferences/acceptance-criteria.md— Acceptance criteria
KooCLI Command Format Standard
KooCLI (
hcloud) does not support the BSS service —hcloud BSS --helpreturns "Unsupported service: BSS". This skill therefore uses the Python SDK (huaweicloudsdkbss) as its only execution path; no hcloud commands are used.
