mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-07 15:52:52 +03:00
chore(provider): Add reka models list (#1956)
Integrated into release/v3.7.9
This commit is contained in:
@@ -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 ───────────────────────────────────────────────────
|
||||
|
||||
@@ -949,6 +949,11 @@ export async function GET(
|
||||
});
|
||||
};
|
||||
|
||||
if (provider === "reka") {
|
||||
const localCatalog = buildLocalCatalogResponse();
|
||||
if (localCatalog) return localCatalog;
|
||||
}
|
||||
|
||||
if (
|
||||
isOpenAICompatibleProvider(provider) ||
|
||||
isLocalOpenAIStyleProvider(provider) ||
|
||||
|
||||
@@ -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> =>
|
||||
|
||||
@@ -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,
|
||||
}),
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user