feat(codex-inspection): add xAI/Grok provider inspection support#330
Closed
lost9999 wants to merge 2 commits into
Closed
feat(codex-inspection): add xAI/Grok provider inspection support#330lost9999 wants to merge 2 commits into
lost9999 wants to merge 2 commits into
Conversation
- Add TargetTypeXAI constant and TargetTypeCodex constant in model layer
- Add xAI billing API probe (requestXaiBilling / requestXaiBillingAt)
- Add resolveXaiBillingProbeAction for Grok-specific quota logic:
- 402 spending-limit -> disable
- 401/403 (non-region) -> disable
- 429 rate-limit -> disable
- Parse billing config for monthlyLimit/used/onDemandCap thresholds
- Auto re-enable recommendation when quota recovers
- Add readMapValue helper for xAI's {val: N} nested value format
- Route probe to xai or codex based on account provider field
Free-tier Grok accounts have 1M token/day quota and short rolling windows,
making automated inspection even more critical than for Codex.
The Hermes commit filter corrupted into [redacted], causing CI build failure. Restore the correct comparison.
Contributor
Author
|
Closing this draft implementation in favor of a clean redesign. The next proposal will use CPAMP-owned provider-aware cooldown state, event-driven disablement, active recovery probes, ownership protection, and tests instead of extending Codex Inspection directly. |
This was referenced Jul 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
希望 Codex 账号巡检功能支持 xAI/Grok 凭证
背景
CPAMP 的 Quota 页面和监控已经能显示 xAI/Grok 凭证的用量和错误统计了(最近几个版本加了 Grok billing API 查询、xAI provider 标准化、暗色图标),非常方便。
但最大的问题是:Quota 页面只能看,不能自动管。Codex 的 Inspection 系统能做到"额度耗尽自动暂停、额度恢复自动启用",而 Grok 这边完全需要手动操作。
场景
我们有 900 多个 Grok 免费账号,每天对外提供 grok-4.5 服务。
如果有 Grok Inspection:
api-call打到 Grok billing APIPATCH /auth-files/status暂停技术上几乎已经准备好了
看源码发现,Inspection 的核心流程是 provider 无关的:
流程是:
GET /auth-files→ 按 TargetType 过滤 →api-call探测 →PATCH /auth-files/statusdisable/enable。Codex 和 Grok 的唯一区别是探测 API 的路径不同(Codex 走 OpenAI usage API,Grok 走 billing API),7 月初的 release 已经能调 Grok billing 了。
优先级
Grok 的 token 消耗速度远高于 Codex(免费账号 1M/天 vs Codex 数十万/周),自动化管理的紧迫性其实比 Codex 更高。
希望能考虑支持,感谢!
附:CPAMP 版本 v1.10.5,当前通过外部 cron 脚本兜底,但非常期待原生集成。