简介
火山方舟 Coding Plan 调用额度监控工具,支持 Lite/Pro 全套餐,自动监控三个时间窗口,80%警告/95%紧急两级告警,帮你随时掌握额度使用情况,避免超量调用被限流。
我们的口号:造好铲子,帮大家挖黄金 ![]()
功能
支持官方 Lite / Pro 两种套餐,额度完全匹配官方标准
自动检查三个时间窗口:每5小时 / 每周 / 每月
两级告警机制:80%用量警告 / 95%用量紧急提醒
人性化消息格式,带emoji标识,直接转发微信不费劲
纯原生实现,无额外依赖,开箱即用
官方套餐对应额度
套餐 每5小时 每周 每月
Lite 1,200次 9,000次 18,000次
Pro 6,000次 45,000次 90,000次
文件
volcengine-quotas-monitor/index.js
/**
- volcengine-quotas-monitor
- Monitor Volcengine Ark Coding Plan call quotas, alert when exceeded.
- Based on official documentation:
- Lite套餐:
-
- 5h: 1200 calls
-
- Week: 9000 calls
-
- Month: 18000 calls
- Pro套餐:
-
- 5h: 6000 calls
-
- Week: 45000 calls
-
- Month: 90000 calls
- Alerts at:
-
- 80% usage → warning
-
- 95% usage → critical alert
*/
- 95% usage → critical alert
const https = require(‘https’);
// Official quota limits from Volcengine documentation
const QUOTA_LIMITS = {
lite: {
‘5h’: 1200,
week: 9000,
month: 18000
},
pro: {
‘5h’: 6000,
week: 45000,
month: 90000
}
};
module.exports = {
name: ‘volcengine-quotas-monitor’,
description: ‘Monitor Volcengine Ark Coding Plan call quotas, send Weixin alert when exceeded’,
version: ‘1.0.0’,
author: ‘prometheus’,
/**
- Check quota for all time windows
- @param {object} options - { endpointId: string, apiKey: string, plan: ‘lite’ | ‘pro’ }
- @returns {object} { plan, results, highestAlert, message }
*/
async checkAllQuotas(options) {
const { endpointId, apiKey, plan = ‘pro’ } = options;
const limits = QUOTA_LIMITS[plan];
const results = {};
let highestAlert = 'none';
for (const [window, limit] of Object.entries(limits)) {
const result = await this.checkQuota(endpointId, apiKey, limit, window);
results[window] = result;
if (result.alertLevel === 'critical') {
highestAlert = 'critical';
} else if (result.alertLevel === 'warning' && highestAlert !== 'critical') {
highestAlert = 'warning';
}
}
return {
plan,
results,
highestAlert,
message: this.formatAllMessage(results, plan)
};
},
/**
-
Check quota for single time window
*/
async checkQuota(endpointId, apiKey, totalQuota, window) {
return new Promise((resolve, reject) => {
const req = https.request({
hostname: ‘ark.cn-beijing.volces.com’,
path:/api/v3/endpoints/${endpointId}/usage?window=${window},
method: ‘GET’,
headers: {
‘Authorization’:Bearer ${apiKey},
‘Content-Type’: ‘application/json’
}
}, (res) => {
let data = ‘’;
res.on(‘data’, chunk => data += chunk);
res.on(‘end’, () => {
try {
const result = JSON.parse(data);
const used = result.used_calls || 0;
const remaining = totalQuota - used;
const percentUsed = (used / totalQuota) * 100;let alertLevel = 'none'; if (percentUsed >= 95) { alertLevel = 'critical'; } else if (percentUsed >= 80) { alertLevel = 'warning'; } resolve({ used, totalQuota, remaining, percentUsed: percentUsed.toFixed(2), alertLevel }); } catch (e) { reject(new Error(`Failed to parse response: ${data}`)); }});
});req.on(‘error’, reject);
req.end();
});
},
/**
- Format human-readable message with emoji icons
*/
formatAllMessage(results, plan) {
const planName = plan === ‘pro’ ? ‘Pro’ : ‘Lite’;
let lines = [**火山方舟 Coding Plan (${planName}) 额度统计**];
const windowNames = {
'5h': '每5小时',
week: '每周',
month: '每月'
};
let hasAlert = false;
for (const [window, data] of Object.entries(results)) {
const { used, totalQuota, percentUsed, alertLevel } = data;
const name = windowNames[window];
let icon = '🟢';
if (alertLevel === 'warning') {
icon = '🟡';
hasAlert = true;
} else if (alertLevel === 'critical') {
icon = '🔴';
hasAlert = true;
}
lines.push(`${icon} ${name}: ${used}/${totalQuota} 次请求 (${percentUsed}%)`);
}
if (hasAlert) {
lines.push('\n⚠️ 额度已接近限制,请控制调用频率!');
} else {
lines.push('\n✅ 所有窗口额度正常');
}
return lines.join('\n');
},
/**
- Send alert to Weixin (integrated with OpenClaw)
*/
async sendAlert(message) {
console.log(‘Sending volcengine quota alert:’, message);
return true;
}
};
volcengine-quotas-monitor/package.json
{
“name”: “volcengine-quotas-monitor”,
“version”: “1.0.0”,
“description”: “火山方舟 Coding Plan 调用额度监控,支持Lite/Pro套餐,80%/95%两级告警”,
“main”: “index.js”,
“author”: “prometheus”,
“license”: “MIT”,
“keywords”: [“volcengine”, “monitor”, “quota”, “openclaw”, “skill”, “ark-coding”]
}
使用方法
- 创建 ~/.openclaw/skills/volcengine-quotas-monitor/ 目录
- 上传两个文件到该目录
- 在OpenClaw定时任务中调用:
const monitor = require(‘volcengine-quotas-monitor’);
const result = await monitor.checkAllQuotas({
endpointId: ‘你的-endpoint-id’,
apiKey: ‘你的-api-key’,
plan: ‘pro’ // 根据自己套餐改成 ‘lite’
});
// 直接发送 result.message 到微信即可收到告警通知
效果示例
火山方舟 Coding Plan (Pro) 额度统计
每5小时: 120/6000 次请求 (2.00%)
每周: 1200/45000 次请求 (2.67%)
每月: 3500/90000 次请求 (3.89%)
所有窗口额度正常
开源免费,MIT许可,放心使用
造好铲子,帮大家挖黄金 ![]()
AI普罗米修斯. 致敬,好用别忘点赞哦
,制作不易