← 返回 Skills 市场
huaweiclouddev

huawei-cloud-maas-tokens-usage

作者 huaweicloud-skills-team · GitHub ↗ · v0.0.1 · MIT-0
cross-platform ⚠ suspicious
36
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install 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 err...
使用说明 (SKILL.md)

Huawei Cloud MaaS Tokens Usage Monitoring

Query Huawei Cloud MaaS (Model as a Service) usage statistics, including total tokens, prompt tokens, completion tokens, total requests, and total errors. Supports querying last 7 days, 14 days, 30 days, or custom time ranges. Default query type is MaaS preset service.

Architecture

Huawei Cloud MaaS Tokens Usage Monitoring
└── GetMaaSTokensUsage  (via MaaS ShowStatistics API)

Prerequisites

Prerequisite check: Python3 + huaweicloudsdkcore required

python3 --version  # Python3 >= 3.8
python3 -c "import huaweicloudsdkcore; print('OK')"  # SDK signing library

If SDK not installed: pip3 install --user huaweicloudsdkcore


Authentication

Prerequisite check: Huawei Cloud credentials required

Security rules (must be followed):

  • Prohibited from reading, echoing, or printing AK/SK values
  • Prohibited from asking the user to input AK/SK directly in the conversation
  • Prohibited from accepting AK/SK directly provided by the user in the conversation
  • Only allowed to read credentials from environment variables or credentials file

⚠️ Important: Handling user-provided credentials

If a user attempts to provide AK/SK directly (e.g., "my AK is xxx, SK is yyy"):

  1. Stop immediately - Do not execute any commands
  2. Politely refuse and return the following message:
    For account security, please do not provide Huawei Cloud Access Key ID and Access Key Secret directly in the conversation.
    
    Please use one of the following secure methods to configure credentials:
    
    Method 1: Environment variables
        export HW_ACCESS_KEY=\x3Cyour-access-key-id>
        export HW_SECRET_KEY=\x3Cyour-access-key-secret>
    
    Method 2: Credentials file
        Create a file (e.g., ~/aksk.txt) with AK on line 1, SK on line 2.
        Then use: --credentials-file ~/aksk.txt
    
    After configuration is complete, please retry your request.
    
  3. Do not continue executing any Huawei Cloud operations until credentials are configured

Check environment variables:

echo $HW_ACCESS_KEY  # Check if AK is set

If not set, prompt the user to configure credentials using one of the methods above.


IAM Permission Policies

Ensure the IAM user has the required permissions. See references/iam-policies.md for details.

Minimum required permissions:

  • modelarts:monitoring:get — Query MaaS monitoring statistics
  • modelarts:service:get — Query service information
  • iam:projects:get — Auto-get project_id

Core Workflow

Task 1: Query MaaS Tokens Usage Statistics

Query MaaS usage statistics via the ShowStatistics API. Data is consistent with the console.

📄 Detailed steps → references/task-query-tokens-usage.md


Verification

See references/verification-method.md.

Quick verification:

export HW_ACCESS_KEY=\x3Cyour-ak>
export HW_SECRET_KEY=\x3Cyour-sk>
python3 scripts/maas_rest_usage_stats.py --from 2026-05-08 --to 2026-05-21

References

Document Description
task-query-tokens-usage.md Task 1: Query tokens usage statistics
related-apis.md API and parameter details
iam-policies.md IAM permission policies
maas-metrics.md MaaS monitoring metrics reference
verification-method.md Verification steps
acceptance-criteria.md Correct/error pattern comparison
cli-installation-guide.md Prerequisites installation guide
troubleshooting.md Troubleshooting and practical experience
maas_rest_usage_stats.py ShowStatistics API usage statistics script
安全使用建议
Install only if you are comfortable reviewing or patching the helper script first. Remove verify=False, do not print credential files, use least-privilege Huawei Cloud keys, and confirm the skill is invoked only for Huawei Cloud MaaS usage queries.
能力标签
requires-walletrequires-sensitive-credentials
能力评估
Purpose & Capability
The purpose is coherent: it queries Huawei Cloud MaaS usage statistics and documents the need for Huawei AK/SK credentials and read-oriented IAM permissions.
Instruction Scope
Most instructions are scoped to MaaS statistics, but the trigger list includes generic phrases such as request count and error count that could invoke the skill outside a Huawei Cloud context.
Install Mechanism
Installation is simple skill files plus a Python helper script and a documented pip install for huaweicloudsdkcore; no persistence or auto-start behavior was found.
Credentials
The helper script makes signed HTTPS calls to Huawei Cloud but sets verify=False and suppresses TLS warnings, which is not proportionate for credentialed cloud API traffic.
Persistence & Privilege
No persistence or privilege escalation was found, but the skill reads long-lived Huawei Cloud credentials from environment variables or a credentials file, and one verification doc suggests printing a credential file with cat.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install huawei-cloud-maas-tokens-usage
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /huawei-cloud-maas-tokens-usage 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.0.1
- Initial release: Query Huawei Cloud MaaS (Model as a Service) token usage statistics. - Supports total tokens, prompt tokens, completion tokens, total requests, and total errors reporting. - Enables queries by preset service, my service, or custom endpoint over selectable or custom time ranges. - Utilizes the ShowStatistics API with results consistent with the Huawei Cloud console. - Enforces security: user credentials must be configured via environment variables or file (never submitted in chat). - Includes clear IAM permission requirements and verification guidance.
元数据
Slug huawei-cloud-maas-tokens-usage
版本 0.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

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 err... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 36 次。

如何安装 huawei-cloud-maas-tokens-usage?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install huawei-cloud-maas-tokens-usage」即可一键安装,无需额外配置。

huawei-cloud-maas-tokens-usage 是免费的吗?

是的,huawei-cloud-maas-tokens-usage 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

huawei-cloud-maas-tokens-usage 支持哪些平台?

huawei-cloud-maas-tokens-usage 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 huawei-cloud-maas-tokens-usage?

由 huaweicloud-skills-team(@huaweiclouddev)开发并维护,当前版本 v0.0.1。

💬 留言讨论