mirror of
https://github.com/musistudio/claude-code-router.git
synced 2026-02-02 23:00:50 +08:00
pass token count to custom router
This commit is contained in:
@@ -129,6 +129,7 @@ export const router = async (req: any, _res: any, config: any) => {
|
|||||||
if (config.CUSTOM_ROUTER_PATH) {
|
if (config.CUSTOM_ROUTER_PATH) {
|
||||||
try {
|
try {
|
||||||
const customRouter = require(config.CUSTOM_ROUTER_PATH);
|
const customRouter = require(config.CUSTOM_ROUTER_PATH);
|
||||||
|
req.tokenCount = tokenCount; // Pass token count to custom router
|
||||||
model = await customRouter(req, config);
|
model = await customRouter(req, config);
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
log("failed to load custom router", e.message);
|
log("failed to load custom router", e.message);
|
||||||
|
|||||||
Reference in New Issue
Block a user