api-switch-cc 0.2.2 → 0.2.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.
Files changed (2) hide show
  1. package/install.js +16 -8
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -66,11 +66,14 @@ function install() {
66
66
  const url = `${BASE}/${archive}`;
67
67
  const tmp = join(__dirname, `_${archive}`);
68
68
 
69
- console.log(`Downloading api-switch v${DOWNLOAD_VERSION} for ${plat} ...`);
69
+ console.log(`Downloading ${DOWNLOAD_VERSION} for ${plat} ...`);
70
70
 
71
71
  try {
72
- // Download
73
- execSync(`curl -sSL "${url}" -o "${tmp}"`, { stdio: "pipe" });
72
+ // Download with retry and longer timeout
73
+ execSync(
74
+ `curl -sSL --connect-timeout 10 --max-time 120 --retry 3 "${url}" -o "${tmp}"`,
75
+ { stdio: "pipe", timeout: 180000 }
76
+ );
74
77
 
75
78
  // Extract (archive contains binary named api-switch-<plat>)
76
79
  const archiveBin = archivedBinaryName();
@@ -92,11 +95,16 @@ function install() {
92
95
  console.log(`Installed to ${binPath}`);
93
96
  } catch (err) {
94
97
  console.error(`Download failed: ${err.message}`);
95
- console.log("Falling back to source build (requires Go)...");
96
- execSync(
97
- `cd ${join(__dirname, "..")} && go build -ldflags="-s -w" -o "${binPath}" ./cmd/api-switch/`,
98
- { stdio: "inherit" }
99
- );
98
+ console.log();
99
+ console.log("Manual installation:");
100
+ console.log(` curl -sSL "${url}" | tar xz`);
101
+ console.log(` sudo cp ${join(".", archiveBin)} /usr/local/bin/api-switch`);
102
+ console.log();
103
+ console.log("Or install from source (requires Go):");
104
+ console.log(" git clone https://github.com/hxz0727/API-Switch.git");
105
+ console.log(" cd API-Switch && make build");
106
+ console.log(" make install");
107
+ process.exit(1);
100
108
  }
101
109
  }
102
110
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "api-switch-cc",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Claude Code 多模型代理 — 一键切换 DeepSeek、Qwen、GLM、Moonshot 等国产大模型,协议自动转换,零配置即用。LLM API proxy for Claude Code with DeepSeek, Qwen, Anthropic, OpenAI support.",
5
5
  "bin": {
6
6
  "api-switch": "bin/api-switch"