← Back to Skills Marketplace
jackwude

Bailian Usage

by jackwude · GitHub ↗ · v1.0.3 · MIT-0
cross-platform ✓ Security Clean
359
Downloads
0
Stars
1
Active Installs
4
Versions
Install in OpenClaw
/install bailian-usage
Description
查询阿里云百炼 Coding Plan 套餐状态、剩余额度、用量消耗及有效期信息,支持自动登录和数据提取。
README (SKILL.md)

bailian-usage Skill | 百炼用量查询

中文:自动查询阿里云百炼 Coding Plan 套餐用量、剩余额度、有效期信息,支持自动登录和数据提取。 English: Auto-query Alibaba Cloud Bailian Coding Plan usage, quota, and expiration. Supports automated login and data extraction.


模型配置 | Model Configuration

默认模型: qwen3.5-plus(如需更换,可在调用时通过 --model 参数指定)

触发条件 | Trigger Words

用户提到以下关键词时激活 | Activate when user mentions:

  • "查百炼套餐" / "Check Bailian package"
  • "百炼用量" / "Bailian usage"
  • "百炼额度" / "Bailian quota"
  • "阿里云百炼" / "Alibaba Cloud Bailian"
  • "Coding Plan"
  • "看看套餐情况" / "Check package status"

执行流程

主链路:openclaw browser tool + evaluate 直接提取

  1. 启动浏览器(如未运行)

    openclaw browser start
    
  2. 打开百炼控制台 → 导航到 https://bailian.console.aliyun.com/cn-beijing/?tab=coding-plan#/efm/detail

  3. 检查登录态 → 通过 aria snapshot 检查是否有邮箱、"主账号"等登录标识

  4. 必要时登录

    • 点击右上角"登录"按钮
    • 填写账号密码(从 TOOLS.md 读取)
    • 点击"立即登录"按钮
    • 等待登录完成并刷新页面
  5. 提取数据 → 用 evaluate 执行 JS 直接读取 DOM 文本

  6. 返回结果 → 格式化输出套餐信息

输出格式

## 📊 百炼 Coding Plan 套餐详情

**套餐状态:** ✅ 生效中 | 剩余 **xx 天**(YYYY-MM-DD 到期)  
**自动续费:** ❌ 未开启 / ✅ 已开启

**用量消耗:**
- 最后统计时间:YYYY-MM-DD HH:mm:ss
- 近 5 小时:**xx%**(YYYY-MM-DD HH:mm:ss **重置**)
- 近一周:**xx%**(YYYY-MM-DD HH:mm:ss **重置**)
- 近一月:**xx%**(YYYY-MM-DD HH:mm:ss **重置**)

**可用模型:** 千问系列 / 智谱 / Kimi / MiniMax

---

### 💡 用量分析
- ✅ 用量充足 / ⚠️ 用量紧张 / ❌ 用量不足
- 到期提醒(如适用)

登录流程详解

自动化登录(默认)

主链路:点击登录按钮 → 填写账号密码 → 点击立即登录

账号信息自动从 TOOLS.md 读取,无需用户干预。

账号信息存储在 TOOLS.md 中(示例):

## 🔐 阿里云百炼账号
- **网址**: https://bailian.console.aliyun.com/cn-beijing/?tab=coding-plan#/efm/index
- **账号**: [email protected]
- **密码**: your-password

⚠️ 注意: 请勿将真实账号密码提交到版本控制系统。此处的示例仅用于说明格式。

🔐 安全说明

  • 凭证存储:账号密码仅存储在用户本地 TOOLS.md 文件中,不提交到 Git/版本控制
  • 凭证使用:脚本读取凭证后仅在内存中使用,不在日志中输出或传输到外部
  • 浏览器会话:登录态保存在本地浏览器 Profile 中,不上传到任何服务器
  • 网络请求:所有请求直接发往 bailian.console.aliyun.com,无第三方中转

人工验证(备选)

如果自动登录触发滑块/短信验证:

  1. 脚本会提示"可能需要人工完成验证"
  2. 用户在浏览器窗口中完成验证
  3. 验证成功后,继续执行查询

数据提取逻辑(优化版 v2 - 2026-03-17)

使用 evaluate 执行 JS 直接读取 document.body.innerText,通过按行分割 + 精准定位提取:

核心改进

  1. 近 5 小时用量提取:放弃正则匹配,改用按行分割后查找

    • 原因:页面实际文本是"近 5 小时用量"(无空格),正则容易匹配失败
    • 方法:text.split('\ ') 后遍历,找到包含"5"+"小时"+"用量"的行
    • 结构:第 i 行=标签,第 i+1 行=重置时间,第 i+2 行=用量百分比
  2. 日志过滤:在 bash 中过滤 openclaw browser evaluate 的日志输出

    • grep -v '^\[' 过滤插件日志
    • grep -v '^🦞' 过滤浏览器状态
    • 确保 jq 能正确解析 JSON
  3. 其他用量:保持正则匹配(近一周/一月用量正则工作正常)

提取规则

  • 套餐状态:text.includes('生效中')
  • 剩余天数:/剩余天数 (\d+) 天/
  • 到期日期:/结束时间 (\d{4}-\d{2}-\d{2})/
  • 最后统计时间:/最后统计时间 (\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/
  • 近 5 小时用量:按行分割查找(核心优化)
  • 近一周/一月用量:正则匹配 /\w+ 用量 [\s\S]{0,150}?(\d+)%/

注意事项

  1. 每次直接登录 - 无 cookie 依赖,更简单可靠
  2. 高风控场景 - 若触发短信/滑块验证,需人工完成验证
  3. 用量刷新时间 - 可能滞后,以页面显示为准
  4. 浏览器管理 - 遵循省内存策略,主动关闭非必要 tab

快捷命令

  • "查百炼额度" → 调用本 Skill
  • "看看阿里云还剩多少额度" → 调用本 Skill
  • "百炼用量情况" → 调用本 Skill
  • "百炼 Token" → 调用本 Skill
  • "百炼套餐用量" → 调用本 Skill

边界说明

  • 本 Skill 只负责阿里云百炼 / Coding Plan / 套餐 / 额度 / 百炼 Token 相关查询。
  • 像"查 Token 用量""Token 消耗""过去 24 小时 Token 用量"这类未明确提到百炼的说法,不应由本 Skill 处理,应转交 token-usage-analysis

相关文件

  • Skill 目录: ~/.openclaw/workspace/skills/bailian-usage/
  • 脚本: ~/.openclaw/workspace/skills/bailian-usage/query_browser.sh
  • 账号信息: ~/.openclaw/workspace/TOOLS.md
Usage Guidance
This skill appears to do exactly what it says: control the OpenClaw browser, read a local TOOLS.md for an Alibaba Bailian account, perform an automated login if needed, and extract usage info from the console page. Before installing or using it, consider: (1) Storing plaintext credentials in TOOLS.md is risky—store the file with restrictive filesystem permissions (chmod 600) or use a more secure credential mechanism if available. (2) Inspect the included query_browser.sh yourself; running it will cause the agent to type your password into a browser session—only run if you trust the host and OpenClaw runtime. (3) If you prefer not to store credentials, use the manual login fallback described in SKILL.md. (4) Verify that the OpenClaw 'browser' tool runs locally (not on an untrusted remote environment) so credentials are not exposed remotely.
Capability Analysis
Type: OpenClaw Skill Name: bailian-usage Version: 1.0.3 The bailian-usage skill is a browser automation tool designed to check Alibaba Cloud Bailian service quotas. It reads user credentials from a local file (TOOLS.md), automates the login process on the official Alibaba Cloud console (bailian.console.aliyun.com), and extracts usage data via JavaScript execution in the browser. The code and instructions (SKILL.md, query_browser.sh) are consistent with the stated purpose, include explicit security declarations regarding credential handling, and show no evidence of data exfiltration, malicious intent, or unauthorized access.
Capability Assessment
Purpose & Capability
Name/description (query Bailian Coding Plan usage) match the included assets: SKILL.md, README, and query_browser.sh implement browser automation to open the Bailian console, check login, optionally login, and parse usage. No unrelated services, environment variables, or binaries are requested.
Instruction Scope
SKILL.md and query_browser.sh limit actions to starting the openclaw browser tool, navigating to the Bailian console, optionally auto-filling credentials from a local TOOLS.md, and extracting DOM text with evaluate. The instructions do read a local file (~/.openclaw/workspace/TOOLS.md) for credentials, which is necessary for automated login and is declared in the package metadata.
Install Mechanism
No install spec is present (instruction-only skill with an included shell script). Nothing is downloaded from external URLs or extracted to disk during install; risk from the install mechanism is low.
Credentials
The skill requests no environment variables and its only credential access is to a local TOOLS.md file holding an Alibaba account and password. This is proportionate for an automated login workflow, but storing plaintext credentials in a workspace file is inherently sensitive and increases risk if the host or workspace is compromised.
Persistence & Privilege
The skill is not declared always:true and does not modify other skills or system-wide configs. It reads and uses only its own workspace files and the browser profile; autonomous invocation is allowed by default (normal for skills).
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install bailian-usage
  3. After installation, invoke the skill by name or use /bailian-usage
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.3
Security hotfix: 确保 README.md 使用占位符,无真实凭证泄露
v1.0.2
Security: removed credential logging, added security declarations
v1.0.1
- Added English descriptions and trigger word translations to skill documentation for bilingual clarity. - Updated and clarified trigger keywords, now supporting both Chinese and English queries. - Improved document structure and section headers for better readability. - No code changes; documentation only.
v1.0.0
bailian-usage 1.0.0 – Initial release - Provides automated querying of Alibaba Cloud Bailian Coding Plan package usage and expiry details. - Supports browser automation for login and data extraction, including handling necessary authentication steps. - Offers formatted, Markdown-style output with status, consumption, expiry, and model availability. - Responds to multiple trigger keywords related to Bailian usage queries. - Reads login credentials from a local TOOLS.md file; supports manual intervention for captchas or SMS verification when needed.
Metadata
Slug bailian-usage
Version 1.0.3
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 4
Frequently Asked Questions

What is Bailian Usage?

查询阿里云百炼 Coding Plan 套餐状态、剩余额度、用量消耗及有效期信息,支持自动登录和数据提取。 It is an AI Agent Skill for Claude Code / OpenClaw, with 359 downloads so far.

How do I install Bailian Usage?

Run "/install bailian-usage" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Bailian Usage free?

Yes, Bailian Usage is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Bailian Usage support?

Bailian Usage is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Bailian Usage?

It is built and maintained by jackwude (@jackwude); the current version is v1.0.3.

💬 Comments