qianwen-payment
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseQianWen 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, you MUST, in order:qianwen billing balance recharge
- Show the user their current balance (
)qianwen billing balance summary --format json- Explain that the recharge command will attempt to open the official recharge page in the browser, and will return a link to that page
- Obtain the user's explicit confirmation (report result status as
until confirmed)confirmation_requiredThe 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 returnedis the reliable fallback — see Recharge entry below.)rechargeUrl
NEVER:
- ❌ Run before the user explicitly confirms — NEVER execute first and ask afterwards
qianwen billing balance recharge - ❌ 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 returned by the CLI
rechargeUrl
[!CAUTION] 本技能绝不会在对话中完成任何资金操作。充值仅由用户在CLI打开的官方页面上完成。在执行之前,你必须按以下顺序操作:qianwen billing balance recharge
- 向用户展示其当前余额(
)qianwen billing balance summary --format json- 说明充值命令将尝试在浏览器中打开官方充值页面,并返回该页面的链接
- 获取用户的明确确认(在确认前,将结果状态报告为
)confirmation_required命令在运行时会立即尝试打开浏览器——执行后再询问为时已晚。(在沙盒/无头主机环境中,浏览器可能无法打开;返回的是可靠的备用方案——请参见下方的充值入口部分。)rechargeUrl
绝对禁止:
- ❌ 在用户明确确认前执行 ——绝不能先执行后询问
qianwen billing balance recharge - ❌ 在对话中执行、模拟或承诺任何支付、转账或资金操作
- ❌ 判断余额“不足”或主动建议充值——仅如实显示余额
- ❌ 构造、猜测或重写任何充值URL——仅使用CLI返回的
rechargeUrl
Prerequisites
前置条件
- QianWen CLI >= 1.3.0 is required. Verify with:
bash
qianwen versionIf 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-cliNode.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:
- →
qianwen auth status --format json→ skip to commandsauthenticated: true - → extract
qianwen auth login --init-only --format json→ open in browserverification_url - → poll until
qianwen auth login --complete --format jsoneventsuccess
For the full authentication flow (event structure, non-TTY handling, pitfalls), see the qianwen-usage skill.
本技能通过CLI登录会话(OAuth设备流)进行身份验证。不需要——且绝对不能提供——任何API密钥配置。
简而言之——三步认证流程:
- →
qianwen auth status --format json→ 直接执行命令authenticated: true - → 提取
qianwen auth login --init-only --format json→ 在浏览器中打开verification_url - → 轮询直到出现
qianwen auth login --complete --format json事件success
完整的认证流程(事件结构、非TTY处理、注意事项)请参见 qianwen-usage 技能。
Commands
命令
All commands must be run with an explicit and their JSON output parsed.
--format json所有命令必须显式添加 参数,并解析其JSON输出。
--format jsonCheck balance
查询余额
qianwen billing balance summarybash
qianwen billing balance summary --format jsonJSON structure:
json
{
"availableAmount": "1234.56",
"currency": "CNY"
}Present the balance to the user as a formatted amount with its currency (e.g. for CNY) — this mirrors the CLI's own rendering in table/text mode. Do not show the raw JSON.
¥1,234.56displayAmountqianwen billing balance summarybash
qianwen billing balance summary --format jsonJSON结构:
json
{
"availableAmount": "1234.56",
"currency": "CNY"
}向用户展示带货币标识的格式化余额(例如CNY显示为 )——这与CLI在表格/文本模式下的 渲染一致。请勿显示原始JSON。
¥1,234.56displayAmountRecharge entry (confirmation required)
充值入口(需确认)
qianwen billing balance rechargeOnly run this AFTER completing the Security Boundary confirmation steps above.
bash
qianwen billing balance recharge --format jsonJSON structure:
json
{
"rechargeUrl": "https://platform.qianwenai.com/home/billing/overview?target=recharge",
"opened": true,
"message": "Recharge page opened in browser"
}Always surface to the user — regardless of . The 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 is reported as . So never rely on alone to decide whether to give the user the link.
rechargeUrlopenedopenedopenedtrueopenedParse , but present the link in both cases:
opened- → tell the user the official recharge page has been opened in their browser, and still include the
truewith a note like "if it didn't open automatically, use this link".rechargeUrl - → tell the user the browser could not be opened automatically, and show the
falseso they can open it manually.rechargeUrl
In every case, show the 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.
rechargeUrlqianwen billing balance recharge仅在完成上述安全边界的确认步骤后才能执行此命令。
bash
qianwen billing balance recharge --format jsonJSON结构:
json
{
"rechargeUrl": "https://platform.qianwenai.com/home/billing/overview?target=recharge",
"opened": true,
"message": "Recharge page opened in browser"
}无论 值如何,始终向用户提供 。 标志仅反映CLI的浏览器启动命令是否成功返回,但成功启动并不保证浏览器窗口实际弹出。在沙盒或无头主机环境中(例如 Codex桌面应用、远程容器、CI),即使 报告为 ,浏览器通常也无法打开。因此绝不能仅依赖 来决定是否向用户提供链接。
openedrechargeUrlopenedopenedtrueopened解析 的值,但在两种情况下都展示链接:
opened- → 告知用户官方充值页面已在浏览器中打开,同时仍需包含
true,并附上说明如“若未自动打开,请使用此链接”。rechargeUrl - → 告知用户无法自动打开浏览器,并展示
false供用户手动打开。rechargeUrl
在任何情况下,都需严格按照CLI返回的内容展示 (绝不能构造或重写)。充值操作完全在该官方页面上完成;本技能的任务在提供入口(包括可复制的链接)后即结束。
rechargeUrlOutput and Agent Display Rules
输出与Agent展示规则
JSON is the primary output mode for agents — always pass explicitly, parse the structured response, then present a human-readable summary to the user.
--format jsonWhen using (recommended for agents):
--format json- Parse the JSON and extract the relevant data for the user's question
- Present a human-readable summary — do not dump raw JSON to the user
- Add analysis AFTER the summary — clearly separated with
---
When using :
--format text- Display CLI output EXACTLY AS-IS — no modification, no reformatting
- Preserve all formatting — alignment, spacing, separators
- Add analysis AFTER output only — clearly separated with
---
Never parse format programmatically — it contains ANSI codes and Unicode borders.
tableNEVER:
- ❌ 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当使用 (推荐Agent使用)时:
--format json- 解析JSON 并提取与用户问题相关的数据
- 呈现人类可读的摘要——请勿向用户输出原始JSON
- 在摘要后添加分析——用 清晰分隔
---
当使用 时:
--format text- 完全按原样显示CLI输出——不修改、不重新格式化
- 保留所有格式——对齐方式、空格、分隔符
- 仅在输出后添加分析——用 清晰分隔
---
绝不能以编程方式解析 格式——它包含ANSI代码和Unicode边框。
table绝对禁止:
- ❌ 向用户输出未经解释的原始JSON
- ❌ 重新格式化或总结文本/表格输出
- ❌ 添加类似“这是你的余额:”的前缀
- ❌ 将文本/表格输出转换为项目符号
- ❌ 编造或模拟值来填充缺失的真实结果
Result status mapping
结果状态映射
Report every operation with exactly one of these statuses:
| Status | When |
|---|---|
| Command succeeded and full data was parsed |
| Command succeeded but some fields are missing/ |
| Command succeeded but there is no data to show |
| Recharge requested but user confirmation not yet obtained |
| Command failed (see Error Handling below) |
Never substitute mock data for a real result under any status.
每个操作都必须报告以下状态之一:
| 状态 | 适用场景 |
|---|---|
| 命令执行成功且完整数据已解析 |
| 命令执行成功但部分字段缺失/为 |
| 命令执行成功但无数据可展示 |
| 用户请求充值但尚未获得确认 |
| 命令执行失败(请参见下方错误处理) |
在任何状态下,都绝不能用模拟数据替代真实结果。
Error Handling / Exit Codes
错误处理 / 退出码
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General/usage error |
| 2 | Authentication error |
| 3 | Network error |
| 4 | Configuration error |
| 130 | Interrupted |
- 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 () only. For the international site, use the qwencloud-payment skill instead. This skill does not include any international-site-specific commands such as or .
platform.qianwenai.compayment-methodbind本技能仅针对千问中国站点()。针对国际站点,请使用 qwencloud-payment 技能。本技能不包含任何国际站点特有的命令,如 或 。
platform.qianwenai.compayment-methodbind