chore(provider): Add reka models list (#1956)

Integrated into release/v3.7.9
This commit is contained in:
backryun
2026-05-05 04:45:24 +09:00
committed by GitHub
parent 0024d20e28
commit 4dc959c1f2
8 changed files with 63 additions and 22 deletions

View File

@@ -2077,6 +2077,20 @@ export const REGISTRY: Record<string, RegistryEntry> = {
{ id: "Hermes-4-70B", name: "Hermes 4 70B (Nous Research)" },
],
},
reka: {
id: "reka",
alias: "reka",
format: "openai",
executor: "default",
baseUrl: "https://api.reka.ai/v1/chat/completions",
authType: "apikey",
authHeader: "bearer",
models: [
{ id: "reka-flash-3", name: "Reka Flash 3" },
{ id: "reka-edge-2603", name: "Reka Edge 2603" },
],
},
};
// ── Generator Functions ───────────────────────────────────────────────────

View File

@@ -949,6 +949,11 @@ export async function GET(
});
};
if (provider === "reka") {
const localCatalog = buildLocalCatalogResponse();
if (localCatalog) return localCatalog;
}
if (
isOpenAICompatibleProvider(provider) ||
isLocalOpenAIStyleProvider(provider) ||

View File

@@ -390,6 +390,7 @@ export async function getUnifiedModelsResponse(
for (const [providerId, syncedModels] of Object.entries(syncedModelsByProvider)) {
if (!Array.isArray(syncedModels) || syncedModels.length === 0) continue;
if (blockedProviders.has(providerId)) continue;
if (providerId === "reka") continue;
const prefix = providerIdToPrefix[providerId];
const alias = prefix || providerIdToAlias[providerId] || providerId;
@@ -637,6 +638,7 @@ export async function getUnifiedModelsResponse(
for (const [providerId, rawProviderCustomModels] of Object.entries(customModelsMap)) {
// Skip Gemini — handled by syncedAvailableModels above
if (providerId === "gemini") continue;
if (providerId === "reka") continue;
const providerCustomModels = Array.isArray(rawProviderCustomModels)
? rawProviderCustomModels.filter(
(model): model is Record<string, unknown> =>

View File

@@ -1531,7 +1531,7 @@ async function validateRekaProvider({ apiKey, providerSpecificData = {} }: any)
method: "POST",
headers,
body: JSON.stringify({
model: providerSpecificData.validationModelId || "reka-flash",
model: providerSpecificData.validationModelId || "reka-flash-3",
messages: [{ role: "user", content: "test" }],
max_tokens: 1,
}),

View File

@@ -408,7 +408,6 @@ export const APIKEY_PROVIDERS = {
"Reka Chat is OpenAI-compatible on /v1. OmniRoute probes /v1/models and routes chat traffic to /v1/chat/completions.",
hasFree: true,
freeNote: "$10/month recurring free API credits",
passthroughModels: true,
},
nlpcloud: {
id: "nlpcloud",

View File

@@ -39,6 +39,7 @@ const CHAT_OPENAI_COMPAT_PROVIDER_IDS = [
"nanogpt",
"predibase",
"bytez",
"reka",
];
test("chat-openai-compat providers are registered across provider metadata, registry and local catalog", () => {

View File

@@ -50,6 +50,16 @@ test("provider models helpers resolve provider IDs through aliases", () => {
assert.deepEqual(getModelsByProviderId("provider-that-does-not-exist"), []);
});
test("Reka registry exposes preset models", () => {
const rekaModels = getModelsByProviderId("reka");
const ids = rekaModels.map((model) => model.id);
assert.equal(PROVIDER_ID_TO_ALIAS.reka, "reka");
assert.equal(getDefaultModel("reka"), "reka-flash-3");
assert.deepEqual(ids, ["reka-flash-3", "reka-edge-2603"]);
assert.equal(isValidModel("reka", "reka-edge-2603"), true);
});
test("GitHub Copilot registry reflects the current supported model lineup", () => {
const githubModels = getProviderModels("gh");
const ids = new Set(githubModels.map((model) => model.id));

View File

@@ -1258,7 +1258,7 @@ test("provider models route discovers Modal models from the configured OpenAI-co
]);
});
test("provider models route discovers Reka models from the named OpenAI-compatible /v1 endpoint", async () => {
test("provider models route always returns the Reka preset catalog", async () => {
const connection = await seedConnection("reka", {
apiKey: "reka-key",
providerSpecificData: {
@@ -1266,13 +1266,8 @@ test("provider models route discovers Reka models from the named OpenAI-compatib
},
});
globalThis.fetch = async (url, init = {}) => {
assert.equal(String(url), "https://api.reka.ai/v1/models");
assert.equal(init.method, "GET");
assert.equal(init.headers.Authorization, "Bearer reka-key");
assert.equal(init.headers["X-Api-Key"], "reka-key");
return Response.json([{ id: "reka-core", name: "Reka Core" }, { id: "reka-flash" }]);
globalThis.fetch = async () => {
throw new Error("Reka models endpoint should not be probed");
};
const response = await callRoute(connection.id);
@@ -1280,19 +1275,34 @@ test("provider models route discovers Reka models from the named OpenAI-compatib
assert.equal(response.status, 200);
assert.equal(body.provider, "reka");
assert.equal(body.source, "api");
assert.deepEqual(body.models, [
{
id: "reka-core",
name: "Reka Core",
owned_by: "reka",
assert.equal(body.source, "local_catalog");
assert.deepEqual(
body.models.map((model) => model.id),
["reka-flash-3", "reka-edge-2603"]
);
});
test("provider models route returns Reka local catalog without an API key", async () => {
const connection = await seedConnection("reka", {
providerSpecificData: {
baseUrl: "https://api.reka.ai/v1",
},
{
id: "reka-flash",
name: "reka-flash",
owned_by: "reka",
},
]);
});
globalThis.fetch = async () => {
throw new Error("Reka models endpoint should not be probed without a token");
};
const response = await callRoute(connection.id);
const body = (await response.json()) as any;
assert.equal(response.status, 200);
assert.equal(body.provider, "reka");
assert.equal(body.source, "local_catalog");
assert.deepEqual(
body.models.map((model) => model.id),
["reka-flash-3", "reka-edge-2603"]
);
});
test("provider models route discovers SAP models from AI_API_URL derived from deploymentUrl", async () => {