feat: 增加 lite 账户类型,解决 25 次限额账号被刷新自动识别为 basic 的问题#555
Open
luolong47 wants to merge 1 commit into
Open
Conversation
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.
Summary
我是 Grok Lite 账号(官方接口返回的
auto.total限制是 25 次)。痛点:
之前系统里没有
lite这个 pool 档位,所以每次我手动在数据库里把账号改成super勉强能用。但是只要系统后台一刷新,系统读到 25 次配额之后,由于不认识这个额度,就会把账号自动降级判定回basic,导致高级模型直接用不了(也就是一刷新就和 basic 一桌了)。为了解决这个问题,本次 PR 增加了
lite账户类型,并在刷新、判定、路由上使其表现和super账户完全一致。改动内容:
quota_defaults.py的infer_pool()中增加auto.total == 25的判定,将其正确推断为lite账户。_SUPPORTED_MODE_IDS_BY_POOL["lite"]配置为(0, 1, 2, 4),跟super完全一样(增加了对grok-4.3-beta的 Mode 4 的支持,移除了不支持的heavy)。LITE_QUOTA_DEFAULTS里的heavy去除,增加grok_4_3配额。Tier.SUPER的模型的候选池列表里包含了lite(即1),使得lite可以作为super模型的可选路由。enums.py中增加了LITE的 Tier / PoolId。pool写入白名单(支持写入"lite",解决 500 报错)。scheduler.py中配置了和super相同的同步刷新和冷却机制(7200秒)。Testing
在本地进行了实际接口调用验证。
当数据库里只有
lite账号时,调用http://127.0.0.1:8000/v1/models接口,可以正常加载所有原属于super的高级模型列表(包括grok-4.3-beta),未再出现降级为 basic 或 Pydantic 校验的 500 报错。Related
暂无