antigravity-claude-proxy 2.3.3 → 2.4.1
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 +10 -2
- package/package.json +3 -2
- package/public/app.js +1 -0
- package/public/css/style.css +1 -1
- package/public/index.html +46 -4
- package/public/js/components/account-manager.js +85 -0
- package/public/js/components/add-account-modal.js +88 -0
- package/public/js/components/server-config.js +0 -6
- package/public/js/config/constants.js +0 -4
- package/public/js/translations/en.js +18 -2
- package/public/js/translations/id.js +18 -2
- package/public/js/translations/pt.js +23 -2
- package/public/js/translations/tr.js +18 -2
- package/public/js/translations/zh.js +18 -2
- package/public/views/accounts.html +22 -0
- package/public/views/settings.html +4 -28
- package/src/account-manager/index.js +82 -1
- package/src/account-manager/rate-limits.js +132 -0
- package/src/account-manager/strategies/base-strategy.js +5 -0
- package/src/account-manager/strategies/hybrid-strategy.js +70 -22
- package/src/account-manager/strategies/trackers/health-tracker.js +1 -1
- package/src/auth/oauth.js +28 -7
- package/src/cli/accounts.js +3 -1
- package/src/cloudcode/message-handler.js +188 -72
- package/src/cloudcode/rate-limit-parser.js +60 -6
- package/src/cloudcode/streaming-handler.js +186 -71
- package/src/config.js +5 -0
- package/src/constants.js +30 -7
- package/src/format/request-converter.js +9 -2
- package/src/format/thinking-utils.js +92 -2
- package/src/index.js +2 -1
- package/src/webui/index.js +182 -7
package/README.md
CHANGED
|
@@ -84,6 +84,8 @@ Choose one of the following methods to authorize the proxy:
|
|
|
84
84
|
2. Navigate to the **Accounts** tab and click **Add Account**.
|
|
85
85
|
3. Complete the Google OAuth authorization in the popup window.
|
|
86
86
|
|
|
87
|
+
> **Headless/Remote Servers**: If running on a server without a browser, the WebUI supports a "Manual Authorization" mode. After clicking "Add Account", you can copy the OAuth URL, complete authorization on your local machine, and paste the authorization code back.
|
|
88
|
+
|
|
87
89
|
#### **Method B: CLI (Desktop or Headless)**
|
|
88
90
|
|
|
89
91
|
If you prefer the terminal or are on a remote server:
|
|
@@ -280,7 +282,7 @@ Choose a strategy based on your needs:
|
|
|
280
282
|
|
|
281
283
|
| Strategy | Best For | Description |
|
|
282
284
|
| --- | --- | --- |
|
|
283
|
-
| **Hybrid** (Default) | Most users | Smart selection combining health score, token bucket rate limiting, and LRU freshness |
|
|
285
|
+
| **Hybrid** (Default) | Most users | Smart selection combining health score, token bucket rate limiting, quota awareness, and LRU freshness |
|
|
284
286
|
| **Sticky** | Prompt caching | Stays on the same account to maximize cache hits, switches only when rate-limited |
|
|
285
287
|
| **Round-Robin** | Even distribution | Cycles through accounts sequentially for balanced load |
|
|
286
288
|
|
|
@@ -298,6 +300,8 @@ antigravity-claude-proxy start --strategy=round-robin # Load-balanced
|
|
|
298
300
|
|
|
299
301
|
- **Health Score Tracking**: Accounts earn points for successful requests and lose points for failures/rate-limits
|
|
300
302
|
- **Token Bucket Rate Limiting**: Client-side throttling with regenerating tokens (50 max, 6/minute)
|
|
303
|
+
- **Quota Awareness**: Accounts with critical quota (<5%) are deprioritized; exhausted accounts trigger emergency fallback
|
|
304
|
+
- **Emergency Fallback**: When all accounts appear exhausted, bypasses checks with throttle delays (250-500ms)
|
|
301
305
|
- **Automatic Cooldown**: Rate-limited accounts recover automatically after reset time expires
|
|
302
306
|
- **Invalid Account Detection**: Accounts needing re-authentication are marked and skipped
|
|
303
307
|
- **Prompt Caching Support**: Session IDs derived from conversation enable cache hits across turns
|
|
@@ -340,13 +344,14 @@ The proxy includes a built-in, modern web interface for real-time monitoring and
|
|
|
340
344
|
- **Real-time Dashboard**: Monitor request volume, active accounts, model health, and subscription tier distribution.
|
|
341
345
|
- **Visual Model Quota**: Track per-model usage and next reset times with color-coded progress indicators.
|
|
342
346
|
- **Account Management**: Add/remove Google accounts via OAuth, view subscription tiers (Free/Pro/Ultra) and quota status at a glance.
|
|
347
|
+
- **Manual OAuth Mode**: Add accounts on headless servers by copying the OAuth URL and pasting the authorization code.
|
|
343
348
|
- **Claude CLI Configuration**: Edit your `~/.claude/settings.json` directly from the browser.
|
|
344
349
|
- **Persistent History**: Tracks request volume by model family for 30 days, persisting across server restarts.
|
|
345
350
|
- **Time Range Filtering**: Analyze usage trends over 1H, 6H, 24H, 7D, or All Time periods.
|
|
346
351
|
- **Smart Analysis**: Auto-select top 5 most used models or toggle between Family/Model views.
|
|
347
352
|
- **Live Logs**: Stream server logs with level-based filtering and search.
|
|
348
353
|
- **Advanced Tuning**: Configure retries, timeouts, and debug mode on the fly.
|
|
349
|
-
- **
|
|
354
|
+
- **Multi-language Interface**: Full support for English, Chinese (中文), Indonesian (Bahasa), and Portuguese (PT-BR).
|
|
350
355
|
|
|
351
356
|
---
|
|
352
357
|
|
|
@@ -360,9 +365,11 @@ While most users can use the default settings, you can tune the proxy behavior v
|
|
|
360
365
|
- **WebUI Password**: Secure your dashboard with `WEBUI_PASSWORD` env var or in config.
|
|
361
366
|
- **Custom Port**: Change the default `8080` port.
|
|
362
367
|
- **Retry Logic**: Configure `maxRetries`, `retryBaseMs`, and `retryMaxMs`.
|
|
368
|
+
- **Rate Limit Handling**: Comprehensive rate limit detection from headers and error messages with intelligent retry-after parsing.
|
|
363
369
|
- **Load Balancing**: Adjust `defaultCooldownMs` and `maxWaitBeforeErrorMs`.
|
|
364
370
|
- **Persistence**: Enable `persistTokenCache` to save OAuth sessions across restarts.
|
|
365
371
|
- **Max Accounts**: Set `maxAccounts` (1-100) to limit the number of Google accounts. Default: 10.
|
|
372
|
+
- **Endpoint Fallback**: Automatic 403/404 endpoint fallback for API compatibility.
|
|
366
373
|
|
|
367
374
|
Refer to `config.example.json` for a complete list of fields and documentation.
|
|
368
375
|
|
|
@@ -421,6 +428,7 @@ npm run test:interleaved # Interleaved thinking
|
|
|
421
428
|
npm run test:images # Image processing
|
|
422
429
|
npm run test:caching # Prompt caching
|
|
423
430
|
npm run test:strategies # Account selection strategies
|
|
431
|
+
npm run test:cache-control # Cache control field stripping
|
|
424
432
|
```
|
|
425
433
|
|
|
426
434
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antigravity-claude-proxy",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
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",
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
"test:oauth": "node tests/test-oauth-no-browser.cjs",
|
|
36
36
|
"test:emptyretry": "node tests/test-empty-response-retry.cjs",
|
|
37
37
|
"test:sanitizer": "node tests/test-schema-sanitizer.cjs",
|
|
38
|
-
"test:strategies": "node tests/test-strategies.cjs"
|
|
38
|
+
"test:strategies": "node tests/test-strategies.cjs",
|
|
39
|
+
"test:cache-control": "node tests/test-cache-control.cjs"
|
|
39
40
|
},
|
|
40
41
|
"keywords": [
|
|
41
42
|
"claude",
|
package/public/app.js
CHANGED
|
@@ -13,6 +13,7 @@ document.addEventListener('alpine:init', () => {
|
|
|
13
13
|
Alpine.data('accountManager', window.Components.accountManager);
|
|
14
14
|
Alpine.data('claudeConfig', window.Components.claudeConfig);
|
|
15
15
|
Alpine.data('logsViewer', window.Components.logsViewer);
|
|
16
|
+
Alpine.data('addAccountModal', window.Components.addAccountModal);
|
|
16
17
|
|
|
17
18
|
// View Loader Directive
|
|
18
19
|
Alpine.directive('load-view', (el, { expression }, { evaluate }) => {
|