/alibabacloud-core:alibabacloud-cli-cost-estimationfrom alibabacloud-core
Quotes Alibaba Cloud CLI costs before executing chargeable operations (create, resize, renew, bandwidth change). Covers --estimate-cost flag, multi-step workflow pricing, and quote-to-bill reconciliation.
Ships in alibabacloud-core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Get an exact price quote for a CLI operation without executing it. The quote comes from the same pricing source as the trade system: for operations that produce an immediate order, the quoted amount equals the order amount you would actually pay (verified across new purchases, spec upgrades, and bandwidth changes — quote and bill match to the cent).
This is the pre-execution half of cost management. The post-hoc half
(bills already incurred) is aliyun bssopenapi QueryAccountBill — see the
reconciliation section below.
aliyun version)aliyun plugin update)When you are about to execute an operation that creates, resizes, renews, or otherwise changes billable resources:
--estimate-cost to the exact command you intend
to run.ModifyPrepayInstanceSpec — estimated charge ¥28.89
(prorated upgrade delta). Proceed?"--estimate-cost from the
same command.Never silently execute a chargeable operation when a quote was obtainable.
--estimate-cost is always safe to add: it only quotes, never executes, and
changes nothing in the account.
Multi-step plans: quote everything first, confirm once. When the user's request decomposes into multiple API calls (a workflow), do NOT interleave execute-and-ask step by step. Instead:
--estimate-cost-context state overrides for steps that depend on the
state an earlier step will produce.Present the consolidated plan in this fixed shape:
Cost plan: <goal> (<N> steps)
<i>. <step action> — <LABEL> <amount> (<basis or assumption>)
...
Totals: pay now ¥<X> · refund ¥<Y> · future ¥<Z>/<unit> (assumes <usage>)
Execute all <N> steps in order? [y/N]
Use exactly four labels, one per step:
| Label | Meaning | Amount shown |
|---|---|---|
PAY NOW | Immediate order on execution | Quoted order amount |
FUTURE | Usage-based, billed as consumed | Estimate × unit price, with the assumption |
REFUND | Money returned on execution | Negative amount, or "not quotable" if the API can't quote it |
FREE | No money involved | — |
Rules:
FUTURE amount must carry its assumption inline; if the user never
confirmed the assumption, ask before presenting the plan.Filled example (the 5-step public-IP replacement):
Cost plan: replace public IP (5 steps)
1. Switch bandwidth billing to pay-by-traffic — FUTURE ¥0.8/GB (assumes 100 GB/month → ¥80/month)
2. Convert fixed public IP to EIP — FREE (EIP then billed by usage)
3. Unassociate EIP — FREE
4. Set 5 Mbps bandwidth, new public IP — PAY NOW ¥130.40 (prorated to term end)
5. Release old EIP — FREE (stops the old IP's billing)
Totals: pay now ¥130.40 · refund: step 1 returns unused bandwidth fee (not quotable yet) · future ¥80/month (assumes 100 GB)
Execute all 5 steps in order? [y/N]
aliyun list-supported-pricing-apis
# Does a specific API support it? (any output = yes)
aliyun list-supported-pricing-apis \
--cli-query "supportedApis[?apiName=='ModifyInstanceNetworkSpec']"
The list is served live and keeps expanding — query it rather than relying on a
cached copy. Each entry is a popCode / popVersion / apiName triple.
Append --estimate-cost to any supported command (works on both PascalCase
built-in and kebab-case plugin command forms):
# What would a 1-month subscription instance cost?
aliyun ecs run-instances --biz-region-id cn-hangzhou \
--image-family acs:ubuntu_22_04_x64 \
--instance-type ecs.e-c1m1.large \
--instance-charge-type PrePaid --period 1 --period-unit Month \
--system-disk-category cloud_essd --system-disk-size 20 \
--vswitch-id vsw-xxx --security-group-id sg-xxx \
--estimate-cost
# What is the prorated delta for upgrading an instance type?
aliyun ecs modify-prepay-instance-spec --region cn-hangzhou \
--instance-id i-xxx --instance-type ecs.e-c1m2.large --estimate-cost
Top level is price + requestId. Decide how to read the amount in this order:
pricingMode: "delta" (spec changes) → read calculatedAmount. That is
the net amount to pay after the old configuration's remaining value is
refunded. components.baseline / components.target are the gross sides —
do not present them as the price.pricingMode: "single" → read priceSummary.effectiveModuleSum
(post-discount total), then check pricingUnit:
"1 Month", "Once") → the amount is per that unit.priceSummary.modules[] gives the per-billing-item breakdown
(originalCost / invoiceDiscount / costAfterDiscount) — useful when the user
asks where the money goes.success: false → read errorCode / errorMessage; do not infer from the
exit code.--estimate-cost-contextSome quotes need input that is not an API parameter. Pass it as repeatable
Key=Value pairs (must be combined with --estimate-cost):
--estimate-cost --estimate-cost-context K1=V1 K2=V2
It carries two kinds of information:
| Kind | Example | When needed |
|---|---|---|
| Usage assumption | EstimatedInternetTrafficOutGB=100 | Usage-based billing: cost = usage × unit price, and only the user knows the expected usage |
| State override | InternetChargeType=PayByTraffic | Multi-step workflows: a later step must be quoted against the state produced by an earlier step, not the current state |
Ask the user for usage assumptions when a quote requires them (e.g. "How much monthly outbound traffic do you expect?") instead of inventing a number; state the assumption alongside the quoted amount.
Example: replacing a fixed-bandwidth instance's public IP (5 steps). All chargeable steps can be quoted before executing step 1:
# Step 1 — switch bandwidth billing to pay-by-traffic.
# Usage-based: supply the traffic estimate.
aliyun ecs modify-instance-network-spec --region cn-hangzhou \
--instance-id $INS --network-charge-type PayByTraffic \
--estimate-cost --estimate-cost-context EstimatedInternetTrafficOutGB=100
# Step 2 — convert the fixed public IP to an EIP. No context needed.
aliyun ecs convert-nat-public-ip-to-eip \
--instance-id $INS --biz-region-id cn-hangzhou --estimate-cost
# Step 3 — unassociate EIP: free operation (see "Free APIs" below).
# Step 4 — set new bandwidth. At quoting time the instance is still
# fixed-bandwidth, but by execution time step 1 will have completed —
# override the state so the quote is based on the future state:
aliyun ecs modify-instance-network-spec --region cn-hangzhou \
--instance-id $INS --network-charge-type PayByBandwidth \
--internet-max-bandwidth-out 5 \
--estimate-cost --estimate-cost-context InternetChargeType=PayByTraffic
# Step 5 — release old EIP: free; its effect is stopping the old IP's billing.
Sum the per-step quotes client-side and present one pre-execution bill preview, labelling each amount by its nature: immediate order vs future usage-based cost vs refund vs free step.
Quoting an API with no pricing information returns an explicit message:
Error: no pricing information for vpc/2016-04-28/UnassociateEipAddress:
this OpenAPI either incurs no cost or has no pricing mapping registered yet
This is an answer, not a failure — treat it as "this step is not chargeable (or not yet quotable)" and say so, rather than reporting an error to the user.
For APIs that are not yet quotable, never present a number from your own
knowledge as if it were a quote. If you cite public list prices, label them
explicitly as unverified estimates with their assumptions, and point the user
to the official pricing page (or to bssopenapi QueryAccountBill after a
trial run) for authoritative figures.
| Symptom | Meaning / action |
|---|---|
no pricing information for ... | API is free or not yet quotable — informational |
No pricingTarget matched the input request | The parameter combination hit no pricing rule. The error lists each rule's when condition — usually a required PricingContext key is missing (e.g. traffic estimate for pay-by-traffic) |
--estimate-cost-context requires --estimate-cost | Add --estimate-cost |
invalid --estimate-cost-context 'xxx' | Use Key=Value form; key must be non-empty |
Quote succeeds but no pricingUnit | Usage-based quote: amount = your estimate × unit price |
Chargeable executions return an OrderId. To verify the quote against the
actual bill:
aliyun bssopenapi GetOrderDetail --OrderId <order-id>
For upgrade orders the bill has two lines (new config + refund of the old);
their net equals the quoted calculatedAmount.
| Goal | Command |
|---|---|
| List quotable APIs | aliyun list-supported-pricing-apis |
| Quote (no execution) | aliyun <product> <command> ... --estimate-cost |
| Quote with assumptions / state override | ... --estimate-cost --estimate-cost-context K1=V1 K2=V2 |
| Verify against actual order | aliyun bssopenapi GetOrderDetail --OrderId <id> |
| Post-hoc bills (complementary) | aliyun bssopenapi QueryAccountBill --BillingCycle YYYY-MM |
What SKILL.md sets; muted values are Claude Code's defaults
2 plugins in one repository ship this exact skill · first indexed Aug 12, 2026
10 skills in this plugin
/alibabacloud-cli-guidanceGuide for Alibaba Cloud CLI (aliyun) command syntax, plugin system, parameter naming, and best practices. Use this skill to generate correct CLI commands, understand plugin vs built-in command differences, structured parameter syntax, output filtering, pagination, and error troubleshooting. This skill is a CLI knowledge reference — when MCP tools (AlibabaCloud___CallCLI, etc.) are available, always prefer MCP tools for execution rather than running aliyun commands locally in the shell.
/alibabacloud-find-skillsUse this skill when users want to search, discover, browse, or find Alibaba Cloud (阿里云) agent skills. Triggers include: "find a skill for X", "search alicloud skills", "阿里云有什么 skill","阿里云", "搜索阿里云技能", "有没有管理 ECS/RDS/OSS 的 skill", "阿里云 skills 有哪些类目", "帮我找一个 skill", "browse alicloud skills", "list alicloud skill categories", "is there an alicloud skill that can...", "what alicloud skills are available", "XX Skill 的内容是什么", "我想了解阿里云 XX Skill 具体做什么","帮我安装阿里云 Skill","使用阿里云相关的skill", "阿里云 agent skill 市场", "搜一下阿里云的 skill", "建一个数据分析项目有没有相关 skill".
/alibabacloud-mcp-core-script-generateGenerate Alibaba Cloud MCP Core RunScript-compatible Python scripts from natural-language cloud operation requests. Use when the user explicitly asks for RunScript scripts, MCP Core scripts, or sandbox-compatible cloud automation code. For standard SDK Python code with imports and credentials, use `alibabacloud-sdk-usage` instead.
npx claudepluginhub aliyun/alibabacloud-agent-toolkit --plugin alibabacloud-coreOther plugins' skills for the same job