中文
背景
v0.9.1 新增了 provider 用量配额展示(6d53fd5),通过 lib/provider-usage-ids.ts 中的白名单控制支持范围,目前包含 openai-codex、deepseek、openrouter、moonshotai、moonshotai-cn、minimax、minimax-cn、vercel-ai-gateway。
内置订阅制 provider Kimi For Coding(ID: kimi-coding)不在白名单中,模型设置页的详情面板不显示用量区域。
请求
为 kimi-coding 增加用量配额展示。
接口依据
该 provider 有现成的配额查询接口,无需额外鉴权(与模型调用共用同一个 API key / OAuth token):
GET https://api.kimi.com/coding/v1/usages
Authorization: Bearer <key>
实测响应(已脱敏):
{
"user": { "membership": { "level": "LEVEL_ADVANCED" } },
"usage": { "limit": "100", "remaining": "100", "resetTime": "2026-09-21T03:17:42Z" },
"limits": [
{
"window": { "duration": 300, "timeUnit": "TIME_UNIT_MINUTE" },
"detail": { "limit": "100", "used": "1", "remaining": "99", "resetTime": "2026-09-14T10:17:42Z" }
}
],
"parallel": { "limit": "30" },
"authentication": { "method": "METHOD_API_KEY", "scope": "FEATURE_CODING" }
}
与现有 UsageBucket 模型的映射建议
usage → 周期总额度 bucket(limit / remaining / resetsAt,unit: count)
limits[] → 限流窗口 bucket(windowMinutes = window.duration,resetsAt = detail.resetTime)
parallel.limit → 并发上限 metric
user.membership.level → 会员等级 metric/note
涉及文件预计为:lib/provider-usage-ids.ts、lib/provider-usage.ts,以及可能的服务端查询路由 app/api/provider-usage/query/route.ts。
备注
kimi-coding 支持 API Key 与 OAuth 订阅(Kimi Code 登录)两种认证方式,希望两种方式都能查询。
- 平台另有国际站
api.kimi.com 与国内站之分,如需要可按 base URL 区分。
English
Background
v0.9.1 added provider usage quotas (6d53fd5), gated by the whitelist in lib/provider-usage-ids.ts. The built-in subscription provider Kimi For Coding (kimi-coding) is not included, so its detail panel in Settings → Models shows no usage section.
Request
Add usage quota support for kimi-coding.
API evidence
The provider exposes a ready-made quota endpoint that works with the same credential used for model calls:
GET https://api.kimi.com/coding/v1/usages
Authorization: Bearer <key>
Verified live response (redacted) — see the JSON above. It maps cleanly onto the existing UsageBucket model:
usage → overall period quota bucket (limit / remaining / resetsAt)
limits[] → rate-limit window buckets (windowMinutes from window.duration, resetsAt from detail.resetTime)
parallel.limit → concurrency metric
user.membership.level → membership metric/note
Notes
kimi-coding supports both API-key and OAuth subscription (Kimi Code login); ideally both auth modes can query usage.
- Files likely touched:
lib/provider-usage-ids.ts, lib/provider-usage.ts, app/api/provider-usage/query/route.ts.
中文
背景
v0.9.1 新增了 provider 用量配额展示(
6d53fd5),通过lib/provider-usage-ids.ts中的白名单控制支持范围,目前包含openai-codex、deepseek、openrouter、moonshotai、moonshotai-cn、minimax、minimax-cn、vercel-ai-gateway。内置订阅制 provider Kimi For Coding(ID:
kimi-coding)不在白名单中,模型设置页的详情面板不显示用量区域。请求
为
kimi-coding增加用量配额展示。接口依据
该 provider 有现成的配额查询接口,无需额外鉴权(与模型调用共用同一个 API key / OAuth token):
实测响应(已脱敏):
{ "user": { "membership": { "level": "LEVEL_ADVANCED" } }, "usage": { "limit": "100", "remaining": "100", "resetTime": "2026-09-21T03:17:42Z" }, "limits": [ { "window": { "duration": 300, "timeUnit": "TIME_UNIT_MINUTE" }, "detail": { "limit": "100", "used": "1", "remaining": "99", "resetTime": "2026-09-14T10:17:42Z" } } ], "parallel": { "limit": "30" }, "authentication": { "method": "METHOD_API_KEY", "scope": "FEATURE_CODING" } }与现有 UsageBucket 模型的映射建议
usage→ 周期总额度 bucket(limit/remaining/resetsAt,unit:count)limits[]→ 限流窗口 bucket(windowMinutes=window.duration,resetsAt=detail.resetTime)parallel.limit→ 并发上限 metricuser.membership.level→ 会员等级 metric/note涉及文件预计为:
lib/provider-usage-ids.ts、lib/provider-usage.ts,以及可能的服务端查询路由app/api/provider-usage/query/route.ts。备注
kimi-coding支持 API Key 与 OAuth 订阅(Kimi Code 登录)两种认证方式,希望两种方式都能查询。api.kimi.com与国内站之分,如需要可按 base URL 区分。English
Background
v0.9.1 added provider usage quotas (
6d53fd5), gated by the whitelist inlib/provider-usage-ids.ts. The built-in subscription provider Kimi For Coding (kimi-coding) is not included, so its detail panel in Settings → Models shows no usage section.Request
Add usage quota support for
kimi-coding.API evidence
The provider exposes a ready-made quota endpoint that works with the same credential used for model calls:
Verified live response (redacted) — see the JSON above. It maps cleanly onto the existing
UsageBucketmodel:usage→ overall period quota bucket (limit/remaining/resetsAt)limits[]→ rate-limit window buckets (windowMinutesfromwindow.duration,resetsAtfromdetail.resetTime)parallel.limit→ concurrency metricuser.membership.level→ membership metric/noteNotes
kimi-codingsupports both API-key and OAuth subscription (Kimi Code login); ideally both auth modes can query usage.lib/provider-usage-ids.ts,lib/provider-usage.ts,app/api/provider-usage/query/route.ts.