new-api
new-api copied to clipboard
[Feature Request] MiniMax 渠道支持订阅额度展示,额度耗尽后自动禁用
Agent
- Tool: Hermes Agent
- Tool version: 0.22.5
- Model (full id): deepseek-v4.1-flash
- Host (CLI / IDE / GitHub coding agent / other): CLI
- Date (UTC): 2026-10-26
User request
- Verbatim:
添加渠道选择 Minimax 时,填写的订阅key,希望能展示订阅使用额度5小时/周额度,并且用完能自动禁用(当前额度用完,甚至没有错误,导致用户请求还是会命中该渠道,只不过token是0),以及能配置比如达到95%额度就自动禁用之类
- Later constraints or corrections from the user (quote, or none): none
Out of scope — refuse
- Matched: no
- If yes, what was told to the user (stop here; do not file): not applicable
File gate — do not file unless all are satisfied
- Out of scope (including pass-through): no
- Usage / configuration / integration (answered instead of filing): no
- Required facts present without invention (actual behavior, impact, frequency, evidence in new-api, applicable type fields): yes
- Body is short and factual; no unfiltered AI-generated text: yes
- File: yes
Kind
- [ ] Bug
- [x] Feature
- [ ] Investigation
- [ ] Other:
Usage / configuration / integration check
文档里渠道余额查询那块只写了支持余额查询的渠道类型,没提 MiniMax;代码里余额查询的分支也没有 MiniMax。
- Can the current version already do this? (required for feature requests): 不能。
- Verdict: new feature
Environment
- new-api version / commit / image tag (not
latest/unknown): v1.0.0-rc.47 - Deploy source (repo release / official image / main source / other): Docker(官方镜像)
- Database (sqlite / mysql / postgres): postgres
Problem facts
- Actual behavior: 用 MiniMax 的订阅 key 建渠道后,看不到这个 key 还剩多少额度(5 小时窗口和周额度都没有)。额度用完之后请求不会报错,仍然会命中这个渠道,只是返回的 token 是 0,用户那边等于拿到空回复。
- Impact: 管理员无法判断这个渠道还能不能用,只能等用户反馈「没有输出」才发现。额度耗尽期间请求持续命中无效渠道,等于白白消耗用户的重试和等待。
- Frequency: 额度用完后每次请求都会这样,直到手动禁用或额度重置。
- Evidence that the problem is in new-api rather than the client or upstream: 请求确实到了上游并返回成功状态,只是内容为空;new-api 侧没有识别出「额度已耗尽」这个状态,所以没有走自动禁用。
Type-specific details
Relay / API
- Request endpoint and method:
/v1/chat/completions(MiniMax 渠道) - Channel type: MiniMax(35)
- Model: MiniMax 系列模型
- Conversion format: OpenAI 兼容
- Pass-through enabled: 否
- Evidence of upstream native support: MiniMax 控制台本身有 5 小时 / 周额度显示
- Equivalent redacted request sent directly upstream: 未执行
- Same request through new-api: 未执行
Frontend
不适用
Billing
不适用
Deployment / upgrade
不适用
Reproduction and expected result
- Steps to reproduce:
- 添加一个 MiniMax 渠道,填入订阅 key
- 在渠道页面点「查询余额」——没有 MiniMax 这一项
- 等订阅额度用完,继续发请求——不报错,返回内容为空,token 计 0
- Expected result:
- 渠道能显示这个 key 的剩余额度(5 小时窗口、周额度)
- 额度用完后自动禁用该渠道,不要继续命中
- 最好能配一个阈值,比如用到 95% 就提前禁用
Feature (feature requests only)
- Feature description: MiniMax 渠道支持查询订阅 key 的额度(5 小时窗口 + 周额度),并在额度耗尽或达到可配置阈值时自动禁用渠道。
- Use case: 用订阅制 key 做渠道时,管理员需要知道还剩多少量,也需要在耗尽后自动摘掉,避免用户请求打到空渠道上。
Duplicate check
- Search queries (issues, PRs, discussions):
minimax 额度、额度 自动禁用、订阅 额度 渠道、minimax 周额度 - Closest existing threads:
- #3109「MiniMax额度更新不支持」(open,无评论,只有一张截图):说的就是 MiniMax 额度更新这件事,但没写清楚要什么。本 issue 是把它具体化:要 5 小时/周两个口径的展示,加上阈值自动禁用。
- #7858 / #7859:多密钥渠道查余额,针对的是通用多密钥场景,不是 MiniMax 订阅额度的口径。
- #6009:订阅套餐支持月/周/小时额度,那是 new-api 自己卖的套餐,不是上游渠道的额度。
- #4215 / #5420 / #7071:自动禁用渠道的恢复机制,前提是渠道已经被禁用,不涉及额度来源。
- Why this is not a duplicate: #3109 只说了「不支持」,没有说清需要哪些口径、以及自动禁用和阈值。这个 issue 把需求写全,便于判断工作量。
Research
Docs
- https://docs.newapi.ai/ : 渠道管理里余额查询一节列了支持查询的渠道类型,MiniMax 不在其中。
- https://deepwiki.com/QuantumNous/new-api : 这次没查。
- README / other repo docs: 没找到 MiniMax 额度相关的说明。
- Conclusions: 文档层面没有这个能力。
Code
controller/channel-billing.go:638-664— 余额查询的 case 分支里只有 OpenAI、Azure、Custom、AIProxy、API2GPT、AIGC2D、SiliconFlow、DeepSeek、OpenRouter、Moonshot、Sub2API、NewAPI,没有ChannelTypeMiniMax。controller/channel-billing.go:759— 余额不足时调用DisableChannel(..., "Insufficient balance"),也就是说自动禁用依赖前面那次余额查询,查不到就不会禁用。relay/channel/minimax/— 目录下只有 adaptor、image、relay、tts,没有额度查询相关实现。constant/channel.go:35—ChannelTypeMiniMax = 35。
Experiments
- Command or redacted request: 没在运行实例上验证,只看了源码。版本对应 commit 34003e9。
- Direct upstream result: not applicable
- Result through new-api: not applicable
- Conclusion: MiniMax 没有接余额查询,所以额度耗尽时不会触发自动禁用。
Working theory
- What is broken or missing: MiniMax 渠道缺少额度查询,连带缺少基于额度的自动禁用。
- Why: 现有的「余额不足自动禁用」是挂在余额查询上的,没接查询的渠道就没有这条链路。
- What would falsify this: 如果 MiniMax 有独立的额度校验逻辑,或者上游在额度耗尽时返回了可识别的错误码而 new-api 没处理。
Scope
- In scope for a later PR: MiniMax 渠道的额度查询,以及基于额度的自动禁用和阈值配置。
- Out of scope / not this repo: 上游 MiniMax 接口本身不提供额度查询的话,这个需求就不成立。
- Large or directional feature? If yes, this issue is for maintainer alignment; do not open a PR yet: 是,涉及渠道余额体系,建议先对齐再动代码。
Proposed direction
期望结果是:渠道页面能看到 MiniMax 订阅 key 的 5 小时 / 周额度,额度耗尽或到阈值时自动禁用。具体怎么取数、阈值怎么配,由维护者判断。
Not verified
- 没在运行实例上验证,只有源码证据。
- 没确认 MiniMax 是否提供查询订阅额度的接口,以及返回结构。
- 没确认额度耗尽时上游返回的具体状态码和响应体。
Related
- #3109
- #7858
- #7859
- #6009
- #4215
- #5420
[Bot Review]
感谢您的提交!发现您的 Issue 没有使用项目标准的 Feature Request 模板。为了帮助我们更高效地评估您的需求,请关闭此 Issue 并使用官方模板(包含“版本/version”、“提交确认/Submission Checks”等关键部分)重新提交。期待您的再次反馈!