better-ccflare 1.2.28 → 1.2.30

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
@@ -130,6 +130,36 @@ bun install
130
130
  bun run better-ccflare
131
131
  ```
132
132
 
133
+ ### Docker (Multi-Platform: linux/amd64, linux/arm64)
134
+
135
+ ```bash
136
+ # Quick start with docker-compose
137
+ curl -O https://raw.githubusercontent.com/tombii/better-ccflare/main/docker-compose.yml
138
+ docker-compose up -d
139
+
140
+ # Or use docker run
141
+ docker run -d \
142
+ --name better-ccflare \
143
+ -p 8080:8080 \
144
+ -v better-ccflare-data:/data \
145
+ ghcr.io/tombii/better-ccflare:latest
146
+
147
+ # View logs
148
+ docker logs -f better-ccflare
149
+
150
+ # Manage accounts
151
+ docker exec -it better-ccflare better-ccflare --add-account myaccount
152
+ docker exec -it better-ccflare better-ccflare --list
153
+ ```
154
+
155
+ **Available Docker tags:**
156
+ - `latest` - Latest stable release
157
+ - `main` - Latest build from main branch
158
+ - `1.2.28`, `1.2`, `1` - Specific version tags
159
+ - `sha-abc123` - Commit-specific tags
160
+
161
+ See [DOCKER.md](DOCKER.md) for detailed Docker documentation.
162
+
133
163
  ## Configure Claude SDK
134
164
 
135
165
  ```bash
@@ -154,6 +184,176 @@ curl -X POST http://localhost:8080/api/accounts/$(curl -s http://localhost:8080/
154
184
  -d '{"customEndpoint": "https://your-custom-api.anthropic.com"}'
155
185
  ```
156
186
 
187
+ ### SSL/HTTPS Configuration
188
+
189
+ To enable HTTPS with better-ccflare, you'll need SSL certificates. Here are your options:
190
+
191
+ #### Option 1: Generate Self-Signed Certificates (Development/Local Use)
192
+
193
+ ```bash
194
+ # Generate a self-signed certificate on the better-ccflare host
195
+ openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes \
196
+ -subj "/C=US/ST=State/L=City/O=Organization/CN=yourhostname"
197
+
198
+ # Start better-ccflare with SSL
199
+ export SSL_KEY_PATH=/path/to/key.pem
200
+ export SSL_CERT_PATH=/path/to/cert.pem
201
+ better-ccflare
202
+
203
+ # Or use command line flags
204
+ better-ccflare --ssl-key /path/to/key.pem --ssl-cert /path/to/cert.pem
205
+ ```
206
+
207
+ **Trust the self-signed certificate on client machines:**
208
+
209
+ For self-signed certificates, you need to add the certificate to your system's trusted certificates:
210
+
211
+ - **Linux (Ubuntu/Debian):**
212
+ ```bash
213
+ # Copy cert.pem from the better-ccflare host to your client machine
214
+ sudo cp cert.pem /usr/local/share/ca-certificates/better-ccflare.crt
215
+ sudo update-ca-certificates
216
+ ```
217
+
218
+ - **Linux (Arch/Manjaro):**
219
+ ```bash
220
+ # Copy cert.pem from the better-ccflare host to your client machine
221
+ sudo cp cert.pem /etc/ca-certificates/trust-source/anchors/better-ccflare.crt
222
+ sudo trust extract-compat
223
+ ```
224
+
225
+ - **macOS:**
226
+ ```bash
227
+ # Copy cert.pem from the better-ccflare host to your client machine
228
+ sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain cert.pem
229
+ ```
230
+
231
+ - **Windows (PowerShell as Administrator):**
232
+ ```powershell
233
+ # Copy cert.pem from the better-ccflare host to your client machine
234
+ Import-Certificate -FilePath cert.pem -CertStoreLocation Cert:\LocalMachine\Root
235
+ ```
236
+
237
+ **Configure Claude Code to use the trusted certificate:**
238
+
239
+ After adding the certificate to your system's trusted store, configure your environment:
240
+
241
+ ```bash
242
+ # Add to your ~/.bashrc or ~/.zshrc
243
+ export NODE_OPTIONS="--use-system-ca"
244
+ export ANTHROPIC_BASE_URL=https://yourhostname:8080
245
+ ```
246
+
247
+ The `NODE_OPTIONS="--use-system-ca"` is **required** for Claude Code and other Node.js-based clients to use the system certificate store. Without this, Node.js will not trust your self-signed certificate even if it's in the system store.
248
+
249
+ #### Option 2: Use Production Certificates (Production/Remote Access)
250
+
251
+ If you're running better-ccflare on a server with a domain name, use Let's Encrypt or your certificate provider:
252
+
253
+ ```bash
254
+ # Using Let's Encrypt certificates
255
+ export SSL_KEY_PATH=/etc/letsencrypt/live/yourdomain.com/privkey.pem
256
+ export SSL_CERT_PATH=/etc/letsencrypt/live/yourdomain.com/fullchain.pem
257
+ better-ccflare
258
+
259
+ # Set the base URL to use HTTPS
260
+ export ANTHROPIC_BASE_URL=https://yourdomain.com:8080
261
+ ```
262
+
263
+ With production certificates from trusted CAs, you don't need `NODE_OPTIONS="--use-system-ca"` as they are already trusted.
264
+
265
+ #### Option 3: Docker with Traefik (Recommended for Production)
266
+
267
+ For Docker deployments, we recommend using [Traefik](https://traefik.io/) as a reverse proxy to handle TLS automatically with Let's Encrypt:
268
+
269
+ ```yaml
270
+ # docker-compose.yml
271
+ version: '3.8'
272
+
273
+ services:
274
+ traefik:
275
+ image: traefik:v3.0
276
+ command:
277
+ - "--api.insecure=true"
278
+ - "--providers.docker=true"
279
+ - "--entrypoints.web.address=:80"
280
+ - "--entrypoints.websecure.address=:443"
281
+ - "--certificatesresolvers.myresolver.acme.tlschallenge=true"
282
+ - "--certificatesresolvers.myresolver.acme.email=your-email@example.com"
283
+ - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
284
+ ports:
285
+ - "80:80"
286
+ - "443:443"
287
+ volumes:
288
+ - /var/run/docker.sock:/var/run/docker.sock:ro
289
+ - ./letsencrypt:/letsencrypt
290
+ restart: unless-stopped
291
+
292
+ better-ccflare:
293
+ image: ghcr.io/tombii/better-ccflare:latest
294
+ labels:
295
+ - "traefik.enable=true"
296
+ - "traefik.http.routers.ccflare.rule=Host(`your-domain.com`)"
297
+ - "traefik.http.routers.ccflare.entrypoints=websecure"
298
+ - "traefik.http.routers.ccflare.tls.certresolver=myresolver"
299
+ - "traefik.http.services.ccflare.loadbalancer.server.port=8080"
300
+ volumes:
301
+ - ~/.config/better-ccflare:/root/.config/better-ccflare
302
+ restart: unless-stopped
303
+ ```
304
+
305
+ **Benefits:**
306
+ - Automatic TLS certificate generation and renewal via Let's Encrypt
307
+ - No need to manually manage SSL certificates
308
+ - Built-in HTTP to HTTPS redirection
309
+ - Dashboard for monitoring (port 8080 on Traefik)
310
+
311
+ **Client Configuration:**
312
+ ```bash
313
+ export ANTHROPIC_BASE_URL=https://your-domain.com
314
+ ```
315
+
316
+ No `NODE_OPTIONS` needed - Traefik provides trusted certificates automatically!
317
+
318
+ #### Troubleshooting SSL Issues
319
+
320
+ **Problem:** "Unable to connect to API due to poor internet connection" error even with `ANTHROPIC_BASE_URL` set
321
+
322
+ **Solutions:**
323
+ 1. Verify the environment variable is set in the same shell/session:
324
+ ```bash
325
+ echo $ANTHROPIC_BASE_URL
326
+ echo $NODE_OPTIONS
327
+ ```
328
+
329
+ 2. Test the SSL connection manually:
330
+ ```bash
331
+ # Should succeed without errors
332
+ curl https://yourhostname:8080/health
333
+
334
+ # If you see certificate errors, the cert isn't trusted yet
335
+ curl -k https://yourhostname:8080/health # -k bypasses cert check for testing
336
+ ```
337
+
338
+ 3. Verify the certificate is in the system store:
339
+ ```bash
340
+ # Linux
341
+ ls -la /etc/ssl/certs/ | grep better-ccflare
342
+
343
+ # macOS
344
+ security find-certificate -a -c yourhostname -p /Library/Keychains/System.keychain
345
+ ```
346
+
347
+ 4. Ensure the hostname resolves correctly:
348
+ ```bash
349
+ ping yourhostname
350
+ ```
351
+
352
+ 5. Check that the server is actually running:
353
+ ```bash
354
+ curl -k https://yourhostname:8080/health
355
+ ```
356
+
157
357
  ## Features
158
358
 
159
359
  ### 🎯 Intelligent Load Balancing
@@ -257,6 +457,7 @@ Full documentation available in [`docs/`](docs/):
257
457
  Inspired by [snipeship/ccflare](https://github.com/snipeship/ccflare) - thanks for the original idea and implementation!
258
458
 
259
459
  **Special thanks to our contributors:**
460
+ - [@bitcoin4cashqc](https://github.com/bitcoin4cashqc) - SSL/HTTPS support implementation with comprehensive documentation
260
461
  - [@anonym-uz](https://github.com/anonym-uz) - Critical auto-pause bug fix, analytics performance optimizations, request body truncation, and incremental vacuum implementation
261
462
  - [@makhweeb](https://github.com/makhweeb) - Enhanced request handling and analytics improvements
262
463
 
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-ccflare",
3
- "version": "1.2.28",
3
+ "version": "1.2.30",
4
4
  "description": "Load balancer proxy for Claude API with intelligent distribution across multiple OAuth accounts to avoid rate limiting",
5
5
  "author": "snipeship",
6
6
  "license": "MIT",
@@ -32,13 +32,14 @@
32
32
  "node": ">=18.0.0"
33
33
  },
34
34
  "devDependencies": {
35
+ "@types/node": "^20.0.0",
36
+ "@types/react": "^19.0.0",
35
37
  "ink": "^6.0.0",
36
38
  "ink-select-input": "^6.0.0",
37
39
  "ink-spinner": "^5.0.0",
38
40
  "ink-text-input": "^6.0.0",
39
41
  "react": "^19.0.0",
40
- "@types/react": "^19.0.0",
41
- "@types/node": "^20.0.0"
42
+ "react-devtools-core": "^7.0.1"
42
43
  },
43
44
  "files": [
44
45
  "dist/better-ccflare",