Repository navigation
fix: 避免中转 Key 按透传的 ChatGPT 周限额长期冷却 - #515
Merged
ranxi2001 merged 2 commits intoOct 21, 2026
Merged
Conversation
This was referenced Oct 21, 2026
Merged
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.
解决的问题与行为变化
usage_limit_reached、resets_at或 Codex 周窗口时,本地把这个窗口应用到整个 Key,造成余额仍可用的中转 Key 长期停调。fix: 区分 OAuth 与 API Key,避免上游套餐误标 Key #510 已修复套餐误标,但保留了这条冷却逻辑。关联记录与来源
ranxi2001/sub2api,base=production,起点c2beea839;head=fix/apikey-chatgpt-quota-cooldown-20261022。不是 stacked PR,fix: 区分 OAuth 与 API Key,避免上游套餐误标 Key #510 已包含在 base 中。复现与验收
2.14.0 / f3f72fa98;本 PR 从包含 fix: 区分 OAuth 与 API Key,避免上游套餐误标 Key #510 的production / c2beea839修复。以下为离线回归输入,尚未在本地执行,不声称重新复现生产。x-codex-primary-used-percent: 100、x-codex-primary-reset-after-seconds: 604800、x-codex-primary-window-minutes: 10080。backend/internal/service/ratelimit_service_openai_apikey_quota_test.go;同步调整现有 API Key 套餐测试的冷却断言。覆盖绝对/相对重置时间、Codex/透传 Anthropic 头、普通 429、默认/自定义/禁用冷却、运行时调度阻塞和管理端测试。既有 OAuth / Ollama 等用例交由 CI 回归。协议、调度或传输改动补充
{"error":{"type":"usage_limit_reached","plan_type":"pro","resets_at":4102444800}}。openai_apikey_upstream_429,不增加正文或凭据采集。实际验证
gofmt -w backend/internal/service/ratelimit_service.go backend/internal/service/account_test_service.go backend/internal/service/ratelimit_service_openai_test.go backend/internal/service/account_test_service_openai_test.go backend/internal/service/ratelimit_service_openai_apikey_quota_test.gogit diff --check/ 暂存后git diff --cached --checkgit diff,核对 production 的贡献指南、PR 模板与 CI 配置make -C backend test-unit、make -C backend test-integration、lint、安全检查及构建兼容性与运行影响
文档与用户可见变化
README 增加中转 API Key 429 的短冷却语义、专用路径例外和历史状态处理说明。无 UI、API schema 或 i18n 变化;PR 合并不等于已上线。
Agent 使用声明
提交前自查