@musistudio/claude-code-router 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,32 +25,74 @@ npm install -g @musistudio/claude-code-router
25
25
  ccr code
26
26
  ```
27
27
 
28
-
29
- ## Plugin[Beta]
30
-
31
- The plugin allows users to rewrite Claude Code prompt and custom router. The plugin path is in `$HOME/.claude-code-router/plugins`. Currently, there are two demos available:
32
- 1. [custom router](https://github.com/musistudio/claude-code-router/blob/dev/custom-prompt/plugins/deepseek.js)
33
- 2. [rewrite prompt](https://github.com/musistudio/claude-code-router/blob/dev/custom-prompt/plugins/gemini.js)
34
-
35
- You need to move them to the `$HOME/.claude-code-router/plugins` directory and configure 'usePlugin' in `$HOME/.claude-code-router/config.json`,like this:
36
-
28
+ 4. Configure routing[optional]
29
+ Set up your `~/claude-code-router/config.json` file like this:
37
30
  ```json
38
31
  {
39
- "usePlugin": "gemini",
40
- "LOG": true,
41
- "OPENAI_API_KEY": "",
42
- "OPENAI_BASE_URL": "",
43
- "OPENAI_MODEL": ""
32
+ "OPENAI_API_KEY": "sk-xxx",
33
+ "OPENAI_BASE_URL": "https://api.deepseek.com",
34
+ "OPENAI_MODEL": "deepseek-chat",
35
+ "Providers": [
36
+ {
37
+ "name": "openrouter",
38
+ "api_base_url": "https://openrouter.ai/api/v1",
39
+ "api_key": "sk-xxx",
40
+ "models": [
41
+ "google/gemini-2.5-pro-preview",
42
+ "anthropic/claude-sonnet-4",
43
+ "anthropic/claude-3.5-sonnet",
44
+ "anthropic/claude-3.7-sonnet:thinking"
45
+ ]
46
+ },
47
+ {
48
+ "name": "deepseek",
49
+ "api_base_url": "https://api.deepseek.com",
50
+ "api_key": "sk-xxx",
51
+ "models": ["deepseek-reasoner"]
52
+ },
53
+ {
54
+ "name": "ollama",
55
+ "api_base_url": "http://localhost:11434/v1",
56
+ "api_key": "ollama",
57
+ "models": ["qwen2.5-coder:latest"]
58
+ }
59
+ ],
60
+ "Router": {
61
+ "background": "ollama,qwen2.5-coder:latest",
62
+ "think": "deepseek,deepseek-reasoner",
63
+ "longContext": "openrouter,google/gemini-2.5-pro-preview"
64
+ }
44
65
  }
45
66
  ```
67
+ - `background`
68
+ This model will be used to handle some background tasks([background-token-usage](https://docs.anthropic.com/en/docs/claude-code/costs#background-token-usage)). Based on my tests, it doesn’t require high intelligence. I’m using the qwen-coder-2.5:7b model running locally on my MacBook Pro M1 (32GB) via Ollama.
69
+ If your computer can’t run Ollama, you can also use some free models, such as qwen-coder-2.5:3b.
70
+
71
+
72
+ - `think`
73
+ This model will be used when enabling Claude Code to perform reasoning. However, reasoning budget control has not yet been implemented (since the DeepSeek-R1 model does not support it), so there is currently no difference between using UltraThink and Think modes.
74
+ It is worth noting that Plan Mode also use this model to achieve better planning results.
75
+ Note: The reasoning process via the official DeepSeek API may be very slow, so you may need to wait for an extended period of time.
76
+
77
+
78
+ - `longContext`
79
+ This model will be used when the context length exceeds 32K (this value may be modified in the future). You can route the request to a model that performs well with long contexts (I’ve chosen google/gemini-2.5-pro-preview). This scenario has not been thoroughly tested yet, so if you encounter any issues, please submit an issue.
80
+
81
+
82
+ - model command
83
+ You can also switch models within Claude Code by using the `/model` command. The format is: `provider,model`, like this:
84
+ `/model openrouter,anthropic/claude-3.5-sonnet`
85
+ This will use the anthropic/claude-3.5-sonnet model provided by OpenRouter to handle all subsequent tasks.
46
86
 
47
87
  ## Features
48
88
  - [x] Plugins
49
- - [ ] Support change models
89
+ - [x] Support change models
50
90
  - [ ] Support scheduled tasks
51
91
 
52
92
 
53
93
  ## Some tips:
94
+ Now you can use deepseek-v3 models directly without using any plugins.
95
+
54
96
  If you’re using the DeepSeek API provided by the official website, you might encounter an “exceeding context” error after several rounds of conversation (since the official API only supports a 64K context window). In this case, you’ll need to discard the previous context and start fresh. Alternatively, you can use ByteDance’s DeepSeek API, which offers a 128K context window and supports KV cache.
55
97
 
56
98
  ![](screenshoots/contexterror.jpg)
File without changes
package/config.json CHANGED
@@ -3,5 +3,6 @@
3
3
  "LOG": true,
4
4
  "OPENAI_API_KEY": "",
5
5
  "OPENAI_BASE_URL": "",
6
- "OPENAI_MODEL": ""
7
- }
6
+ "OPENAI_MODEL": "",
7
+ "modelProviders": {}
8
+ }