antigravity-claude-proxy 2.5.0 → 2.6.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.
package/README.md CHANGED
@@ -4,9 +4,7 @@
4
4
  [![npm downloads](https://img.shields.io/npm/dm/antigravity-claude-proxy.svg)](https://www.npmjs.com/package/antigravity-claude-proxy)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
6
 
7
- <a href="https://buymeacoffee.com/badrinarayanans" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="50"></a>
8
-
9
- A proxy server that exposes an **Anthropic-compatible API** backed by **Antigravity's Cloud Code**, letting you use Claude and Gemini models with **Claude Code CLI**.
7
+ A proxy server that exposes an **Anthropic-compatible API** backed by **Antigravity's Cloud Code**, letting you use Claude and Gemini models with **Claude Code CLI** and **OpenClaw / ClawdBot**.
10
8
 
11
9
  ![Antigravity Claude Proxy Banner](images/banner.png)
12
10
 
@@ -263,387 +261,20 @@ Then run `claude` for official API or `claude-antigravity` for this proxy.
263
261
 
264
262
  ---
265
263
 
266
- ## Available Models
267
-
268
- ### Claude Models
269
-
270
- | Model ID | Description |
271
- | ---------------------------- | ---------------------------------------- |
272
- | `claude-sonnet-4-5-thinking` | Claude Sonnet 4.5 with extended thinking |
273
- | `claude-opus-4-5-thinking` | Claude Opus 4.5 with extended thinking |
274
- | `claude-sonnet-4-5` | Claude Sonnet 4.5 without thinking |
275
-
276
- ### Gemini Models
277
-
278
- | Model ID | Description |
279
- | ------------------- | ------------------------------- |
280
- | `gemini-3-flash` | Gemini 3 Flash with thinking |
281
- | `gemini-3-pro-low` | Gemini 3 Pro Low with thinking |
282
- | `gemini-3-pro-high` | Gemini 3 Pro High with thinking |
283
-
284
- Gemini models include full thinking support with `thoughtSignature` handling for multi-turn conversations.
285
-
286
- ---
287
-
288
- ## Multi-Account Load Balancing
289
-
290
- When you add multiple accounts, the proxy intelligently distributes requests across them using configurable selection strategies.
291
-
292
- ### Account Selection Strategies
293
-
294
- Choose a strategy based on your needs:
295
-
296
- | Strategy | Best For | Description |
297
- | --- | --- | --- |
298
- | **Hybrid** (Default) | Most users | Smart selection combining health score, token bucket rate limiting, quota awareness, and LRU freshness |
299
- | **Sticky** | Prompt caching | Stays on the same account to maximize cache hits, switches only when rate-limited |
300
- | **Round-Robin** | Even distribution | Cycles through accounts sequentially for balanced load |
301
-
302
- **Configure via CLI:**
303
-
304
- ```bash
305
- antigravity-claude-proxy start --strategy=hybrid # Default: smart distribution
306
- antigravity-claude-proxy start --strategy=sticky # Cache-optimized
307
- antigravity-claude-proxy start --strategy=round-robin # Load-balanced
308
- ```
309
-
310
- **Or via WebUI:** Settings → Server → Account Selection Strategy
311
-
312
- ### How It Works
313
-
314
- - **Health Score Tracking**: Accounts earn points for successful requests and lose points for failures/rate-limits
315
- - **Token Bucket Rate Limiting**: Client-side throttling with regenerating tokens (50 max, 6/minute)
316
- - **Quota Awareness**: Accounts below configurable quota thresholds are deprioritized; exhausted accounts trigger emergency fallback
317
- - **Quota Protection**: Set minimum quota levels globally, per-account, or per-model to switch accounts before quota runs out
318
- - **Emergency Fallback**: When all accounts appear exhausted, bypasses checks with throttle delays (250-500ms)
319
- - **Automatic Cooldown**: Rate-limited accounts recover automatically after reset time expires
320
- - **Invalid Account Detection**: Accounts needing re-authentication are marked and skipped
321
- - **Prompt Caching Support**: Session IDs derived from conversation enable cache hits across turns
322
-
323
- ### Monitoring
324
-
325
- Check account status, subscription tiers, and quota anytime:
326
-
327
- ```bash
328
- # Web UI: http://localhost:8080/ (Accounts tab - shows tier badges and quota progress)
329
- # CLI Table:
330
- curl "http://localhost:8080/account-limits?format=table"
331
- ```
332
-
333
- #### CLI Management Reference
334
-
335
- If you prefer using the terminal for management:
336
-
337
- ```bash
338
- # List all accounts
339
- antigravity-claude-proxy accounts list
340
-
341
- # Verify account health
342
- antigravity-claude-proxy accounts verify
343
-
344
- # Interactive CLI menu
345
- antigravity-claude-proxy accounts
346
- ```
347
-
348
- ---
349
-
350
- ## Web Management Console
351
-
352
- The proxy includes a built-in, modern web interface for real-time monitoring and configuration. Access the console at: `http://localhost:8080` (default port).
353
-
354
- ![Antigravity Console](images/webui-dashboard.png)
355
-
356
- ### Key Features
357
-
358
- - **Real-time Dashboard**: Monitor request volume, active accounts, model health, and subscription tier distribution.
359
- - **Visual Model Quota**: Track per-model usage and next reset times with color-coded progress indicators and draggable per-account threshold markers.
360
- - **Account Management**: Add/remove Google accounts via OAuth, view subscription tiers (Free/Pro/Ultra), quota status, and per-account threshold settings.
361
- - **Manual OAuth Mode**: Add accounts on headless servers by copying the OAuth URL and pasting the authorization code.
362
- - **Claude CLI Configuration**: Edit your `~/.claude/settings.json` directly from the browser.
363
- - **Persistent History**: Tracks request volume by model family for 30 days, persisting across server restarts.
364
- - **Time Range Filtering**: Analyze usage trends over 1H, 6H, 24H, 7D, or All Time periods.
365
- - **Smart Analysis**: Auto-select top 5 most used models or toggle between Family/Model views.
366
- - **Live Logs**: Stream server logs with level-based filtering and search.
367
- - **Quota Protection**: Set global or per-account minimum quota thresholds to proactively switch accounts before quota runs out.
368
- - **Advanced Tuning**: Configure retries, timeouts, and debug mode on the fly.
369
- - **Multi-language Interface**: Full support for English, Chinese (中文), Indonesian (Bahasa), Portuguese (PT-BR), and Turkish (Türkçe).
370
-
371
- ---
372
-
373
- ## Advanced Configuration
374
-
375
- While most users can use the default settings, you can tune the proxy behavior via the **Settings → Server** tab in the WebUI or by creating a `config.json` file.
376
-
377
- ### Configurable Options
378
-
379
- - **API Key Authentication**: Protect `/v1/*` API endpoints with `API_KEY` env var or `apiKey` in config.
380
- - **WebUI Password**: Secure your dashboard with `WEBUI_PASSWORD` env var or in config.
381
- - **Custom Port**: Change the default `8080` port.
382
- - **Retry Logic**: Configure `maxRetries`, `retryBaseMs`, and `retryMaxMs`.
383
- - **Rate Limit Handling**: Comprehensive rate limit detection from headers and error messages with intelligent retry-after parsing.
384
- - **Load Balancing**: Adjust `defaultCooldownMs` and `maxWaitBeforeErrorMs`.
385
- - **Persistence**: Enable `persistTokenCache` to save OAuth sessions across restarts.
386
- - **Max Accounts**: Set `maxAccounts` (1-100) to limit the number of Google accounts. Default: 10.
387
- - **Quota Threshold**: Set `globalQuotaThreshold` (0-0.99) to switch accounts before quota drops below a minimum level. Supports per-account and per-model overrides.
388
- - **Endpoint Fallback**: Automatic 403/404 endpoint fallback for API compatibility.
389
-
390
- Refer to `config.example.json` for a complete list of fields and documentation.
391
-
392
- ---
393
-
394
- ## macOS Menu Bar App
395
-
396
- For macOS users who prefer a native experience, there's a companion menu bar app that provides quick access to server controls without touching the terminal. Get it from: [antigravity-claude-proxy-bar](https://github.com/IrvanFza/antigravity-claude-proxy-bar)
397
-
398
- > **Note:** This is a GUI wrapper only. You still need to install and setup the proxy server first using one of the [installation methods](#installation) above.
399
-
400
- ![AntiGravity Claude Proxy Bar](https://github.com/IrvanFza/antigravity-claude-proxy-bar/blob/main/images/application.png?raw=true)
401
-
402
- ### Key Features
403
-
404
- - **Server Control**: Start/stop the proxy server with a single click or ⌘S shortcut.
405
- - **Status Indicator**: Menu bar icon shows server running state at a glance.
406
- - **WebUI Access**: Open the web management console directly from the menu.
407
- - **Port Configuration**: Customize the proxy server port (default: 8080).
408
- - **Account Selection Strategy**: Choose between Hybrid, Sticky, or Round-Robin load balancing strategies.
409
- - **Auto-Start Options**: Launch server on app start and launch app at login.
410
- - **Native Experience**: Clean, native SwiftUI interface designed for macOS.
411
-
412
- ---
413
-
414
- ## API Endpoints
415
-
416
- | Endpoint | Method | Description |
417
- | ----------------- | ------ | --------------------------------------------------------------------- |
418
- | `/health` | GET | Health check |
419
- | `/account-limits` | GET | Account status and quota limits (add `?format=table` for ASCII table) |
420
- | `/v1/messages` | POST | Anthropic Messages API |
421
- | `/v1/models` | GET | List available models |
422
- | `/refresh-token` | POST | Force token refresh |
423
-
424
- ---
425
-
426
- ## Testing
427
-
428
- Run the test suite (requires server running):
429
-
430
- ```bash
431
- # Start server in one terminal
432
- npm start
433
-
434
- # Run tests in another terminal
435
- npm test
436
- ```
437
-
438
- Individual tests:
439
-
440
- ```bash
441
- npm run test:signatures # Thinking signatures
442
- npm run test:multiturn # Multi-turn with tools
443
- npm run test:streaming # Streaming SSE events
444
- npm run test:interleaved # Interleaved thinking
445
- npm run test:images # Image processing
446
- npm run test:caching # Prompt caching
447
- npm run test:strategies # Account selection strategies
448
- npm run test:cache-control # Cache control field stripping
449
- ```
450
-
451
- ---
452
-
453
- ## Troubleshooting
454
-
455
- ### Windows: OAuth Port Error (EACCES)
456
-
457
- On Windows, the default OAuth callback port (51121) may be reserved by Hyper-V, WSL2, or Docker. If you see:
458
-
459
- ```
460
- Error: listen EACCES: permission denied 0.0.0.0:51121
461
- ```
462
-
463
- The proxy will automatically try fallback ports (51122-51126). If all ports fail, try these solutions:
464
-
465
- #### Option 1: Use a Custom Port (Recommended)
466
-
467
- Set a custom port outside the reserved range:
468
-
469
- ```bash
470
- # Windows PowerShell
471
- $env:OAUTH_CALLBACK_PORT = "3456"
472
- antigravity-claude-proxy start
473
-
474
- # Windows CMD
475
- set OAUTH_CALLBACK_PORT=3456
476
- antigravity-claude-proxy start
477
-
478
- # Or add to your .env file
479
- OAUTH_CALLBACK_PORT=3456
480
- ```
481
-
482
- #### Option 2: Reset Windows NAT
483
-
484
- Run as Administrator:
485
-
486
- ```powershell
487
- net stop winnat
488
- net start winnat
489
- ```
490
-
491
- #### Option 3: Check Reserved Ports
492
-
493
- See which ports are reserved:
494
-
495
- ```powershell
496
- netsh interface ipv4 show excludedportrange protocol=tcp
497
- ```
498
-
499
- If 51121 is in a reserved range, use Option 1 with a port outside those ranges.
500
-
501
- #### Option 4: Permanently Exclude Port (Admin)
502
-
503
- Reserve the port before Hyper-V claims it (run as Administrator):
504
-
505
- ```powershell
506
- netsh int ipv4 add excludedportrange protocol=tcp startport=51121 numberofports=1
507
- ```
508
-
509
- > **Note:** The server automatically tries fallback ports (51122-51126) if the primary port fails.
510
-
511
- ---
512
-
513
- ### "Could not extract token from Antigravity"
514
-
515
- If using single-account mode with Antigravity:
516
-
517
- 1. Make sure Antigravity app is installed and running
518
- 2. Ensure you're logged in to Antigravity
519
-
520
- Or add accounts via OAuth instead: `antigravity-claude-proxy accounts add`
521
-
522
- ### 401 Authentication Errors
523
-
524
- The token might have expired. Try:
525
-
526
- ```bash
527
- curl -X POST http://localhost:8080/refresh-token
528
- ```
529
-
530
- Or re-authenticate the account:
531
-
532
- ```bash
533
- antigravity-claude-proxy accounts
534
- ```
535
-
536
- ### Rate Limiting (429)
537
-
538
- With multiple accounts, the proxy automatically switches to the next available account. With a single account, you'll need to wait for the rate limit to reset.
539
-
540
- ### Account Shows as "Invalid"
541
-
542
- Re-authenticate the account:
543
-
544
- ```bash
545
- antigravity-claude-proxy accounts
546
- # Choose "Re-authenticate" for the invalid account
547
- ```
548
-
549
- ---
550
-
551
- ## Safety, Usage, and Risk Notices
552
-
553
- ### Intended Use
554
-
555
- - Personal / internal development only
556
- - Respect internal quotas and data handling policies
557
- - Not for production services or bypassing intended limits
558
-
559
- ### Not Suitable For
560
-
561
- - Production application traffic
562
- - High-volume automated extraction
563
- - Any use that violates Acceptable Use Policies
564
-
565
- ### Warning (Assumption of Risk)
566
-
567
- By using this software, you acknowledge and accept the following:
568
-
569
- - **Terms of Service risk**: This approach may violate the Terms of Service of AI model providers (Anthropic, Google, etc.). You are solely responsible for ensuring compliance with all applicable terms and policies.
570
-
571
- - **Account risk**: Providers may detect this usage pattern and take punitive action, including suspension, permanent ban, or loss of access to paid subscriptions.
572
-
573
- - **No guarantees**: Providers may change APIs, authentication, or policies at any time, which can break this method without notice.
574
-
575
- - **Assumption of risk**: You assume all legal, financial, and technical risks. The authors and contributors of this project bear no responsibility for any consequences arising from your use.
576
-
577
- **Use at your own risk. Proceed only if you understand and accept these risks.**
578
-
579
- ---
580
-
581
- ## Legal
582
-
583
- - **Not affiliated with Google or Anthropic.** This is an independent open-source project and is not endorsed by, sponsored by, or affiliated with Google LLC or Anthropic PBC.
584
-
585
- - "Antigravity", "Gemini", "Google Cloud", and "Google" are trademarks of Google LLC.
586
-
587
- - "Claude" and "Anthropic" are trademarks of Anthropic PBC.
588
-
589
- - Software is provided "as is", without warranty. You are responsible for complying with all applicable Terms of Service and Acceptable Use Policies.
590
-
591
- ---
592
-
593
- ## Development
594
-
595
- ### For Developers & Contributors
596
-
597
- This project uses a local Tailwind CSS build system. CSS is pre-compiled and included in the repository, so you can run the project immediately after cloning.
598
-
599
- #### Quick Start
600
-
601
- ```bash
602
- git clone https://github.com/badri-s2001/antigravity-claude-proxy.git
603
- cd antigravity-claude-proxy
604
- npm install # Automatically builds CSS via prepare hook
605
- npm start # Start server (no rebuild needed)
606
- ```
607
-
608
- #### Frontend Development
609
-
610
- If you need to modify styles in `public/css/src/input.css`:
611
-
612
- ```bash
613
- # Option 1: Build once
614
- npm run build:css
615
-
616
- # Option 2: Watch for changes (auto-rebuild)
617
- npm run watch:css
618
-
619
- # Option 3: Watch both CSS and server (recommended)
620
- npm run dev:full
621
- ```
622
-
623
- **File Structure:**
624
- - `public/css/src/input.css` - Source CSS with Tailwind `@apply` directives (edit this)
625
- - `public/css/style.css` - Compiled & minified CSS (auto-generated, don't edit)
626
- - `tailwind.config.js` - Tailwind configuration
627
- - `postcss.config.js` - PostCSS configuration
628
-
629
- #### Backend-Only Development
630
-
631
- If you're only working on backend code and don't need frontend dev tools:
632
-
633
- ```bash
634
- npm install --production # Skip devDependencies (saves ~20MB)
635
- npm start
636
- ```
637
-
638
- **Note:** Pre-compiled CSS is committed to the repository, so you don't need to rebuild unless modifying styles.
639
-
640
- #### Project Structure
641
-
642
- See [CLAUDE.md](./CLAUDE.md) for detailed architecture documentation, including:
643
- - Request flow and module organization
644
- - Frontend architecture (Alpine.js + Tailwind)
645
- - Service layer patterns (`ErrorHandler.withLoading`, `AccountActions`)
646
- - Dashboard module documentation
264
+ ## Documentation
265
+
266
+ - [Available Models](docs/models.md)
267
+ - [Multi-Account Load Balancing](docs/load-balancing.md)
268
+ - [Web Management Console](docs/web-console.md)
269
+ - [Advanced Configuration](docs/configuration.md)
270
+ - [macOS Menu Bar App](docs/menubar-app.md)
271
+ - [OpenClaw / ClawdBot Integration](docs/openclaw.md)
272
+ - [API Endpoints](docs/api-endpoints.md)
273
+ - [Testing](docs/testing.md)
274
+ - [Troubleshooting](docs/troubleshooting.md)
275
+ - [Safety, Usage, and Risk Notices](docs/safety-notices.md)
276
+ - [Legal](docs/legal.md)
277
+ - [Development](docs/development.md)
647
278
 
648
279
  ---
649
280
 
@@ -662,6 +293,8 @@ MIT
662
293
 
663
294
  ---
664
295
 
296
+ <a href="https://buymeacoffee.com/badrinarayanans" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="50"></a>
297
+
665
298
  ## Star History
666
299
 
667
300
  [![Star History Chart](https://api.star-history.com/svg?repos=badrisnarayanan/antigravity-claude-proxy&type=date&legend=top-left&cache-control=no-cache)](https://www.star-history.com/#badrisnarayanan/antigravity-claude-proxy&type=date&legend=top-left)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antigravity-claude-proxy",
3
- "version": "2.5.0",
3
+ "version": "2.6.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",