A page that shows how many tokens each model has left across your accounts. It is estimated from magpie's quota windows (/v1/magpie/quotas) and past usage rounds: the median tokens per percent over the rounds that can be used, or one round, or "sparse". The report carries no prose. The page words everything in English or Chinese. The service binds only to loopback, checks the Host, refuses a foreign Origin, wants a per-run key for Origin null, serves index.html to navigations only, and writes nothing under HOME. page-model-quota 0.1.0.
Run at the reviewed head dd8d44164d505088efeb07d80784128134aad213, on the Windows box (mote's sshd was refusing connections):
- node --test test/*.test.mjs: 14 pass. bun test: 14 pass. bun scripts/check.mjs: exit 0. It merges cleanly with main 86d3febf.
- Broken by hand: taking the space out of " (from past rounds)" again turns i18n.test red (13 of 14).
At a5d9a8c5, on mote and in WSL (from the review): the Host, Origin, key and navigate-only checks each went red when broken. Wrong Hosts got 403, Origin null without a key got 401, traversal got 404, and a restart rotated the key. The page rendered in Chromium and WebKit at 1200px and 420px, with no Chinese in English. Since then, only the English note's space, an unused usableRounds, the English gateway error and template-literal coverage in the i18n test have changed.
Not tried: in a real magpie window with real quota windows.
70 lines
2.3 KiB
JSON
70 lines
2.3 KiB
JSON
{
|
|
"name": "@magpie-community/page-model-quota",
|
|
"version": "0.1.0",
|
|
"description": "把所有账号、所有供应商的额度窗口换算成 token,按模型合并估算还剩多少。A page in Magpie's window that estimates how many tokens each model has left, merged across every account and provider, from the local usage history.",
|
|
"type": "module",
|
|
"main": "./index.mjs",
|
|
"files": [
|
|
"index.mjs",
|
|
"serve.mjs",
|
|
"lib",
|
|
"page",
|
|
"ui",
|
|
"assets",
|
|
"LICENSE",
|
|
"README.md"
|
|
],
|
|
"scripts": {
|
|
"start": "node serve.mjs",
|
|
"test": "node --test test/*.test.mjs"
|
|
},
|
|
"engines": {
|
|
"magpie": ">=0.1.1340"
|
|
},
|
|
"keywords": [
|
|
"magpie",
|
|
"magpie-page",
|
|
"magpie-plugin",
|
|
"quota",
|
|
"usage",
|
|
"tokens",
|
|
"models"
|
|
],
|
|
"license": "MIT",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/magpie-community/plugins.git",
|
|
"directory": "packages/page-model-quota"
|
|
},
|
|
"homepage": "https://github.com/magpie-community/plugins/tree/main/packages/page-model-quota",
|
|
"bugs": {
|
|
"url": "https://github.com/magpie-community/plugins/issues"
|
|
},
|
|
"magpie": {
|
|
"name": "Model Quota",
|
|
"summary": {
|
|
"en": "How many tokens each model has left, merged across every account and provider: each quota window is turned into tokens from your own usage history and split by the model's share in it.",
|
|
"zh": "每个模型在所有账号、所有供应商的池子里还剩多少 token:用你自己的用量历史把每个额度窗口换算成 token,再按模型在窗口里的占比摊开。"
|
|
},
|
|
"page": {
|
|
"title": "Model Quota",
|
|
"titles": {
|
|
"en": "Model Quota",
|
|
"zh": "模型剩余额度",
|
|
"zh-TW": "模型剩餘額度"
|
|
},
|
|
"file": "page/index.html",
|
|
"icon": "page/icon.svg",
|
|
"service": {
|
|
"port": 3496,
|
|
"option": "port"
|
|
}
|
|
},
|
|
"options": {
|
|
"port": 3496
|
|
},
|
|
"permissions": [],
|
|
"icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCI+PHJlY3Qgd2lkdGg9IjY0IiBoZWlnaHQ9IjY0IiByeD0iMTQiIGZpbGw9IiMwZjE3MmEiLz48ZyBmaWxsPSJub25lIiBzdHJva2U9IiMzOGJkZjgiIHN0cm9rZS13aWR0aD0iNCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIj48cGF0aCBkPSJNMTQgMjJoMzZNMTQgMzJoMzZNMTQgNDJoMjIiLz48L2c+PC9zdmc+"
|
|
}
|
|
}
|