better-ccflare 1.1.6 → 1.1.9

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 ADDED
@@ -0,0 +1,149 @@
1
+ # better-ccflare 🛡️
2
+
3
+ **Track Every Request. Go Low-Level. Never Hit Rate Limits Again.**
4
+
5
+ The ultimate Claude API proxy with intelligent load balancing across multiple accounts. Full visibility into every request, response, and rate limit.
6
+
7
+
8
+ https://github.com/user-attachments/assets/c859872f-ca5e-4f8b-b6a0-7cc7461fe62a
9
+
10
+
11
+ ![better-ccflare Dashboard](apps/lander/src/screenshot-dashboard.png)
12
+
13
+ ## Why better-ccflare?
14
+
15
+ - **🚀 Zero Rate Limit Errors** - Automatically distribute requests across multiple accounts
16
+ - **🤖 Supports z.ai coder plan** - Setup Claude and z.ai coder accounts and prioritize in which order they are used
17
+ - **🔗 Custom API Endpoints** - Configure custom endpoints for Anthropic and Zai accounts for enterprise deployments
18
+ - **🔄 Smart Auto-Fallback** - Automatically switch back to preferred accounts when their rate limits reset
19
+ - **⚡ Auto-Refresh** - Automatically start new usage windows when rate limits reset
20
+ - **📊 Request-Level Analytics** - Track latency, token usage, and costs in real-time with optimized batch processing
21
+ - **🔍 Deep Debugging** - Full request/response logging and error traces
22
+ - **⚡ <10ms Overhead** - Minimal performance impact with lazy loading and request deduplication
23
+ - **💸 Free & Open Source** - Run it yourself, modify it, own your infrastructure
24
+
25
+ ## Quick Start
26
+
27
+ ### Install via npm
28
+
29
+ ```bash
30
+ npm install -g better-ccflare
31
+
32
+ # Start better-ccflare (TUI + Server)
33
+ better-ccflare
34
+ ```
35
+
36
+ ### Install from source
37
+
38
+ ```bash
39
+ # Clone and install
40
+ git clone https://github.com/tombii/better-ccflare
41
+ cd better-ccflare
42
+ bun install
43
+
44
+ # Start better-ccflare (TUI + Server)
45
+ bun run better-ccflare
46
+
47
+ # Configure Claude SDK
48
+ export ANTHROPIC_BASE_URL=http://localhost:8080
49
+
50
+ # Add multiple accounts with priorities
51
+ better-ccflare --add-account primary --mode max --tier 20 --priority 0
52
+ better-ccflare --add-account secondary --mode max --tier 20 --priority 10
53
+
54
+ # Enable auto-fallback on your primary account (via API)
55
+ curl -X POST http://localhost:8080/api/accounts/$(curl -s http://localhost:8080/api/accounts | jq -r '.[0].id')/auto-fallback \
56
+ -H "Content-Type: application/json" \
57
+ -d '{"enabled": 1}'
58
+
59
+ # Configure custom endpoint for an account (via API)
60
+ curl -X POST http://localhost:8080/api/accounts/$(curl -s http://localhost:8080/api/accounts | jq -r '.[0].id')/custom-endpoint \
61
+ -H "Content-Type: application/json" \
62
+ -d '{"customEndpoint": "https://your-custom-api.anthropic.com"}'
63
+ ```
64
+
65
+ ## Features
66
+
67
+ ### 🎯 Intelligent Load Balancing
68
+ - **Session-based** - Maintain conversation context (5hr sessions)
69
+ - **Auto-fallback** - Automatically switch back to higher priority accounts when their usage windows reset
70
+ - **Auto-refresh** - Automatically start new usage windows when they reset
71
+
72
+ ### 📈 Real-Time Analytics
73
+ - Token usage tracking per request with optimized batch processing
74
+ - Response time monitoring with intelligent caching
75
+ - Rate limit detection and warnings
76
+ - Cost estimation and budgeting
77
+ - Request deduplication for improved performance
78
+ - Lazy-loaded analytics components for faster initial load
79
+
80
+ ### 🛠️ Developer Tools
81
+ - Interactive TUI (`bun run better-ccflare`)
82
+ - Web dashboard (`http://localhost:8080/dashboard`)
83
+ - CLI for account management
84
+ - REST API for automation
85
+
86
+ ### 🔒 Production Ready
87
+ - Automatic failover between accounts
88
+ - OAuth token refresh handling
89
+ - SQLite database for persistence
90
+ - Configurable retry logic
91
+ - Custom endpoint support for enterprise deployments
92
+ - Enhanced performance with request batching and caching
93
+
94
+ ## Documentation
95
+
96
+ Full documentation available in [`docs/`](docs/):
97
+ - [Getting Started](docs/index.md)
98
+ - [Architecture](docs/architecture.md)
99
+ - [API Reference](docs/api-http.md)
100
+ - [Configuration](docs/configuration.md)
101
+ - [Load Balancing Strategies](docs/load-balancing.md)
102
+ - [Auto-Fallback Guide](docs/auto-fallback.md)
103
+ - [Auto-Refresh Guide](docs/auto-refresh.md)
104
+
105
+ ## Screenshots
106
+
107
+ <table>
108
+ <tr>
109
+ <td><img src="apps/lander/src/screenshot-dashboard.png" alt="Dashboard"/></td>
110
+ <td><img src="apps/lander/src/screenshot-logs.png" alt="Logs"/></td>
111
+ </tr>
112
+ <tr>
113
+ <td align="center"><b>Real-time Dashboard</b></td>
114
+ <td align="center"><b>Request Logs</b></td>
115
+ </tr>
116
+ <tr>
117
+ <td colspan="2"><img src="apps/lander/src/screenshot-analytics.png" alt="Analytics"/></td>
118
+ </tr>
119
+ <tr>
120
+ <td colspan="2" align="center"><b>Analytics & Usage Tracking</b></td>
121
+ </tr>
122
+ </table>
123
+
124
+ ## Requirements
125
+
126
+ - [Bun](https://bun.sh) >= 1.2.8
127
+ - Claude API accounts (Free, Pro, or Team) or z.ai code plan accounts
128
+
129
+ ## Acknowledgments
130
+
131
+ Inspired by [snipeship/ccflare](https://github.com/snipeship/ccflare) - thanks for the original idea and implementation!
132
+
133
+ ## Contributing
134
+
135
+ We welcome contributions! See [CONTRIBUTING.md](docs/contributing.md) for guidelines.
136
+
137
+ ## License
138
+
139
+ MIT - See [LICENSE](LICENSE) for details
140
+
141
+ ---
142
+
143
+ <p align="center">
144
+ Built with ❤️ for developers who ship
145
+ </p>
146
+
147
+ [![Mentioned in Awesome Claude Code](https://awesome.re/mentioned-badge-flat.svg)](https://github.com/hesreallyhim/awesome-claude-code)
148
+
149
+ [![Mentioned in Awesome Claude Code](https://awesome.re/mentioned-badge.svg)](https://github.com/hesreallyhim/awesome-claude-code)
Binary file
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "better-ccflare",
3
- "version": "1.1.6",
3
+ "version": "1.1.9",
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",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/tombii/better-ccflare.git"
9
+ "url": "git+https://github.com/tombii/better-ccflare.git"
10
10
  },
11
11
  "homepage": "https://github.com/tombii/better-ccflare#readme",
12
12
  "bugs": {
13
13
  "url": "https://github.com/tombii/better-ccflare/issues"
14
14
  },
15
15
  "bin": {
16
- "better-ccflare": "./dist/better-ccflare"
16
+ "better-ccflare": "dist/better-ccflare"
17
17
  },
18
18
  "type": "module",
19
19
  "scripts": {
20
20
  "dev": "bun run src/main.ts",
21
21
  "build": "bun build src/main.ts --compile --outfile dist/better-ccflare --target=bun",
22
- "prepublishOnly": "bun run build",
22
+ "prepublishOnly": "cp ../../README.md . && bun run build",
23
23
  "postpublish": "chmod +x dist/better-ccflare"
24
24
  },
25
25
  "engines": {
@@ -45,7 +45,8 @@
45
45
  "react-devtools-core": "^5.0.0"
46
46
  },
47
47
  "files": [
48
- "dist"
48
+ "dist",
49
+ "README.md"
49
50
  ],
50
51
  "keywords": [
51
52
  "claude",