Files
OmniRoute/tests/unit/gitlawb-provider.test.ts
Diego Rodrigues de Sa e Souza c82462d4ef fix(free-tiers): retire 4 re-verified-dead free tiers, flag iflytek/sparkdesk ToS, clarify monsterapi one-time (#4152)
Case-by-case follow-up on the 2026-06-17 refresh deferred items. Each dead tier was
re-verified against its official source on 2026-06-18 before flipping (qwen-web lesson):

- aimlapi -> hasFree:false. docs.aimlapi.com/faq/free-tier states "The Free Tier is
  currently paused"; now pay-as-you-go (min $20 top-up).
- gitlawb + gitlawb-gmi -> hasFree:false. Free MiMo revoked 2026-05-24 (GitHub
  Gitlawb/openclaude#1345 "OPENGATEWAY REVOKED THE ONLY 1 FREE MODEL"); Nemotron promo
  ended 2026-06; Opengateway is now a pay-as-you-go credit gateway. Removed 40 stale
  gitlawb-gmi catalog records.
- yi -> hasFree:false. Yi-Light retired; platform.01.ai is pay-as-you-go (Yi-Lightning
  paid); open weights are download-only. Removed 1 stale catalog record.
- iflytek / sparkdesk -> kept hasFree:true with a ToS-caution freeNote: Spark Lite is
  free but the ToS prohibits programmatic extraction / relay to third parties (iflytek
  also requires Chinese real-name auth).
- monsterapi -> freeNote tightened to "one-time signup trial" (recurring plan = 0
  credits/mo); the budget catalog already classified it one-time-initial.

The dead providers stay registered (paid use still works); only the free-tier
advertisement is removed. FREE_TIERS.md "Removed" note + budget table reconciled.

Tests: gitlawb-provider guard updated (hasFree now false for both gitlawb variants);
discontinued-providers-2026 extended to cover the 4 new flips + an iflytek ToS-caution
assertion. Re-verified live 2026-06-18 (Hard Rule #18).
2026-06-18 03:46:52 -03:00

104 lines
4.7 KiB
TypeScript

import { describe, it } from "node:test";
import assert from "node:assert";
describe("Gitlawb Opengateway providers", () => {
describe("gitlawb (xiaomi-mimo)", () => {
it("should be registered in APIKEY_PROVIDERS", async () => {
const { APIKEY_PROVIDERS } = await import("../../src/shared/constants/providers.ts");
const provider = APIKEY_PROVIDERS["gitlawb"];
assert.ok(provider, "gitlawb should exist in APIKEY_PROVIDERS");
assert.strictEqual(provider.id, "gitlawb");
assert.strictEqual(provider.alias, "glb");
assert.ok(provider.name.includes("Gitlawb"));
// Free MiMo (xiaomi/mimo-v2.5) revoked 2026-05; Opengateway is now pay-as-you-go (re-verified 2026-06-18).
assert.strictEqual(provider.hasFree, false);
});
it("should have registry entry with correct baseUrl", async () => {
const { REGISTRY } = await import("../../open-sse/config/providerRegistry.ts");
const entry = REGISTRY["gitlawb"];
assert.ok(entry, "gitlawb should exist in REGISTRY");
assert.strictEqual(entry.baseUrl, "https://opengateway.gitlawb.com/v1/xiaomi-mimo");
assert.strictEqual(entry.format, "openai");
assert.strictEqual(entry.executor, "default");
assert.strictEqual(entry.authType, "apikey");
});
it("should have CLI-mimicking headers", async () => {
const { REGISTRY } = await import("../../open-sse/config/providerRegistry.ts");
const entry = REGISTRY["gitlawb"];
assert.ok(entry.headers, "should have headers");
assert.ok(entry.headers["User-Agent"].includes("OpenClaude"));
assert.strictEqual(entry.headers["X-Title"], "OpenClaude CLI");
assert.ok(entry.headers["HTTP-Referer"].includes("Gitlawb/openclaude"));
});
it("should list MiMo models", async () => {
const { REGISTRY } = await import("../../open-sse/config/providerRegistry.ts");
const entry = REGISTRY["gitlawb"];
assert.ok(
entry.models.length >= 5,
`should have at least 5 models, got ${entry.models.length}`
);
const pro = entry.models.find((m: any) => m.id === "mimo-v2.5-pro");
assert.ok(pro, "mimo-v2.5-pro should be listed");
assert.strictEqual(pro.contextLength, 1048576);
});
});
describe("gitlawb-gmi (gmi-cloud)", () => {
it("should be registered in APIKEY_PROVIDERS", async () => {
const { APIKEY_PROVIDERS } = await import("../../src/shared/constants/providers.ts");
const provider = APIKEY_PROVIDERS["gitlawb-gmi"];
assert.ok(provider, "gitlawb-gmi should exist in APIKEY_PROVIDERS");
assert.strictEqual(provider.id, "gitlawb-gmi");
assert.strictEqual(provider.alias, "glb-gmi");
// Free Nemotron promo ended 2026-06; GMI Cloud route is pay-as-you-go (re-verified 2026-06-18).
assert.strictEqual(provider.hasFree, false);
});
it("should have registry entry with gmi-cloud baseUrl", async () => {
const { REGISTRY } = await import("../../open-sse/config/providerRegistry.ts");
const entry = REGISTRY["gitlawb-gmi"];
assert.ok(entry, "gitlawb-gmi should exist in REGISTRY");
assert.strictEqual(entry.baseUrl, "https://opengateway.gitlawb.com/v1/gmi-cloud");
assert.strictEqual(entry.format, "openai");
assert.strictEqual(entry.authType, "apikey");
});
it("should list GPT, Claude, DeepSeek, Gemini models", async () => {
const { REGISTRY } = await import("../../open-sse/config/providerRegistry.ts");
const entry = REGISTRY["gitlawb-gmi"];
assert.ok(entry.models.length >= 30, `should have 30+ models, got ${entry.models.length}`);
const modelIds = entry.models.map((m: any) => m.id);
assert.ok(modelIds.includes("openai/gpt-5.5"), "should have GPT-5.5");
assert.ok(
modelIds.some((id: string) => id.startsWith("anthropic/claude")),
"should have Claude models"
);
assert.ok(
modelIds.some((id: string) => id.startsWith("deepseek-ai/")),
"should have DeepSeek models"
);
assert.ok(
modelIds.some((id: string) => id.startsWith("google/gemini")),
"should have Gemini models"
);
});
it("should have CLI-mimicking headers", async () => {
const { REGISTRY } = await import("../../open-sse/config/providerRegistry.ts");
const entry = REGISTRY["gitlawb-gmi"];
assert.ok(entry.headers, "should have headers");
assert.ok(entry.headers["User-Agent"].includes("OpenClaude"));
});
});
it("both providers should pass schema validation", async () => {
const { AI_PROVIDERS } = await import("../../src/shared/constants/providers.ts");
assert.ok(AI_PROVIDERS["gitlawb"], "gitlawb should be in AI_PROVIDERS");
assert.ok(AI_PROVIDERS["gitlawb-gmi"], "gitlawb-gmi should be in AI_PROVIDERS");
});
});