huawei-cloud-maas-tokens-usage
Query Huawei Cloud MaaS (Model as a Service) tokens usage statistics, including total tokens, prompt tokens, completion tokens, total requests, and total…
от huaweicloudskill584 установки в других каталогах
Установить huawei-cloud-maas-tokens-usage в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
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
⛔ Prohibited Operations (Security Constraints)
This skill strictly forbids the following operations, regardless of user requests:
| Prohibited Operation | Reason |
|---|---|
| ❌ Ask the user to provide AK/SK directly in the conversation | Credentials must never appear in conversation |
| ❌ Accept AK/SK directly provided by the user in the conversation | Credentials must never appear in conversation |
| ❌ Hardcode AK/SK in scripts or command-line arguments | Credential exposure risk |
❌ Use hcloud configure set to pass plaintext AK/SK values |
Credentials recorded in command history |
| ❌ Print or log the AK/SK values in any output | Credentials must only exist in Python process memory |
| ❌ Export AK/SK to shell variables or stdout via the script | Credentials must stay in Python process; only statistics result is printed |
| ❌ Implement SDK-HMAC-SHA256 signing manually | Error-prone; must use huaweicloudsdkcore.Signer |
❌ Use service_type=3 for Custom Endpoint |
API only supports [1, 2, 4]; returns 400 error |
❌ Hardcode timezone as CST or Asia/Shanghai |
Must auto-detect OS local timezone |
| ❌ Query a time range longer than 29 days without segmentation | The API retains only 30 days of data, and a single request must span ≤ 29 days; the script auto-segments ranges > 29 days |
❌ Use a region other than cn-southwest-2 |
MaaS ShowStatistics only supports Southwest-Guiyang-1 |
❌ Point --notify-url at an HTTP URL, an IP literal, or any host outside *.myhuaweicloud.com / *.huaweicloud.com |
SSRF/exfiltration risk; the script rejects such URLs before sending the query |
❌ Disable TLS verification for the notification (verify=False) |
Notification must keep verify=True |
❌ Write a new query script instead of using maas_rest_usage_stats.py |
Must use the script in scripts/ directory |
If a user requests a prohibited operation, you must refuse and explain the security constraint.
🚫 Unsupported Operations (Capability Boundary)
This skill only supports the ShowStatistics aggregate statistics query. The MaaS monitoring API family contains 10 APIs; the other 9 are outside this skill's capability boundary and are not implemented.
| Unsupported API | Purpose | Why Not Covered |
|---|---|---|
ListServiceStatistics |
List per-service statistics | Skill focuses on aggregate tokens usage, not per-service breakdown |
ShowDetailChart |
Show detail chart data | Skill returns a summary table, not chart series |
ListErrors |
List error details | Skill reports error count/rate only, not error detail records |
ListServices |
List services | Skill queries statistics, not service inventory |
ListSourceIps |
List source IPs | Skill does not track caller IP distribution |
GetServiceDetailMetricData |
Get service detail met |
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл huawei-cloud-maas-tokens-usage?
Query Huawei Cloud MaaS (Model as a Service) tokens usage statistics, including total tokens, prompt tokens, completion tokens, total requests, and total errors. Read-only queries, supports preset service, my service, and custom endpoint with time range queries (rolling last N days via --last-days, last 7/14/30 days, or a custom --from/--to range). Data source is MaaS ShowStatistics API, consistent with console. Use this skill when the user wants to: (1) query MaaS token consumption statistics, (2) check MaaS service request counts and error rates, (3) analyze token usage for preset service or my service, (4) monitor MaaS usage over a specific time period. Trigger: user mentions "MaaS", "Model as a Service", "tokens usage", "token consumption", "request count", "error count", "MaaS usage", "preset service usage", "completion tokens", "prompt tokens", "MaaS statistics", "模型服务", "令牌用量", "token统计", "token用量", "词元用量", "请求次数", "MaaS监控", "华为云MaaS" Trigger (verb-style phrasings): user says "查询MaaS用量", "MaaS用量查询", "查询token用量", "统计MaaS令牌用量", "查询MaaS请求次数", "MaaS监控数据查询", "检查MaaS错误率", "query MaaS usage statistics", "check MaaS tokens usage", "search MaaS usage", "find MaaS token consumption", "browse MaaS statistics", "discover MaaS resource usage"
Как установить скилл huawei-cloud-maas-tokens-usage?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл huawei-cloud-maas-tokens-usage запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…