fix(registry): restore byteplus + mimocode dropped by #3993 modularization

The provider-registry modularization (#3993) was cut from a base predating the
byteplus (#3877) and mimocode (#3837) registry entries, so merging it silently
dropped both providers (getRegistryEntry returned undefined → validation reported
'not supported'). Re-add them as registry modules in the new structure; registered
count 159→161, provider-consistency 161/232/0.

Also align the pre-existing qwen-web validator test to #3958: since the validator
now requires a real `user` object in the 200 body, the mock must carry one.
This commit is contained in:
diegosouzapw
2026-06-16 11:08:08 -03:00
parent 1ed01dd906
commit 670d54c704
4 changed files with 45 additions and 1 deletions

View File

@@ -1,6 +1,8 @@
import type { RegistryEntry } from "./shared.ts";
import { aimlapiProvider } from "./registry/aimlapi/index.ts";
import { byteplusProvider } from "./registry/byteplus/index.ts";
import { mimocodeProvider } from "./registry/mimocode/index.ts";
import { ollama_cloudProvider } from "./registry/ollama-cloud/index.ts";
import { syntheticProvider } from "./registry/synthetic/index.ts";
import { ideogramProvider } from "./registry/ideogram/index.ts";
@@ -320,4 +322,6 @@ export const REGISTRY: Record<string, RegistryEntry> = {
codex: codexProvider,
venice: veniceProvider,
kiro: kiroProvider,
byteplus: byteplusProvider,
mimocode: mimocodeProvider,
};

View File

@@ -0,0 +1,21 @@
import type { RegistryEntry } from "../../shared.ts";
// BytePlus ModelArk (Ark) — OpenAI-compatible, ap-southeast-1 region, Bearer auth.
// Re-added after the registry modularization (#3993) dropped it; restores #3877.
export const byteplusProvider: RegistryEntry = {
id: "byteplus",
alias: "bpm",
format: "openai",
executor: "default",
baseUrl: "https://ark.ap-southeast.bytepluses.com/api/v3/chat/completions",
modelsUrl: "https://ark.ap-southeast.bytepluses.com/api/v3/models",
authType: "apikey",
authHeader: "bearer",
defaultContextLength: 128000,
models: [
{ id: "seed-2.0", name: "Seed 2.0" },
{ id: "kimi-k2-thinking", name: "Kimi K2 Thinking", supportsReasoning: true },
{ id: "glm-4.7", name: "GLM 4.7" },
{ id: "gpt-oss-120b", name: "GPT-OSS-120B" },
],
};

View File

@@ -0,0 +1,16 @@
import type { RegistryEntry } from "../../shared.ts";
import { CHAT_OPENAI_COMPAT_MODELS } from "../../shared.ts";
// Mimocode (Xiaomi MiMo free OpenAI-compatible gateway) — no-auth, custom executor.
// Re-added after the registry modularization (#3993) dropped it; restores #3837.
export const mimocodeProvider: RegistryEntry = {
id: "mimocode",
alias: "mcode",
format: "openai",
executor: "mimocode",
baseUrl: "https://api.xiaomimimo.com",
chatPath: "/api/free-ai/openai/chat",
authType: "none",
authHeader: "none",
models: CHAT_OPENAI_COMPAT_MODELS["mimocode"],
};

View File

@@ -2655,7 +2655,10 @@ test("qwen-web validator probes /api/v2/user (not /api/v2/models) and returns va
globalThis.fetch = async (url, init = {}) => {
probedUrl = String(url);
sentHeaders = toPlainHeaders(init.headers);
return new Response(JSON.stringify({ data: { id: "u-1", name: "Tester" } }), {
// Qwen's /api/v2/user returns a real user object for a valid session. Since
// #3958 the validator inspects the body for `user` (Qwen answers 200 even for
// invalid tokens), so a valid response must carry one.
return new Response(JSON.stringify({ user: { id: "u-1", name: "Tester" } }), {
status: 200,
headers: { "content-type": "application/json" },
});