diff --git a/README.md b/README.md index 204c682..d0091f8 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ npm install -g @musistudio/claude-code-router ccr code ``` -4. Configure routing[optional] +4. Configure routing[optional] Set up your `~/claude-code-router/config.json` file like this: ```json { diff --git a/package.json b/package.json index 92d76e6..84e4e69 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "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", "bin": { "ccr": "./dist/cli.js" diff --git a/src/index.ts b/src/index.ts index ac0983b..1bb9176 100644 --- a/src/index.ts +++ b/src/index.ts @@ -138,6 +138,12 @@ async function run(options: RunOptions = {}) { config?.Router?.longContext ) { server.useMiddleware(router); + } else { + server.useMiddleware((req, res, next) => { + req.provider = "default"; + req.body.model = config.OPENAI_MODEL; + next(); + }); } server.useMiddleware(formatRequest); diff --git a/src/utils/codeCommand.ts b/src/utils/codeCommand.ts index 4f4ae28..005e3bc 100644 --- a/src/utils/codeCommand.ts +++ b/src/utils/codeCommand.ts @@ -18,13 +18,13 @@ export async function executeCodeCommand(args: string[] = []) { // Increment reference count when command starts incrementReferenceCount(); - // Execute claude command - const claudePath = process.env.CLAUDE_PATH || "claude"; - const claudeProcess = spawn(claudePath, args, { - env, - stdio: "inherit", - shell: true - }); + // Execute claude command + const claudePath = process.env.CLAUDE_PATH || "claude"; + const claudeProcess = spawn(claudePath, args, { + env, + stdio: "inherit", + shell: true + }); claudeProcess.on("error", (error) => { console.error("Failed to start claude command:", error.message);