Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

refactor(open-sse): remove unused imports from translator/index.ts

diegosouzapw65edddd62e54
diff --git a/open-sse/translator/index.ts b/open-sse/translator/index.ts
index 731d710c90..d8d558abde 100644
--- a/open-sse/translator/index.ts
+++ b/open-sse/translator/index.ts
@@ -1,6 +1,5 @@
import { FORMATS } from "./formats.ts";
import { ensureToolCallIds, fixMissingToolResponses } from "./helpers/toolCallHelper.ts";
-import { coerceToolSchemas, sanitizeToolDescriptions } from "./helpers/schemaCoercion.ts";
import { prepareClaudeRequest } from "./helpers/claudeHelper.ts";
import { filterToOpenAIFormat } from "./helpers/openaiHelper.ts";
import {
diff --git a/src/lib/db/settings.ts b/src/lib/db/settings.ts
index 347a648a50..e5ac9f6553 100644
--- a/src/lib/db/settings.ts
+++ b/src/lib/db/settings.ts
@@ -45,7 +45,6 @@ export async function getSettings() {
cloudEnabled: false,
stickyRoundRobinLimit: 3,
requireLogin: true,
- maxCallLogs: 10000,
};
for (const row of rows) {
const record = toRecord(row);
diff --git a/tests/unit/call-log-cap.test.mjs b/tests/unit/call-log-cap.test.mjs
index 77cb290327..314fe13bdd 100644
--- a/tests/unit/call-log-cap.test.mjs
+++ b/tests/unit/call-log-cap.test.mjs
@@ -6,6 +6,7 @@ import path from "node:path";
const TEST_DATA_DIR = fs.mkdtempSync(path.join(os.tmpdir(), "omniroute-calllogs-cap-"));
process.env.DATA_DIR = TEST_DATA_DIR;
+const ORIGINAL_CALL_LOGS_MAX = process.env.CALL_LOGS_MAX;
const core = await import("../../src/lib/db/core.ts");
const localDb = await import("../../src/lib/localDb.ts");
@@ -25,6 +26,11 @@ test.beforeEach(async () => {
test.after(() => {
core.resetDbInstance();
fs.rmSync(TEST_DATA_DIR, { recursive: true, force: true });
+ if (ORIGINAL_CALL_LOGS_MAX === undefined) {
+ delete process.env.CALL_LOGS_MAX;
+ } else {
+ process.env.CALL_LOGS_MAX = ORIGINAL_CALL_LOGS_MAX;
+ }
});
test("call logs respect the configurable maxCallLogs setting", async () => {
@@ -52,3 +58,29 @@ test("call logs respect the configurable maxCallLogs setting", async () => {
["model-5", "model-4", "model-3"]
);
});
+
+test("call logs keep honoring CALL_LOGS_MAX when maxCallLogs was never saved", async () => {
+ process.env.CALL_LOGS_MAX = "2";
+ callLogs.invalidateCallLogsMaxCache();
+
+ for (let i = 1; i <= 4; i++) {
+ await callLogs.saveCallLog({
+ method: "POST",
+ path: "/v1/chat/completions",
+ status: 200,
+ model: `env-model-${i}`,
+ provider: "openai",
+ duration: i,
+ requestBody: { index: i },
+ responseBody: { ok: true, index: i },
+ });
+ }
+
+ const logs = await callLogs.getCallLogs({ limit: 10 });
+
+ assert.equal(logs.length, 2);
+ assert.deepEqual(
+ logs.map((entry) => entry.model),
+ ["env-model-4", "env-model-3"]
+ );
+});