huawei-cloud-maas-tokens-usage
Huawei Cloud MaaS Tokens Usage Monitoring Skill
Overview
Query Huawei Cloud MaaS (Model as a Service) usage statistics via the ShowStatistics API, including total tokens, prompt tokens, completion tokens, total requests, and total errors. Supports querying a rolling last N days via --last-days N (7/14/30 days, …) or a custom --from/--to time range. Default query type is MaaS preset service. AK/SK never leaves Python process memory.
Capability type: readonly — read-only queries only. This skill only reads data: the IAM GET /v3/projects project lookup plus the MaaS ShowStatistics query API. It performs no create / update / delete / write operation on any Huawei Cloud resource, no configuration change, no state mutation, and no resource provisioning; every command it runs is an idempotent query. The optional --notify-url webhook is an outbound POST of the query summary to a trusted Huawei Cloud host only (HTTPS enforced, TLS verification on) — it does not modify any resource.
Tool separation principle:
- Python SDK signing — AK/SK signing via
huaweicloudsdkcore.signer.Signer(credentials never leave Python process memory, never appear inps -ef) - Python requests — HTTP POST to MaaS ShowStatistics endpoint (signed request sent from Python process only)
- No hcloud CLI — MaaS ShowStatistics is not covered by KooCLI; pure Python REST + SDK signing
Security architecture:
- AK/SK is read from environment variables (
HW_ACCESS_KEY/HW_SECRET_KEY) or a credentials file by the Python script (never typed by user in conversation, never passed via CLI args, never exported to shell) - Temporary credentials add
HW_SECURITY_TOKEN(passed asX-Security-Tokenheader by the SDK signer) - Signing is performed by
huaweicloudsdkcore.Signerinside the Python process; the signed Authorization header is sent to the MaaS endpoint only - AK/SK is never printed, never logged, never appears in
ps -ef, never appears in conversation - No KMS dependency, no hcloud CLI dependency, no third-party skill dependency