fix not working without router
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user