Skip to content

7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.

TypeScript

fix(ratelimit): ModelScope 免费额度更新为魔粒计费,账号级每日上限 1800→100 (#1045)

suantea (asuan_suan)10662dfd93d9
diff --git a/server/src/__tests__/services/ratelimit.test.ts b/server/src/__tests__/services/ratelimit.test.ts
index dce4e8bb..1d3428b8 100644
--- a/server/src/__tests__/services/ratelimit.test.ts
+++ b/server/src/__tests__/services/ratelimit.test.ts
@@ -280,8 +280,8 @@ describe('Rate Limiter', () => {
it('defaults to OpenRouter ~1000/day and allows env override / disable', () => {
delete process.env[ENV];
expect(getProviderDailyRequestCap('openrouter')).toBe(1000);
- // ModelScope: 2000/day account-wide upstream, shipped as 1800 for margin (#581).
- expect(getProviderDailyRequestCap('modelscope')).toBe(1800);
+ // ModelScope: ~250 魔粒/day ÷ 2 per request ≈ 125/day upstream, shipped as 100 for margin.
+ expect(getProviderDailyRequestCap('modelscope')).toBe(100);
// Requesty: 200/day across all free models, shipped as 180 for margin.
expect(getProviderDailyRequestCap('requesty')).toBe(180);
expect(getProviderDailyRequestCap('groq')).toBeNull(); // no shared cap
diff --git a/server/src/providers/index.ts b/server/src/providers/index.ts
index 8e903207..2d7325bc 100644
--- a/server/src/providers/index.ts
+++ b/server/src/providers/index.ts
@@ -540,8 +540,10 @@ register(new OpenAICompatProvider({
}));
// ModelScope (魔搭社区, Alibaba) — OpenAI-compatible inference API
-// (api-inference.modelscope.cn/v1, Bearer auth). Free tier: 2000 requests/day
-// account-wide. Token from modelscope.cn/my/myaccesstoken, BUT calls only work
+// (api-inference.modelscope.cn/v1, Bearer auth). Free tier moved to magic-grain
+// (魔粒) metering in 2026-08: ~250 魔粒/day account-wide at ~2 魔粒 per request
+// (observed 2026-08-14) ≈ 125 requests/day. Token from
+// modelscope.cn/my/myaccesstoken, BUT calls only work
// after binding the ModelScope account to an Alibaba Cloud CHINA-site (cn)
// account with Chinese real-name verification — unbound tokens 401 on every
// call ("please bind your alibaba cloud account before use"). Dedicated
diff --git a/server/src/services/ratelimit.ts b/server/src/services/ratelimit.ts
index 51f40c3b..bb8555bc 100644
--- a/server/src/services/ratelimit.ts
+++ b/server/src/services/ratelimit.ts
@@ -560,10 +560,11 @@ export function modelWindowUsedFraction(
// PROVIDER_DAILY_REQUEST_CAP_OPENROUTER=50 (set 0 to disable the cap)
const DEFAULT_PROVIDER_DAILY_REQUEST_CAPS: Record<string, number> = {
openrouter: 1000,
- // ModelScope's free tier is 2000 requests/day across the whole account (all
- // models share it). 1800 leaves margin for validation probes and for drift
+ // ModelScope's free tier moved to magic-grain (魔粒) metering in 2026-08:
+ // ~250 魔粒/day account-wide at ~2 魔粒 per request (observed 2026-08-14)
+ // ≈ 125 requests/day. 100 leaves margin for validation probes and for drift
// between our ledger and the provider's own daily boundary (#581).
- modelscope: 1800,
+ modelscope: 100,
// Requesty's free tier is 200 requests/day per account, shared by every free
// model (requesty.ai/free-models, no card). The catalog rows each carry
// rpd 200, so without this gate the router could spend 200 per model. 180
diff --git a/shared/types.ts b/shared/types.ts
index 1faed551..ce70df27 100644
--- a/shared/types.ts
+++ b/shared/types.ts
@@ -214,11 +214,13 @@ export type Platform =
// in the hosted catalog (premium now, free after the 30-day model-age gate).
| 'xkiro'
// ModelScope (魔搭社区, Alibaba) — OpenAI-compatible inference API
- // (api-inference.modelscope.cn/v1). Free tier is 2000 requests/day
- // account-wide, but calls only work after the ModelScope account is bound to
- // an Alibaba Cloud CHINA-site (cn) account with Chinese real-name
- // verification — tokens mint without binding, then every call 401s. Catalog
- // rows land after community testing confirms per-model behavior (#581).
+ // (api-inference.modelscope.cn/v1). Free tier moved to magic-grain (魔粒)
+ // metering in 2026-08: ~250 魔粒/day account-wide at ~2 魔粒 per request
+ // (observed 2026-08-14) ≈ 125 requests/day, but calls only work after the
+ // ModelScope account is bound to an Alibaba Cloud CHINA-site (cn) account
+ // with Chinese real-name verification — tokens mint without binding, then
+ // every call 401s. Catalog rows land after community testing confirms
+ // per-model behavior (#581).
| 'modelscope'
// ── Chinese domestic providers (#922/#923/#924) ────────────────────────────
// All four need Chinese real-name verification (实名认证) on the cloud account