Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
huaweicloud avatar

Huawei Cloud Maas Tokens Usage

  • 72 installs
  • 19 repo stars
  • Updated July 31, 2026
  • huaweicloud/huaweicloud-skills

Huawei Cloud MaaS Tokens Usage is an agent skill that runs the documented REST usage script with correct service types, credential patterns, and time ranges.

About

Huawei Cloud MaaS Tokens Usage is an agent skill that wraps the bundled Python CLI for pulling Model-as-a-Service token usage from Huawei Cloud over a defined interval. Solo builders and small teams shipping agents or APIs on Huawei MaaS install it when they need auditable usage pulls for billing reconciliation, capacity planning, or incident review—not ad-hoc guessing from the console. The skill encodes acceptance criteria that agents often get wrong: valid service_type values (1, 2, 4 only), credential sourcing from environment variables or a credentials file, and strict calendar semantics for phrases like last 7 days versus this month. It fits the Operate phase because it assumes live services and AK/SK access, and it reinforces safe handling by directing users to configure secrets locally rather than pasting keys into the conversation. Use it whenever you need deterministic REST statistics aligned with Huawei’s API rather than improvised curl or unsupported parameter combinations.

  • REST script maas_rest_usage_stats.py with --from/--to date ranges
  • service-type 1 (My Service), 2 (Preset Service), and 4 (Custom Endpoint)—not 3
  • Credentials via HW_ACCESS_KEY/HW_SECRET_KEY env vars or --credentials-file (line, comma, or KEY=VALUE formats)
  • Explicit distinction between “last 7 days” and “this month” when interpreting user requests
  • Security pattern: never ask for AK/SK in chat and never hardcode secrets in code

Huawei Cloud Maas Tokens Usage by the numbers

  • 72 all-time installs (skills.sh)
  • +4 installs in the week ending Aug 2, 2026 (Skillselion tracking)
  • Ranked #646 of 1,042 Cloud & Infrastructure skills by installs in the Skillselion catalog
  • Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/huaweicloud/huaweicloud-skills --skill huawei-cloud-maas-tokens-usage

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs72
repo stars19
Last updatedJuly 31, 2026
Repositoryhuaweicloud/huaweicloud-skills

What it does

Query Huawei Cloud MaaS token consumption over a chosen window without hardcoding AK/SK or using unsupported API parameters.

Who is it for?

Best when you're operating Huawei Cloud MaaS and want scripted token stats with security and parameter guardrails baked into the agent workflow.

Skip if: Skip if you're not on Huawei Cloud, or anyone and wants to paste AK/SK into chat instead of local env or --credentials-file setup.

When should I use this skill?

User asks for Huawei Cloud MaaS token usage, billing windows, or REST usage statistics for preset, custom, or my-service endpoints.

What you get

You get a reproducible usage pull using env or file credentials and API-supported service_type values, ready to log under your ops notes or cost review.

  • CLI invocation with validated --from/--to and --service-type
  • Usage statistics output suitable for cost or monitoring notes

By the numbers

  • service-type values 1, 2, and 4 supported; value 3 returns 400
  • three credentials-file formats documented (per-line, comma-separated, KEY=VALUE)

Files

SKILL.mdMarkdownGitHub ↗

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
```bash
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=<your-access-key-id>
export HW_SECRET_KEY=<your-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:
```bash
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=<your-ak>
export HW_SECRET_KEY=<your-sk>
python3 scripts/maas_rest_usage_stats.py --from 2026-05-08 --to 2026-05-21

---

References

DocumentDescription
task-query-tokens-usage.mdTask 1: Query tokens usage statistics
related-apis.mdAPI and parameter details
iam-policies.mdIAM permission policies
maas-metrics.mdMaaS monitoring metrics reference
verification-method.mdVerification steps
acceptance-criteria.mdCorrect/error pattern comparison
cli-installation-guide.mdPrerequisites installation guide
troubleshooting.mdTroubleshooting and practical experience
maas_rest_usage_stats.pyShowStatistics API usage statistics script

Related skills

How it compares

Use instead of hand-rolled curl against MaaS usage APIs without the documented service_type and credential acceptance rules.

FAQ

Who is huawei-cloud-maas-tokens-usage for?

Developers running inference on Huawei Cloud MaaS who need agent-guided REST usage reporting with correct auth and date windows.

When should I use huawei-cloud-maas-tokens-usage?

In Operate when monitoring spend or usage trends; also when reconciling monthly bills or answering “how many tokens did we burn last 7 days?” before scaling or throttling.

Is huawei-cloud-maas-tokens-usage safe to install?

The skill explicitly forbids collecting AK/SK in conversation and hardcoding secrets; review the Security Audits panel on this page before trusting any third-party skill in production.

Cloud & Infrastructuremonitoringinfra

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.