fix not working without router

This commit is contained in:
musi
2025-06-15 20:45:32 +08:00
parent ee8b82947d
commit a3ec2c223d
4 changed files with 15 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "@musistudio/claude-code-router", "name": "@musistudio/claude-code-router",
"version": "1.0.4", "version": "1.0.5",
"description": "Use Claude Code without an Anthropics account and route it to another LLM provider", "description": "Use Claude Code without an Anthropics account and route it to another LLM provider",
"bin": { "bin": {
"ccr": "./dist/cli.js" "ccr": "./dist/cli.js"

View File

@@ -138,6 +138,12 @@ async function run(options: RunOptions = {}) {
config?.Router?.longContext config?.Router?.longContext
) { ) {
server.useMiddleware(router); server.useMiddleware(router);
} else {
server.useMiddleware((req, res, next) => {
req.provider = "default";
req.body.model = config.OPENAI_MODEL;
next();
});
} }
server.useMiddleware(formatRequest); server.useMiddleware(formatRequest);