antigravity-claude-proxy 2.1.0 → 2.2.0

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 (44) hide show
  1. package/README.md +31 -6
  2. package/package.json +3 -2
  3. package/public/css/src/input.css +0 -2
  4. package/public/css/style.css +1 -1
  5. package/public/index.html +0 -1
  6. package/public/js/components/server-config.js +97 -0
  7. package/public/js/config/constants.js +21 -1
  8. package/public/js/data-store.js +0 -7
  9. package/public/js/translations/en.js +24 -0
  10. package/public/js/translations/id.js +25 -0
  11. package/public/js/translations/pt.js +26 -0
  12. package/public/js/translations/tr.js +26 -0
  13. package/public/js/translations/zh.js +25 -0
  14. package/public/js/utils/account-actions.js +0 -10
  15. package/public/js/utils/error-handler.js +0 -50
  16. package/public/js/utils/validators.js +0 -93
  17. package/public/views/settings.html +157 -0
  18. package/src/account-manager/index.js +91 -41
  19. package/src/account-manager/strategies/base-strategy.js +104 -0
  20. package/src/account-manager/strategies/hybrid-strategy.js +195 -0
  21. package/src/account-manager/strategies/index.js +85 -0
  22. package/src/account-manager/strategies/round-robin-strategy.js +76 -0
  23. package/src/account-manager/strategies/sticky-strategy.js +138 -0
  24. package/src/account-manager/strategies/trackers/health-tracker.js +162 -0
  25. package/src/account-manager/strategies/trackers/index.js +8 -0
  26. package/src/account-manager/strategies/trackers/token-bucket-tracker.js +121 -0
  27. package/src/cli/accounts.js +13 -9
  28. package/src/cloudcode/message-handler.js +163 -37
  29. package/src/cloudcode/streaming-handler.js +162 -34
  30. package/src/config.js +21 -2
  31. package/src/constants.js +21 -11
  32. package/src/errors.js +36 -1
  33. package/src/format/request-converter.js +10 -0
  34. package/src/format/signature-cache.js +0 -34
  35. package/src/format/thinking-utils.js +5 -5
  36. package/src/index.js +49 -13
  37. package/src/server.js +66 -10
  38. package/src/utils/helpers.js +0 -29
  39. package/src/utils/logger.js +0 -3
  40. package/src/webui/index.js +11 -1
  41. package/public/js/app-init.js +0 -140
  42. package/public/js/components/model-manager.js +0 -47
  43. package/src/account-manager/selection.js +0 -201
  44. package/src/utils/retry.js +0 -161
package/README.md CHANGED
@@ -272,13 +272,37 @@ Gemini models include full thinking support with `thoughtSignature` handling for
272
272
 
273
273
  ## Multi-Account Load Balancing
274
274
 
275
- When you add multiple accounts, the proxy automatically:
275
+ When you add multiple accounts, the proxy intelligently distributes requests across them using configurable selection strategies.
276
276
 
277
- - **Sticky account selection**: Stays on the same account to maximize prompt cache hits
278
- - **Smart rate limit handling**: Waits for short rate limits (≤2 min), switches accounts for longer ones
279
- - **Automatic cooldown**: Rate-limited accounts become available after reset time expires
280
- - **Invalid account detection**: Accounts needing re-authentication are marked and skipped
281
- - **Prompt caching support**: Stable session IDs enable cache hits across conversation turns
277
+ ### Account Selection Strategies
278
+
279
+ Choose a strategy based on your needs:
280
+
281
+ | Strategy | Best For | Description |
282
+ | --- | --- | --- |
283
+ | **Hybrid** (Default) | Most users | Smart selection combining health score, token bucket rate limiting, and LRU freshness |
284
+ | **Sticky** | Prompt caching | Stays on the same account to maximize cache hits, switches only when rate-limited |
285
+ | **Round-Robin** | Even distribution | Cycles through accounts sequentially for balanced load |
286
+
287
+ **Configure via CLI:**
288
+
289
+ ```bash
290
+ antigravity-claude-proxy start --strategy=hybrid # Default: smart distribution
291
+ antigravity-claude-proxy start --strategy=sticky # Cache-optimized
292
+ antigravity-claude-proxy start --strategy=round-robin # Load-balanced
293
+ ```
294
+
295
+ **Or via WebUI:** Settings → Server → Account Selection Strategy
296
+
297
+ ### How It Works
298
+
299
+ - **Health Score Tracking**: Accounts earn points for successful requests and lose points for failures/rate-limits
300
+ - **Token Bucket Rate Limiting**: Client-side throttling with regenerating tokens (50 max, 6/minute)
301
+ - **Automatic Cooldown**: Rate-limited accounts recover automatically after reset time expires
302
+ - **Invalid Account Detection**: Accounts needing re-authentication are marked and skipped
303
+ - **Prompt Caching Support**: Session IDs derived from conversation enable cache hits across turns
304
+
305
+ ### Monitoring
282
306
 
283
307
  Check account status, subscription tiers, and quota anytime:
284
308
 
@@ -395,6 +419,7 @@ npm run test:streaming # Streaming SSE events
395
419
  npm run test:interleaved # Interleaved thinking
396
420
  npm run test:images # Image processing
397
421
  npm run test:caching # Prompt caching
422
+ npm run test:strategies # Account selection strategies
398
423
  ```
399
424
 
400
425
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antigravity-claude-proxy",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Proxy server to use Antigravity's Claude models with Claude Code CLI",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -34,7 +34,8 @@
34
34
  "test:crossmodel": "node tests/test-cross-model-thinking.cjs",
35
35
  "test:oauth": "node tests/test-oauth-no-browser.cjs",
36
36
  "test:emptyretry": "node tests/test-empty-response-retry.cjs",
37
- "test:sanitizer": "node tests/test-schema-sanitizer.cjs"
37
+ "test:sanitizer": "node tests/test-schema-sanitizer.cjs",
38
+ "test:strategies": "node tests/test-strategies.cjs"
38
39
  },
39
40
  "keywords": [
40
41
  "claude",
@@ -115,8 +115,6 @@
115
115
  animation: fadeIn 0.4s ease-out forwards;
116
116
  }
117
117
 
118
- /* Note: .glass-panel has been deprecated. Use .view-card instead for consistency. */
119
-
120
118
  .nav-item.active {
121
119
  background: linear-gradient(
122
120
  90deg,