qianwen-payment

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

QianWen Payment

QianWen 支付

Check account balance and open the official recharge page via the QianWen CLI.
通过QianWen CLI查询账户余额并打开官方充值页面。

Security Boundary

安全边界

[!CAUTION] This skill NEVER completes any fund operation inside the conversation. Recharge is only completed by the user on the official page opened by the CLI.
Before running
qianwen billing balance recharge
, you MUST, in order:
  1. Show the user their current balance (
    qianwen billing balance summary --format json
    )
  2. Explain that the recharge command will attempt to open the official recharge page in the browser, and will return a link to that page
  3. Obtain the user's explicit confirmation (report result status as
    confirmation_required
    until confirmed)
The command attempts to open the browser the moment it runs — asking after execution is too late. (In sandboxed/headless hosts the browser may not open; the returned
rechargeUrl
is the reliable fallback — see Recharge entry below.)
NEVER:
  • ❌ Run
    qianwen billing balance recharge
    before the user explicitly confirms — NEVER execute first and ask afterwards
  • ❌ Perform, simulate, or promise any payment, transfer, or fund operation in the conversation
  • ❌ Judge that the balance is "insufficient" or proactively suggest recharging — only display the balance as-is
  • ❌ Construct, guess, or rewrite any recharge URL — only use the
    rechargeUrl
    returned by the CLI
[!CAUTION] 本技能绝不会在对话中完成任何资金操作。充值仅由用户在CLI打开的官方页面上完成。
在执行
qianwen billing balance recharge
之前
,你必须按以下顺序操作:
  1. 向用户展示其当前余额(
    qianwen billing balance summary --format json
  2. 说明充值命令将尝试在浏览器中打开官方充值页面,并返回该页面的链接
  3. 获取用户的明确确认(在确认前,将结果状态报告为
    confirmation_required
命令在运行时会立即尝试打开浏览器——执行后再询问为时已晚。(在沙盒/无头主机环境中,浏览器可能无法打开;返回的
rechargeUrl
是可靠的备用方案——请参见下方的充值入口部分。)
绝对禁止:
  • ❌ 在用户明确确认前执行
    qianwen billing balance recharge
    ——绝不能先执行后询问
  • ❌ 在对话中执行、模拟或承诺任何支付、转账或资金操作
  • ❌ 判断余额“不足”或主动建议充值——仅如实显示余额
  • ❌ 构造、猜测或重写任何充值URL——仅使用CLI返回的
    rechargeUrl

Prerequisites

前置条件

  • QianWen CLI >= 1.3.0 is required. Verify with:
bash
qianwen version
If the installed version is below 1.3.0, do NOT call the missing billing commands. Explain that the payment commands require CLI >= 1.3.0 and wait for the user to confirm the upgrade before proceeding.
If not installed, run:
bash
npm install -g @qianwenai/qianwen-cli
Node.js >= 18 required.
  • 需要 QianWen CLI >= 1.3.0。可通过以下命令验证:
bash
qianwen version
如果安装的版本低于1.3.0,请勿调用缺失的账单命令。说明支付命令需要CLI >= 1.3.0,并等待用户确认升级后再继续。
如果未安装,请执行:
bash
npm install -g @qianwenai/qianwen-cli
要求Node.js >= 18。

Authentication

身份验证

This skill authenticates through the CLI login session (OAuth device flow). It does NOT need — and MUST NOT be given — any API key configuration.
TL;DR — 3-step auth path:
  1. qianwen auth status --format json
    authenticated: true
    → skip to commands
  2. qianwen auth login --init-only --format json
    → extract
    verification_url
    → open in browser
  3. qianwen auth login --complete --format json
    → poll until
    success
    event
For the full authentication flow (event structure, non-TTY handling, pitfalls), see the qianwen-usage skill.
本技能通过CLI登录会话(OAuth设备流)进行身份验证。不需要——且绝对不能提供——任何API密钥配置。
简而言之——三步认证流程:
  1. qianwen auth status --format json
    authenticated: true
    → 直接执行命令
  2. qianwen auth login --init-only --format json
    → 提取
    verification_url
    → 在浏览器中打开
  3. qianwen auth login --complete --format json
    → 轮询直到出现
    success
    事件
完整的认证流程(事件结构、非TTY处理、注意事项)请参见 qianwen-usage 技能。

Commands

命令

All commands must be run with an explicit
--format json
and their JSON output parsed.
所有命令必须显式添加
--format json
参数,并解析其JSON输出。

Check balance

查询余额

qianwen billing balance summary
— Show available account balance
bash
qianwen billing balance summary --format json
JSON structure:
json
{
  "availableAmount": "1234.56",
  "currency": "CNY"
}
Present the balance to the user as a formatted amount with its currency (e.g.
¥1,234.56
for CNY) — this mirrors the CLI's own
displayAmount
rendering in table/text mode. Do not show the raw JSON.
qianwen billing balance summary
——显示可用账户余额
bash
qianwen billing balance summary --format json
JSON结构:
json
{
  "availableAmount": "1234.56",
  "currency": "CNY"
}
向用户展示带货币标识的格式化余额(例如CNY显示为
¥1,234.56
)——这与CLI在表格/文本模式下的
displayAmount
渲染一致。请勿显示原始JSON。

Recharge entry (confirmation required)

充值入口(需确认)

qianwen billing balance recharge
— Open the official recharge page in the browser
Only run this AFTER completing the Security Boundary confirmation steps above.
bash
qianwen billing balance recharge --format json
JSON structure:
json
{
  "rechargeUrl": "https://platform.qianwenai.com/home/billing/overview?target=recharge",
  "opened": true,
  "message": "Recharge page opened in browser"
}
Always surface
rechargeUrl
to the user — regardless of
opened
.
The
opened
flag reflects whether the CLI's browser-launch command returned successfully, but a successful launch does not guarantee a browser window actually appeared. In sandboxed or headless hosts (e.g. the Codex desktop app, remote containers, CI) the browser often cannot open even when
opened
is reported as
true
. So never rely on
opened
alone to decide whether to give the user the link.
Parse
opened
, but present the link in both cases:
  • true
    → tell the user the official recharge page has been opened in their browser, and still include the
    rechargeUrl
    with a note like "if it didn't open automatically, use this link".
  • false
    → tell the user the browser could not be opened automatically, and show the
    rechargeUrl
    so they can open it manually.
In every case, show the
rechargeUrl
exactly as returned by the CLI (never construct or rewrite it). The recharge itself happens entirely on that official page; this skill's job ends once the entry — including the copyable link — is presented.
qianwen billing balance recharge
——在浏览器中打开官方充值页面
仅在完成上述安全边界的确认步骤后才能执行此命令。
bash
qianwen billing balance recharge --format json
JSON结构:
json
{
  "rechargeUrl": "https://platform.qianwenai.com/home/billing/overview?target=recharge",
  "opened": true,
  "message": "Recharge page opened in browser"
}
无论
opened
值如何,始终向用户提供
rechargeUrl
opened
标志仅反映CLI的浏览器启动命令是否成功返回,但成功启动并不保证浏览器窗口实际弹出。在沙盒或无头主机环境中(例如 Codex桌面应用、远程容器、CI),即使
opened
报告为
true
,浏览器通常也无法打开。因此绝不能仅依赖
opened
来决定是否向用户提供链接。
解析
opened
的值,但在两种情况下都展示链接:
  • true
    → 告知用户官方充值页面已在浏览器中打开,同时仍需包含
    rechargeUrl
    ,并附上说明如“若未自动打开,请使用此链接”。
  • false
    → 告知用户无法自动打开浏览器,并展示
    rechargeUrl
    供用户手动打开。
在任何情况下,都需严格按照CLI返回的内容展示
rechargeUrl
(绝不能构造或重写)。充值操作完全在该官方页面上完成;本技能的任务在提供入口(包括可复制的链接)后即结束。

Output and Agent Display Rules

输出与Agent展示规则

JSON is the primary output mode for agents — always pass
--format json
explicitly, parse the structured response, then present a human-readable summary to the user.
When using
--format json
(recommended for agents):
  1. Parse the JSON and extract the relevant data for the user's question
  2. Present a human-readable summary — do not dump raw JSON to the user
  3. Add analysis AFTER the summary — clearly separated with
    ---
When using
--format text
:
  1. Display CLI output EXACTLY AS-IS — no modification, no reformatting
  2. Preserve all formatting — alignment, spacing, separators
  3. Add analysis AFTER output only — clearly separated with
    ---
Never parse
table
format programmatically — it contains ANSI codes and Unicode borders.
NEVER:
  • ❌ Dump raw JSON to the user without interpretation
  • ❌ Reformat or summarize text/table output
  • ❌ Add prefixes like "Here's your balance:"
  • ❌ Convert text/table output to bullet points
  • ❌ Fabricate or mock values to fill in missing real results
JSON是Agent的主要输出模式——始终显式传递
--format json
参数,解析结构化响应后,向用户呈现人类可读的摘要。
当使用
--format json
(推荐Agent使用)时:
  1. 解析JSON 并提取与用户问题相关的数据
  2. 呈现人类可读的摘要——请勿向用户输出原始JSON
  3. 在摘要后添加分析——用
    ---
    清晰分隔
当使用
--format text
时:
  1. 完全按原样显示CLI输出——不修改、不重新格式化
  2. 保留所有格式——对齐方式、空格、分隔符
  3. 仅在输出后添加分析——用
    ---
    清晰分隔
绝不能以编程方式解析
table
格式——它包含ANSI代码和Unicode边框。
绝对禁止:
  • ❌ 向用户输出未经解释的原始JSON
  • ❌ 重新格式化或总结文本/表格输出
  • ❌ 添加类似“这是你的余额:”的前缀
  • ❌ 将文本/表格输出转换为项目符号
  • ❌ 编造或模拟值来填充缺失的真实结果

Result status mapping

结果状态映射

Report every operation with exactly one of these statuses:
StatusWhen
success
Command succeeded and full data was parsed
partial
Command succeeded but some fields are missing/
null
empty
Command succeeded but there is no data to show
confirmation_required
Recharge requested but user confirmation not yet obtained
error
Command failed (see Error Handling below)
Never substitute mock data for a real result under any status.
每个操作都必须报告以下状态之一:
状态适用场景
success
命令执行成功且完整数据已解析
partial
命令执行成功但部分字段缺失/为
null
empty
命令执行成功但无数据可展示
confirmation_required
用户请求充值但尚未获得确认
error
命令执行失败(请参见下方错误处理)
在任何状态下,都绝不能用模拟数据替代真实结果。

Error Handling / Exit Codes

错误处理 / 退出码

CodeMeaning
0Success
1General/usage error
2Authentication error
3Network error
4Configuration error
130Interrupted
  • On a non-zero exit code, still attempt to parse any structured output on stdout first — it may contain a usable error payload or partial result.
  • On exit code 2 (authentication error): guide the user through the auth flow (see Prerequisites), then retry the original task at most once. NEVER loop login attempts.
代码含义
0成功
1常规/使用错误
2身份验证错误
3网络错误
4配置错误
130被中断
  • 当退出码非零时,仍需先尝试解析stdout上的任何结构化输出——它可能包含可用的错误负载或部分结果。
  • 当退出码为2(身份验证错误)时:引导用户完成认证流程(请参见前置条件),然后最多重试一次原始任务。绝不能循环登录尝试。

Regional Note

区域说明

This skill targets the QianWen China site (
platform.qianwenai.com
) only. For the international site, use the qwencloud-payment skill instead. This skill does not include any international-site-specific commands such as
payment-method
or
bind
.
本技能仅针对千问中国站点(
platform.qianwenai.com
)。针对国际站点,请使用 qwencloud-payment 技能。本技能不包含任何国际站点特有的命令,如
payment-method
bind