From 775168336594c8dddfb8e60ad5b6cee91f0d6fe9 Mon Sep 17 00:00:00 2001 From: musistudio Date: Sun, 3 Aug 2025 07:38:51 +0800 Subject: [PATCH] pass token count to custom router --- src/utils/router.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/router.ts b/src/utils/router.ts index 701eaa3..2743d45 100644 --- a/src/utils/router.ts +++ b/src/utils/router.ts @@ -129,6 +129,7 @@ export const router = async (req: any, _res: any, config: any) => { if (config.CUSTOM_ROUTER_PATH) { try { const customRouter = require(config.CUSTOM_ROUTER_PATH); + req.tokenCount = tokenCount; // Pass token count to custom router model = await customRouter(req, config); } catch (e: any) { log("failed to load custom router", e.message);