A single-page dashboard that aggregates the coding-plan quotas of multiple AI providers (Codex, Claude OAuth, MiniMax, Volcengine AgentPlan / CodingPlan, Kimi Code, LongCat, Qianwen AI, Zhipu AI CodingPlan and Google AI model quotas) into one self-hosted UI. Each provider supports multiple accounts with independent labels.
一个部署在局域网中的 Coding Plan 配额看板,支持 Codex、Claude OAuth、MiniMax、火山方舟 CodingPlan / AgentPlan、Kimi Code、LongCat、千问 AI、智谱 AI CodingPlan 和 Google AI 模型额度。支持同一平台 多账号,每个账号可添加备注。Google AI 仅显示接口实际返回的额度:Gemini Models 的 5 小时和周额度; 支持 Argon 的账号将 Argon 周额度置于首位,并同时显示返回的 Argon 5 小时额度、Gemini 窗口和 当前可用模型(包括 Gemini、Claude、GPT)的独立用量,名称随接口返回更新。
- Auto-detects the data source from the imported raw
curlURL — no manual selection needed. / 根据原始curlURL 自动识别数据来源,不需要手工选择产品。 - The server re-executes saved requests on page open, manual refresh, or auto refresh; results are persisted as JSON on the host so they survive container restarts. An open page auto-refreshes every 5 minutes and stops after 99 automatic refreshes; reload the page to start counting again. / 页面打开、刷新或点击刷新按钮时由服务器重新执行已保存的请求;配额结果保存到服务器端 JSON 文件,容器重启后自动恢复。页面保持打开时每 5 分钟自动刷新一次,最多自动刷新 99 次,重新打开页面后重新计数。
- First paint shows the cached snapshot then silently refreshes to the latest data; successful refreshes do not pop up any dialog. Accounts are queried concurrently (up to 8 at a time) and each card updates as soon as its own result returns. / 各账号并发查询(最多 8 个同时进行),哪个账号先返回就先更新哪张卡片。
- Five built-in visual themes (Aurora, Ocean, Forest, Sunset and Paper), each with Light / Dark modes. The selected theme and mode are saved in browser local storage; the appearance controls are available after unlocking the page.
- Multi-account support: each imported curl is stored as a separate account with its own ID, label, edit, delete (with double confirm), and reorder controls. After unlocking, ▲ / ▼ swaps a card with the adjacent visible card, skipping hidden accounts and credit entries merged into another card. Their positions in the complete saved order are retained. Boundary buttons and buttons awaiting a save are disabled; failed saves restore the previous order and show an error. Successful changes are persisted on the server and survive page reloads. / 解锁后点击 ▲ / ▼ 与相邻可见卡片交换位置,跳过隐藏账号及已合并的重置卡条目;完整 顺序仍保留这些条目的位置。边界或保存期间按钮禁用,保存失败会恢复原顺序并提示,成功后 刷新页面仍保留顺序。
- Any quota card can be hidden from the dashboard via its 隐藏 button. Hidden
accounts are listed in the 已隐藏账号 panel, sorted by provider channel so that all
accounts of the same channel (for example 火山方舟 CodingPlan / AgentPlan, or the Codex
sources) stay together; channels follow the card order and accounts inside a channel
keep their card order. Each row also shows the longest quota period as text (e.g.
周已用 / 月已用 / 订阅已用 + 百分比 + 剩余时间, using the same calculation as the
card summary) with a mini progress bar in the same bar style as the cards next to the
percentage; labels, percentage with bar and countdown share one line in fixed-width
columns and line up vertically across rows without increasing row height. Plan labels
use compact names such as Code, Gemini, Argon and OAuth; model fallback rows show 模型已用.
Hover over either label to see its full plan or quota/model name. Accounts can
be restored through the full account list
or the per-row 恢复显示 button. The hidden list is persisted in
/data/hidden.json(separate from the display order) and is cleaned up automatically when an account is deleted; hidden cards are still refreshed by the server. / 每张卡片可点击 隐藏 从面板中收起。已隐藏账号 面板按渠道分组排序,同一渠道的多个 账号相邻展示(渠道顺序跟随卡片顺序,渠道内保持卡片顺序);每行以文字显示该账号最长周期的 额度已使用百分比与剩余时间(区分周额度 / 月额度 / 订阅额度等,口径与卡片汇总一致),百分比 旁附带与卡片同风格的迷你进度条;周期名、百分比+进度条、剩余时间同一行分三列固定宽度、上下 对齐,且不增加行高。列表中使用「Code」「Gemini」「订阅已用」「模型已用」等短标签,悬停可查看 完整方案、周期或模型名称。可通过全量账号列表或行内 恢复显示 按钮恢复。 隐藏列表独立持久化到服务器/data/hidden.json,删除账号时自动清理,且被隐藏的账号仍会正常 刷新数据。 - Existing Kimi accounts can update request verification headers from a fresh
GetSubscriptionStatscurl without replacing the saved URL, body, or account. - Existing Kimi accounts can save a complete
RefreshTokendirectly; every quota refresh then exchanges the stored token before callingGetSubscriptionStats, and persists rotated access / refresh tokens plus response cookies when provided. - Existing MiniMax accounts can update verification headers from a fresh
token_plan/remains_percentcurl while preserving the account and request body. Bothwww.minimaxi.comandwww.minimax.cnare supported, including header updates copied from the other domain for the same endpoint; the saved URL stays unchanged. A MiniMax weekly window is treated as unavailable when the provider reports no positive weekly total or a non-active weekly status (e.g. plans without a weekly cap); quota summaries — including the hidden-account list — then fall back to the five-hour window instead of showing an empty 周额度. / MiniMax 账号在接口未返回有效周限额(周总量缺失/为 0 或周状态非生效)时视为无周限额, 额度汇总(含已隐藏账号列表)回退显示 5 小时窗口,而不是虚假的“周额度已使用 0%”。 - Qianwen AI TokenPlan displays only the quota windows the endpoint actually returns
(
per5HourPercentage,per1WeekPercentage,per1MonthPercentage). The provider dropped the weekly cap and kept a single monthly one, so such accounts now show 月额度 instead of an empty 周额度; the monthly window is the longest period and drives the card and hidden-account summary. Legacy responses that still carry a weekly window keep showing it. / 千问 AI TokenPlan 仅展示接口实际返回的额度窗口(5 小时 / 周 / 月)。官方已取消周限额、 仅保留月限额,此类账号现显示“月额度”,不再出现空的“周额度”;月额度同时作为最长周期用于 卡片与已隐藏账号汇总。仍返回周限额的旧接口数据保持原样显示。 - Existing Qianwen accounts can renew their browser login through 更新 Token / Cookie.
Paste a fresh complete usage curl to update Cookie / verification headers and the
form's
sec_token, preserving the account ID, label, URL and other request data. Only that account is refreshed after saving; failed refreshes retain its last successful cache. / 千问账号支持原地更新登录凭据;BailianGateway.Login.NotLogined会显示登录失效提示和修复指引。 - Refresh failures, including supported provider business errors returned with HTTP 200, keep the last successful cached result visible with an error notice.
- Claude OAuth accounts are synchronized from an operator-configured CLIProxyAPI server. Cards show five-hour, weekly and any returned model-specific weekly utilization, remaining percentages and reset countdowns. Missing windows and reset times stay unavailable. OAuth credentials remain in CLIProxyAPI; the dashboard stores only a hashed account reference and quota data. / 支持从 CLIProxyAPI 同步 Claude OAuth 账号,显示 5 小时、周额度以及接口实际返回的 模型专属周额度;管理密钥仅配置在服务端,不向浏览器返回或复制 OAuth Token。
- Per-account Volcengine AK/SK configuration (no curl required); uses HMAC-SHA256 V4
signing against
GetCodingPlanUsage/GetAgentPlanAFPUsage. - Codex supports both the official
/usage+/rate-limit-reset-creditsendpoints and a NewAPI replacement (/api/channel/{channelId}/codex/usage[/reset-credits]). The server merges them into a single Codex card and skips the official requests when a NewAPI variant is configured. - All progress bars show two-decimal usage percentage; each card shows a live countdown to the next reset. Reset dates are shown when at least one day remains; shorter waits show only the countdown. A normalized zero quota limit is displayed as 已过期; authentication failures are reported separately.
- Self-contained single-file browser UI (
index.html) with a custom SVG logo and no external favicon dependency. - Responsive layout: below 1100px each hidden-account row stacks into a name/plan row
plus a quota row, keeping the full period label (周额度 / 月额度 …) readable instead of
ellipsised, and the countdown wraps when it does not fit. Desktop keeps the aligned
single-line columns. Long inline
<code>paths wrap rather than forcing horizontal page scroll on narrow phones. / 响应式布局:窄于 1100px 时,隐藏账号行堆叠为“账号/套餐”一行加“额度”一行,完整保留 周额度 / 月额度等周期名(不再被省略号截断),剩余时间在放不下时自动换行;桌面端维持单行 对齐列。长<code>路径可换行,避免手机上出现横向滚动。 - In the hidden-account list, Google AI accounts with Argon show the ordinary Gemini weekly usage and its reset time as 周额度已用. If that weekly bucket is missing, the row shows unavailable data. Google accounts without Argon appear only in the restore dropdown, where they can still be restored normally. / 已隐藏的 Google AI 账号中,支持 Argon 的账号显示 Gemini 通用模型的“周额度已用” 及对应重置时间;缺少该周额度时显示暂无数据。不支持 Argon 的 Google 账号仅保留在 恢复显示的下拉列表中。
index.html Single-file frontend
server.py Static file serving + JSON persistence + restricted curl execution
parser.js Parser implementation used by Node tests
docker-compose.yml Container deployment configuration
.github/workflows/ GitHub Actions validation (parser and server checks)
scripts/ Local helper scripts (no credentials)
tests/ Parser and server unit tests
AGENTS.md Coding-agent instructions for this repository
- Linux host / NAS with Docker Engine and Docker Compose v2.
- The host must be able to reach the APIs for the providers you import, including
Zhipu AI at
www.bigmodel.cn. - If you import a Codex curl with
--proxy, the proxy must be reachable from the Docker host. - Default listen port is
8080; changePORTindocker-compose.ymlif occupied.
sudo mkdir -p /docker/coding_plan_quota_dashboard/data
sudo chmod 700 /docker/coding_plan_quota_dashboard/data
sudo cp index.html server.py docker-compose.yml /docker/coding_plan_quota_dashboard/cd /docker/coding_plan_quota_dashboard
sudo docker compose up -d
sudo docker compose ps
sudo docker logs --tail=100 coding-plan-quota-dashboard
curl -fsS -o /dev/null -w 'HTTP %{http_code}\n' http://127.0.0.1:8080/In Portainer choose the target endpoint, Stacks → Add stack, name it
coding-plan-quota-dashboard, paste the contents of docker-compose.yml and click
Deploy the stack. Because Portainer uses host bind mounts, index.html,
server.py and an empty data/ directory must already exist on the host.
sudo cp index.html /docker/coding_plan_quota_dashboard/index.html
sudo cp server.py /docker/coding_plan_quota_dashboard/server.py
sudo docker restart coding-plan-quota-dashboardFor Compose-level changes use Portainer's Update the stack, or:
cd /docker/coding_plan_quota_dashboard
sudo docker compose up -d --force-recreate.github/workflows/test.yml runs the parser tests
(Parser (Node)) and the server test suite plus a compile check (Server (Python))
on pushes and pull requests targeting main / master, using Node.js 22 and
Python 3.13. Both checks are required before main is updated.
/docker/coding_plan_quota_dashboard/data/requests.json # per-account curl, AK/SK and refresh tokens
/docker/coding_plan_quota_dashboard/data/credentials.json # legacy provider credentials
/docker/coding_plan_quota_dashboard/data/snapshot.json # latest quota snapshot
/docker/coding_plan_quota_dashboard/data/results.json # per-account cached API responses
/docker/coding_plan_quota_dashboard/data/order.json # account display order
/docker/coding_plan_quota_dashboard/data/hidden.json # account ids hidden from the dashboard
Backup:
sudo tar -czf "coding_plan_quota_dashboard-data-$(date +%Y%m%d-%H%M%S).tar.gz" \
-C /docker/coding_plan_quota_dashboard dataRestore:
cd /docker/coding_plan_quota_dashboard
sudo docker compose down
sudo tar -xzf coding_plan_quota_dashboard-data-YYYYMMDD-HHMMSS.tar.gz
sudo docker compose up -dTreat the entire data directory and its backups as sensitive: requests and credentials contain secrets, while snapshots and API responses can contain account information. Do not commit or publish them.
Paste the full raw curl in the page and click 保存 curl 并刷新. The server
auto-classifies by URL:
chatgpt.com/backend-api/wham/usage→ Codex usagechatgpt.com/backend-api/wham/rate-limit-reset-credits→ Codex reset credits<newapi-host>/api/channel/{channelId}/codex/usage→ NewAPI Codex usage<newapi-host>/api/channel/{channelId}/codex/usage/reset-credits→ NewAPI Codex reset creditswww.minimaxi.com/www.minimax.cn→ MiniMaxGetCodingPlanUsage→ Volcengine CodingPlanGetAgentPlanAFPUsage→ Volcengine AgentPlan (current endpoint)GetAgentPlanUsageDetails→ Volcengine AgentPlan (legacy endpoint, still supported)www.kimi.com/.../GetSubscriptionStats→ Kimi Codelongcat.chat/api/pay/quota/metering/token-packs/summary→ LongCatcs-data.qianwenai.com/.../data/api.json(containstokenplan) → Qianwen AI TokenPlanwww.bigmodel.cn/api/monitor/usage/quota/limit→ Zhipu AI CodingPlan
Google AI uses the dedicated account form, not curl auto-detection. Unlock the page,
add an OAuth Refresh Token and an optional proxy, and configure GOOGLE_AI_CLIENTS
on the server (see Security Notes). The server first checks fetchAvailableModels
across its configured Google endpoints, then combines the available model catalog
with retrieveUserQuotaSummary quota groups.
Google filters these responses using client metadata. The default request profile
matches Antigravity CLI 1.4.6, including its released build (cl=1000353293) and
consumer authentication marker. Older client identifiers can return a legacy model
catalog that omits Argon and its weekly quota even for an eligible account. Set the
optional server-side GOOGLE_AI_USER_AGENT environment variable to override this
profile after a future client-protocol change; an empty value keeps the default.
Compose reads it from the shell / .env; an existing Portainer Stack can set it in
its environment without changing any saved account credentials.
The official upstream spelling is Argon, with IDs such as
gemini-4-argon-high, gemini-4-argon-medium and gemini-4-argon-low.
The older Agron spelling is still accepted for compatibility. If an enabled,
available model's ID, display name or model enum identifies Argon, that account uses
Argon as its primary quota and compact plan/Code-column label.
The GEMINI 4 ARGON weekly bucket is shown first in the account details and supplies
the main percentage and countdown, even if another window's usage is higher.
Any explicitly returned Argon 5-hour window and ordinary Gemini 5-hour and weekly
windows are displayed alongside it, with independent percentages and reset times.
The current model quotas are listed separately below these windows and never supply
the Argon reading. The server checks the remaining summary
hosts when one response has Argon quota but omits the Gemini windows, and combines
the explicitly returned windows. Duplicate readings retain the lower remaining quota.
Other models' quota and Claude/GPT weekly buckets cannot supply an Argon reading. An Argon summary
alone does not establish availability: the account must also list Argon in models.
Disabled or explicitly unavailable Argon entries do not trigger the switch.
If the Argon weekly bucket is missing, its primary reading uses the explicit Argon 5-hour or per-model quota that Google returns; never invent a weekly limit or reset time. Per-model data is labelled as a model quota with an unknown period. If no usable Argon quota exists, the refresh fails and preserves the previous successful cache.
Google AI details show only quota that the API returned. A missing or invalid Gemini · 5小时 or Gemini · 周额度 window has no row, and no placeholder percentage or countdown is shown. A Claude/GPT window or a model quota whose period is unknown cannot fill these windows.
Accounts without Argon keep the Gemini Models summary behavior. If that group is
unavailable, per-model data comes from models[id].quotaInfo or
retrieveUserQuota (buckets[].modelId), retaining loadCodeAssist as a legacy fallback.
The fallback prefers the newest available Gemini version in the returned model IDs,
comparing version components numerically (for example, 3.10 follows 3.9). Within a
version, unqualified IDs precede -tiered and -high / -medium / -low variants,
with model-ID order breaking ties. Disabled, unavailable and internal models are
excluded. The choice does not depend on which model has the most quota remaining.
Every successful Google AI refresh also rebuilds 当前模型用量 from the current
catalog and any per-model buckets. It includes public, enabled Gemini, Claude, GPT
and other named models with a valid quota, using the returned displayName when
present and the actual model ID otherwise. Models are grouped by family and sorted
by numeric version, newest first. Each row shows that model's own used/remaining
percentage and reported reset time; matching names do not imply a shared quota pool.
Repeated readings for the same model ID retain the lower remaining quota. Internal
chat/tab entries and models without a valid remainingFraction have no row. A new
refresh removes models that are no longer returned. These detail rows do not replace
the primary Gemini/Argon summary or supply missing 5-hour/weekly windows.
The model fallback displays the actual selected model ID, its remaining/used percentage and the reset time reported by Google. It does not label an unknown period as 5-hour or weekly, infer shared quota pools, or invent missing reset times. Zero remaining is valid. Missing or invalid Gemini quota is a refresh failure that preserves the last successful cache; it is never displayed as 100% remaining. Summaries containing only Claude/GPT buckets are not Gemini quota.
Set CLIPROXYAPI_BASE_URL (for example http://cliproxy.example.lan:8317)
and CLIPROXYAPI_MANAGEMENT_KEY in the deployment environment. The base URL must
be an HTTP(S) origin without a path or embedded credentials. The Compose file
reads both variables from the shell / .env; Portainer deployments can supply
them as Stack environment variables. Keep the real values outside the repository.
The dashboard host must be able to reach that management endpoint, and CLIProxyAPI
must already contain an enabled Claude OAuth account.
Unlock the dashboard and click 同步 Claude 账号并刷新. POST /api/claude/accounts
adds enabled Claude OAuth accounts without duplicating existing entries, changing
their labels or removing other accounts. Repeated syncs preserve order and hidden
state. Editing a Claude label also preserves its account binding. Claude cards and
account lists display only the first five characters of the label; the full label
remains saved on the server. New accounts
are appended; they do not replace existing provider accounts.
The backend reads /v0/management/auth-files, resolves each saved account to its
current auth_index, then calls /v0/management/api-call with a fixed
GET https://api.anthropic.com/api/oauth/usage request and the Bearer $TOKEN$
placeholder. CLIProxyAPI supplies the OAuth token; access and refresh tokens are
never downloaded or stored by this integration. If authentication expires,
reauthenticate in CLIProxyAPI and sync again. Both the management HTTP status and
the nested upstream status_code are checked. Provider errors or missing quota
windows retain the last successful cache. A 100% utilization reading is valid
exhausted quota, not proof of expired authentication.
Claude utilization is already a percentage, so 2 means 2% used / 98% remaining.
Only returned five-hour, overall weekly, Opus / Sonnet / OAuth-app / Cowork weekly
windows with valid utilization are displayed. Null windows and missing reset times
are not fabricated. Response headers, unrelated billing data and disabled extra
usage are not cached or displayed.
服务端配置 CLIProxyAPI 地址及管理密钥后,解锁页面并同步 Claude 账号即可,无需抓取或粘贴 OAuth Token。同步只追加新账号,保留已有账号、备注、排序和隐藏状态;刷新失败继续展示成功缓存。 请保护管理端口及密钥,使用 HTTPS 或受信任的内网连接。此集成不扩大导入 cURL 的域名白名单。
GET /api/summary returns the headline quota of each visible account, ordered like
the page and computed with the same rules as the card headline (longest available
period, status thresholds 90% / 100%). Hidden accounts and codexNewApiCredits
are skipped; the Codex reset-card count is merged into its NewAPI account.
{"total": 1, "ok": 1, "warn": 0, "bad": 0, "updatedAt": "2026-01-01T00:00:00+00:00",
"accounts": [{"id": "acc_alpha", "name": "Kimi", "provider": "Kimi", "source": "kimi",
"usedPercent": 40.0, "remainingPercent": 60.0, "period": "周额度",
"resetAt": "2026-01-05T00:00:00+00:00", "resetCards": null, "status": "已同步",
"level": "ok", "refreshOk": true, "updatedAt": "2026-01-01T00:00:00+00:00"}]}The response contains no curl text, tokens or raw provider responses, so it is the
endpoint to poll from Home Assistant rest sensors. It reads the cached snapshot:
quotas are re-parsed only while a dashboard page is open (manual or automatic
refresh), so check updatedAt for staleness.
只读汇总接口 GET /api/summary 按页面顺序返回可见账号的主额度、状态与重置时间,
不含 cURL、Token 或原始响应,可供 Home Assistant 等家庭面板轮询。数据来自最近一次页面刷新的快照。
POST /api/agy/quotas queries the current Google AI quota for the supplied
accountIds (1–20 IDs). It returns {"ok": true, "accounts": {"acc_alpha": {"ok": true, "status": 200, "updatedAt": "...", "fiveHour": {"remainingPercent": 80, "resetAt": null}, "weekly": null}}}. The top-level
ok means at least one requested account succeeded; always check each account's
ok field. Only Gemini Models buckets are included. Missing 5-hour data is a
query failure; absent weekly quota or reset times remain null. Exhausted quota
is valid data and does not imply expired authentication. Failures return a
generic error without provider bodies or credentials.
Some accounts are not granted the Gemini Models group and only expose a
per-model quota. Those still report ok: false because they have no explicit
5-hour/weekly window, but the response now carries the model value so callers
can use it explicitly:
{"ok": false, "fiveHour": null, "weekly": null,
"fallback": {"modelId": "gemini-3.8-flash-tiered",
"remainingPercent": 99.9,
"resetAt": "2026-11-14T03:12:29Z"}}fallback is null when no usable model quota exists. It reports a different
and narrower unit than the group windows, so it is never mixed into the same
comparison as fiveHour/weekly.
This endpoint queries only the requested Google AI accounts concurrently (up to five workers, with a 45-second query budget per account). It does not refresh other providers or write requests, cached results, snapshots, ordering, or hidden accounts. It uses the existing server-side Google OAuth clients and proxy. Like the other dashboard APIs, it requires trusted-network access or external authentication; the UI lock does not protect it.
scripts/agy_quota_rotate.py integrates with an
existing local ~/bin/agy-switch installation. Copy it to the script path used
by your existing rotation LaunchAgent. Copy
the example configuration to
~/.gemini/agy-switch/quota-rotation.json (mode 0600), set dashboardUrl, and
map every local profile alias to its verified dashboard Google AI account ID.
Verify the actual OAuth identity when creating the mapping; display labels can
differ from aliases. Aliases for the same account should use the same ID. Keep
the real URL, account IDs, and credentials out of the repository.
An optional identityHashes object maps aliases to SHA-256 hashes of the verified
Google OAuth sub claim. A profile whose current identity differs is skipped
until its saved login is updated, so a pending login change cannot select the
wrong identity using another account's quota. This gate also applies to fallback:
if the hourly target has a different identity, the run fails without switching.
Set the rotation LaunchAgent's StartCalendarInterval to six minute entries:
0, 10, 20, 30, 40, 50. The script scores each account using
min(fiveHour.remainingPercent, weekly.remainingPercent) and selects the highest
score.
Accounts without the Gemini Models group fall back to the model value the
dashboard reports (fallback.remainingPercent). The fallback is applied per
account: an account the dashboard reports as successful still has to supply both
explicit windows, so a missing or stale window stays a failure for that account.
The per-model value describes that account's own pool, so all accounts remain
comparable and rotation can move to the account with the most headroom. Set
modelFallback: false in the configuration to ignore model-only accounts.
When fewer than two accounts are usable, or the dashboard query fails, the script
records a streak in ~/.local/state/agy-rotation-alert.json. Logs show
DEGRADED runs=N/threshold until alertAfterRuns (default 3) consecutive runs
are unhealthy, then emit ALERT at most once per hour. Any healthy run clears
the streak. Equal scores prefer the account whose next reported reset occurs soonest,
using the earlier of its 5-hour and weekly reset times. If reset times also tie,
the current profile is retained. Missing or invalid reset times stay unknown and
sort after known times; an elapsed reported reset is due (zero seconds), but does
not cause the script to assume the quota has replenished.
Both Gemini windows constrain usage:
an account with 90% left over 5 hours but only 5% left this week scores 5%, while
one with 30% left over 5 hours and 80% left this week scores 30%. This matches the
dashboard's headline remaining percentage. Either missing window makes that
account unavailable for selection; no full quota is assumed. A successful zero
reading does not trigger fallback. Individual failed queries are skipped if other
accounts succeed. If the dashboard request fails or no valid fresh quota for both
windows is returned, the original selection profiles[current_hour % len(profiles)]
is used; the target remains the same throughout that hour.
Responses older than two minutes or more than 30 seconds in the future are
rejected. Invalid local configuration fails without changing the account.
The script shares agy-switch's account lock, skips a busy lock, preserves
interrupted keepalive recovery, verifies Keychain and the token file, and probes
agy models before reporting success. Switching or probe failures do not trigger
hourly fallback. Existing account guards and keepalive tasks should retain the
same lock; schedule keepalive a few minutes away from the rotation triggers.
For Zhipu AI CodingPlan, the two TOKENS_LIMIT entries are distinguished by their
window metadata and displayed separately as 5-hour Token and weekly quota; their
nextResetTime values drive the countdown. TIME_LIMIT is displayed as MCP monthly
quota. Paste the complete browser-copied curl; the existing restricted parser handles
its authorization headers and cookies without spawning a shell.
To repair an expired Kimi verification request, unlock the page, click 更新验证头
on the existing Kimi card, then paste a fresh browser-copied GetSubscriptionStats
curl. The server validates the same Kimi endpoint and merges only its request headers;
the saved account ID, URL, request body, and cached result remain unchanged until refresh.
To enable automatic Kimi token renewal, unlock the page, click 设置 RefreshToken
or 更新 RefreshToken on the Kimi card, then paste the complete RefreshToken JWT
directly. The server stores only the token and required request headers, and never
returns those fields from /api/requests. Device, session, and traffic headers are
derived from available JWT claims and override corresponding saved header values. Each refresh
exchanges the token first, updates the saved Authorization header, synchronizes
Kimi device headers, and merges any Set-Cookie response into the subscription request.
The legacy full RefreshToken cURL API remains accepted for existing configurations.
To update MiniMax authentication, unlock the page, click 更新验证头 on its card,
and paste a fresh browser-copied token_plan/remains_percent curl. Cookie and other
verification headers are merged into the saved request; the URL, body and account
ID are preserved. Requests copied from either www.minimaxi.com or www.minimax.cn
can update an account on the other domain when the scheme, port and path match.
HTTP 200 with a nonzero base_resp.status_code is treated as a
failed refresh. A 100% usage reading alone does not prove authentication has expired.
MiniMax 验证信息失效时,可在账号卡片中点击 更新验证头,粘贴浏览器新复制的完整
cURL,再保存并刷新。支持旧域名 www.minimaxi.com 和新域名 www.minimax.cn;
同一接口可跨这两个域名更新验证头,保留原 URL、请求体和账号 ID。
刷新失败时保留上次成功的数据,并显示错误提示。
To repair Qianwen BailianGateway.Login.NotLogined, sign in to the Qianwen
console again and open the Token Plan usage page. In the browser's Network panel,
find the data/api.json request whose api query parameter contains tokenplan
and ends in /usage, and choose Copy as cURL (bash). Unlock the dashboard,
click 更新 Token / Cookie on the existing Qianwen card, paste the complete curl,
and click 保存并刷新. This console endpoint uses a browser login Cookie and a
form sec_token; a model API Key does not replace them. This feature updates an
existing session manually; it does not provide automatic OAuth / RefreshToken renewal.
The backend validates the same host, port, path and product / action / api
routing parameters, merges request headers and updates only sec_token in the
saved form body. Other request data, labels, account ordering, hidden state and
other accounts are preserved. When the saved form contains sec_token, a new
curl without it is rejected to avoid keeping a stale token alongside fresh cookies.
千问提示未登录时,请重新登录控制台,打开 Token Plan 用量页,从 Network 复制完整的
用量查询 cURL(bash 格式),再在原账号卡片中更新。不要重新添加账号,也不要只填 API Key。
保存后仅刷新当前千问账号。POST /api/refresh 可选传入
{"accountIds":["acc_example"]}(1–20 个已保存账号 ID)进行定向刷新;不传时仍刷新全部账号。
传入 "stream":true 时以 NDJSON 逐行返回 {"id":...,"ok":...},每个账号完成即输出一行;
不传时返回包含全部账号结果的 JSON 对象。
HTTP 200 中的登录业务错误仍视为失败并保留上次成功缓存,额度耗尽本身不代表登录失效。
Codex official and NewAPI endpoints can coexist; the server merges them into one
card. curl -sS, --proxy and --insecure flags are translated into Python HTTPS
requests — the server never spawns a shell to run curl.
If /usage returns secondary_window: null, the page keeps the 5-hour row visible
and shows "接口未返回" instead of fabricating usage.
- The server does not shell out; imported curl is parsed and re-issued via Python
urllib-style HTTPS requests. - The host allowlist defaults to
chatgpt.com,www.minimaxi.com,www.minimax.cn,console.volcengine.com,www.kimi.com,auth.kimi.com,longcat.chat,cs-data.qianwenai.com, andwww.bigmodel.cn; additional NewAPI hosts can be enabled via theNEWAPI_HOSTS(comma-separated) environment variable and are accepted only for the Codex/usageand/usage/reset-creditspaths. - Google AI uses OAuth client pairs loaded from the
GOOGLE_AI_CLIENTSenvironment variable as a JSON array of[client_id, client_secret]pairs. When unset, the server boots with threeREDACTED_*placeholders and the Google AI refresh call will fail until you provide real values; this keeps credentials out of source code. - Claude uses
CLIPROXYAPI_BASE_URLandCLIPROXYAPI_MANAGEMENT_KEYonly on the server. Management redirects are rejected, and the configured LAN endpoint bypasses process proxy variables. The browser receives no management key, OAuth tokens or CLIProxyAPI auth-file contents; management errors are sanitized. Account labels and filtered quota responses remain private dashboard data. - NewAPI is reached over plain HTTP because it is a LAN service — do not extend this rule to arbitrary external HTTP endpoints.
- When a
codexNewApirequest is saved the refresh automatically skips the officialcodexUsagerequest, and likewise forcodexNewApiCredits→codexCredits. This avoids repeated401noise when the official token is stale. requests.jsonstores account curl text, Volcengine AK/SK, Google refresh tokens and Kimi refresh configuration in plaintext.credentials.jsonmay also contain legacy provider credentials. Never commit real credentials or copied live requests./api/requestsremoves separate Kimi refresh fields and proxy settings and masks theskand GooglerefreshTokenfields. It still returns saved curl text, which can contain Authorization headers and cookies; this endpoint is sensitive./api/summaryexposes only account display names, headline percentages, status and timestamps; it is intended for LAN dashboards such as Home Assistant.- The page lock prevents accidental edits in the UI; it is not authentication or API access control. Protect the service with network restrictions or an authenticated reverse proxy before granting access beyond a trusted environment.
- Restrict
8080to a trusted LAN and rotate credentials immediately on leak.
node --test tests/parser.test.js
PYTHONPATH=. python3 -m unittest discover -s tests -p 'test_*.py'
python3 -m py_compile server.pyGitHub CI runs the same commands on pushes to main / master and pull requests targeting
those branches; see
.github/workflows/test.yml.
A deployed instance holds real user state, so verification runs must be non-destructive:
- The JSON files under the deployment
data/directory are user state, not test fixtures. Never write defaults, empty arrays or synthetic ids into/api/order,/api/hidden,/api/requestsor/api/snapshotwhile testing a live instance. - Read the current value of every field before changing it and keep that snapshot. After the run, restore the exact saved value — do not clear a list because the test has finished.
- Report the before and after value of each mutated field, so an unintended change is visible instead of being described as a clean run.
- Prefer an isolated local server with fixture data. When a live check is unavoidable, append a dedicated throwaway account id to the saved list and remove it by id.
- Never use an existing account as the subject of a delete or overwrite test.
hidden.jsonandorder.jsonhave no automatic per-write backup; the periodic data archive is the only recovery path, which is why live writes must be additive and reversible.
/ 部署实例上的 data/ 文件属于用户真实状态,不是测试夹具。线上验证前必须先读取并保留原值,
验证后按原值精确还原,禁止把显示顺序、隐藏列表等重置为空来“收尾”;并在结果中报告每个被修改
字段的变更前后值。优先使用本地隔离服务与夹具数据;必须线上验证时只追加重命名可丢弃的测试
账号 id,并按 id 精确移除。不得用现有账号验证删除或覆盖逻辑。
The development repository on Gitea retains the complete commit history. GitHub
publishes reviewed snapshots as a single commit per synchronization, based on the
current GitHub main. Use a separate publication branch and leave the development
branch and any unrelated working changes intact. After a squash publication, the
two histories can differ even when their file contents match.
Before publishing, inspect the outgoing tree and commit metadata for credentials, personal information and private infrastructure details. Use a GitHub noreply email, run the required checks, and satisfy GitHub branch protection through a pull request. Verify the resulting remote commit and remove temporary publication branches when they are no longer needed. See AGENTS.md for contributor rules.
Gitea 保留完整开发历史;GitHub 每次同步发布一个经过审查的压缩提交。不要为了对齐 GitHub 而重写 Gitea 或本地开发分支,也不要将运行数据、备份或私人部署信息纳入提交。