8 Commits

Author SHA1 Message Date
jinhui.li
3ef82991fb support json config 2025-07-03 17:19:26 +08:00
jinhui.li
f9ba3805a6 fix gemini auth error 2025-07-03 09:08:31 +08:00
jinhui.li
936f697110 update readme 2025-07-02 13:33:47 +08:00
jinhui.li
b07bbd7d8c release v1.0.11 2025-07-02 13:31:42 +08:00
jinhui.li
42f7d2da60 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	README.md
#	src/utils/index.ts
2025-07-02 13:31:10 +08:00
musi
802bde2d76 Merge pull request #67 from stonega/main 2025-06-25 17:43:47 +08:00
stone
b2db0307eb Add support for lowercase HTTPS_PROXY environment variable 2025-06-24 15:19:05 +08:00
musi
391cbd8334 Update readme 2025-06-23 22:19:05 +08:00
7 changed files with 1026 additions and 19 deletions

View File

@@ -9,3 +9,6 @@ screenshoots
.env .env
.blog .blog
docs docs
.log
blog
config.json

View File

@@ -115,6 +115,8 @@ ccr code
- [x] Support change models - [x] Support change models
- [x] Github Actions - [x] Github Actions
- [ ] More detailed logs - [ ] More detailed logs
- [ ] Support image
- [ ] Support web search
## Github Actions ## Github Actions
@@ -223,16 +225,15 @@ If you find this project helpful, you can choose to sponsor the author with a cu
## Sponsors ## Sponsors
Thanks to the following sponsors: Thanks to the following sponsors for supporting the continued development of this project:
@Simon Leischnig (If you see this, feel free to contact me and I can update it with your GitHub information) @Simon Leischnig (If you see this, feel free to contact me and I can update it with your GitHub information)
[@duanshuaimin](https://github.com/duanshuaimin) [@duanshuaimin](https://github.com/duanshuaimin)
[@vrgitadmin](https://github.com/vrgitadmin) [@vrgitadmin](https://github.com/vrgitadmin)
@\*o (可通过主页邮箱联系我修改 github 用户名) @\*o (可通过主页邮箱联系我修改 github 用户名)
@\*\*聪 (可通过主页邮箱联系我修改 github 用户名) [@ceilwoo](https://github.com/ceilwoo)
@\*说 (可通过主页邮箱联系我修改 github 用户名) @\*说 (可通过主页邮箱联系我修改 github 用户名)
@\*更 (可通过主页邮箱联系我修改 github 用户名) @\*更 (可通过主页邮箱联系我修改 github 用户名)
@\*更 (可通过主页邮箱联系我修改 github 用户名)
@K\*g (可通过主页邮箱联系我修改 github 用户名) @K\*g (可通过主页邮箱联系我修改 github 用户名)
@R\*R (可通过主页邮箱联系我修改 github 用户名) @R\*R (可通过主页邮箱联系我修改 github 用户名)
@[@bobleer](https://github.com/bobleer) (可通过主页邮箱联系我修改 github 用户名) @[@bobleer](https://github.com/bobleer) (可通过主页邮箱联系我修改 github 用户名)

1001
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "@musistudio/claude-code-router", "name": "@musistudio/claude-code-router",
"version": "1.0.9", "version": "1.0.12",
"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"
@@ -18,7 +18,7 @@
"author": "musistudio", "author": "musistudio",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@musistudio/llms": "^1.0.0", "@musistudio/llms": "^1.0.1",
"dotenv": "^16.4.7", "dotenv": "^16.4.7",
"tiktoken": "^1.0.21", "tiktoken": "^1.0.21",
"uuid": "^11.1.0" "uuid": "^11.1.0"

10
pnpm-lock.yaml generated
View File

@@ -9,8 +9,8 @@ importers:
.: .:
dependencies: dependencies:
'@musistudio/llms': '@musistudio/llms':
specifier: ^1.0.0 specifier: ^1.0.1
version: 1.0.0(ws@8.18.3)(zod@3.25.67) version: 1.0.1(ws@8.18.3)(zod@3.25.67)
dotenv: dotenv:
specifier: ^16.4.7 specifier: ^16.4.7
version: 16.6.1 version: 16.6.1
@@ -214,8 +214,8 @@ packages:
'@modelcontextprotocol/sdk': '@modelcontextprotocol/sdk':
optional: true optional: true
'@musistudio/llms@1.0.0': '@musistudio/llms@1.0.1':
resolution: {integrity: sha512-O5pSV3q3XOxP/8WsPLEJFoQ7gN7zZD6+hSW+5TgNlbJhXl1WImzI1ljjUm97efcZV93ij79/xz9GwwNzx/pjmA==} resolution: {integrity: sha512-ORA2dI92PgzOh0UfTg2DUjmWac9Iwi92Q7G6Bf2AQxYI9wsc/SO5vUhaH2QInjYhlNZC9AeK07wi+WjMopBeiQ==}
abstract-logging@2.0.1: abstract-logging@2.0.1:
resolution: {integrity: sha512-2BjRTZxTPvheOvGbBslFSYOUkr+SjPtOnrLP33f+VIWLzezQpZcqVg7ja3L4dBXmzzgwT+a029jRx5PCi3JuiA==} resolution: {integrity: sha512-2BjRTZxTPvheOvGbBslFSYOUkr+SjPtOnrLP33f+VIWLzezQpZcqVg7ja3L4dBXmzzgwT+a029jRx5PCi3JuiA==}
@@ -634,7 +634,7 @@ snapshots:
- supports-color - supports-color
- utf-8-validate - utf-8-validate
'@musistudio/llms@1.0.0(ws@8.18.3)(zod@3.25.67)': '@musistudio/llms@1.0.1(ws@8.18.3)(zod@3.25.67)':
dependencies: dependencies:
'@anthropic-ai/sdk': 0.54.0 '@anthropic-ai/sdk': 0.54.0
'@fastify/cors': 11.0.1 '@fastify/cors': 11.0.1

View File

@@ -10,6 +10,7 @@ import {
isServiceRunning, isServiceRunning,
savePid, savePid,
} from "./utils/processCheck"; } from "./utils/processCheck";
import { CONFIG_FILE } from "./constants";
async function initializeClaudeConfig() { async function initializeClaudeConfig() {
const homeDir = process.env.HOME; const homeDir = process.env.HOME;
@@ -69,10 +70,17 @@ async function run(options: RunOptions = {}) {
? parseInt(process.env.SERVICE_PORT) ? parseInt(process.env.SERVICE_PORT)
: port; : port;
const server = createServer({ const server = createServer({
...config, jsonPath: CONFIG_FILE,
initialConfig: {
// ...config,
providers: config.Providers || config.providers, providers: config.Providers || config.providers,
PORT: servicePort, PORT: servicePort,
LOG_FILE: join(homedir(), ".claude-code-router", "claude-code-router.log"), LOG_FILE: join(
homedir(),
".claude-code-router",
"claude-code-router.log"
),
},
}); });
server.addHook("preHandler", async (req, reply) => server.addHook("preHandler", async (req, reply) =>
router(req, reply, config) router(req, reply, config)

View File

@@ -1,8 +1,6 @@
import Server from "@musistudio/llms"; import Server from "@musistudio/llms";
export const createServer = (config: any): Server => { export const createServer = (config: any): Server => {
const server = new Server({ const server = new Server(config);
initialConfig: config,
});
return server; return server;
}; };