Query and analyze cloud-service billing with a repeatable workflow. Use when users ask about Aliyun or Tencent Cloud costs, bills, spending, charges, 账单, 费用, 成本, billing trends, month-by-month changes, category breakdowns, or resource-level attribution. Default providers are Aliyun and Tencent Cloud. Supports validating CLI auth, pulling recent monthly summaries, normalizing service categories, and drilling down into resource evidence when attribution matters.
Use this skill to analyze cloud bills from official CLIs first, then normalize the results into provider, service, category, and resource-level summaries.
Default scope is aliyun plus tencent. Only expand to other providers if the user explicitly asks.
For the default path, run:
python3 scripts/query_aliyun_bills.py --months 3 --output /tmp/aliyun-bills.json
python3 scripts/query_tencent_bills.py --months 3 --output /tmp/tencent-bills.json
python3 scripts/normalize_cloud_costs.py /tmp/aliyun-bills.json /tmp/tencent-bills.json
Then write a concise report with:
Before hitting provider APIs, check whether the workspace or the machine already has:
Use existing artifacts when they are already the requested source of truth. Otherwise continue with live CLI queries.
Confirm three things early:
aliyun and tencent3 billing cyclesWhen the user says "this month", "recent", or "latest", state exact month boundaries in the answer. If the current month is included, label it as month-to-date with the exact date.
Do not start with a broad bill export. First prove that auth and billing-read permission are working.
For Aliyun:
aliyun configure listaliyun bssopenapi QueryAccountBalance --region cn-hangzhouFor Tencent Cloud:
tccli billing DescribeAccountBalancetccli billing DescribeBillSummaryByProduct --BeginTime 2026-02-01 --EndTime 2026-02-28If auth is missing, stop at the exact login or permission boundary and tell the user the minimum required permission.
Use the helper scripts unless the user explicitly wants raw commands only.
scripts/query_aliyun_bills.py pulls QueryBillOverview for each billing cycle and aggregates by ProductName and ProductDetailscripts/query_tencent_bills.py pulls DescribeBillSummaryByProduct for each billing window and aggregates by productIf command syntax or response fields are unclear, verify against official provider documentation before continuing. Prefer official docs only.
Use scripts/normalize_cloud_costs.py to merge provider outputs into cross-provider categories.
Read references/category-mapping.md when:
Always preserve the raw provider service names in the final write-up even after grouping.
Do not assume the whole account belongs to one workload.
For mixed-use accounts:
Read references/aliyun.md for the Aliyun attribution workflow. Read references/tencent.md for Tencent-specific notes.
Separate:
Do not flatten uncertainty. If a provider returns partial or not-ready data, say so explicitly.
aliyun, 阿里云, Alibaba Cloud, ECS, OSS, ARMS, 百炼, or Aliyun-specific billing APIs.tencent, 腾讯云, tccli, CVM, COS, or Tencent billing APIs.Prefer this answer shape:
If the user asked for "latest" or "today", include exact dates such as March 26, 2026 rather than relative phrasing alone.