antigravity-claude-proxy 2.4.4 → 2.5.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 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
 
@@ -132,7 +130,10 @@ You can configure these settings in two ways:
132
130
 
133
131
  1. Open the WebUI at `http://localhost:8080`.
134
132
  2. Go to **Settings** → **Claude CLI**.
135
- 3. Select your preferred models and click **Apply to Claude CLI**.
133
+ 3. Use the **Connection Mode** toggle to switch between:
134
+ - **Proxy Mode**: Uses the local proxy server (Antigravity Cloud Code). Configure models, base URL, and presets here.
135
+ - **Paid Mode**: Uses the official Anthropic Credits directly (requires your own subscription). This hides proxy settings to prevent accidental misconfiguration.
136
+ 4. Click **Apply to Claude CLI** to save your changes.
136
137
 
137
138
  > [!TIP] > **Configuration Precedence**: System environment variables (set in shell profile like `.zshrc`) take precedence over the `settings.json` file. If you use the Web Console to manage settings, ensure you haven't manually exported conflicting variables in your terminal.
138
139
 
@@ -221,6 +222,18 @@ claude
221
222
 
222
223
  > **Note:** If Claude Code asks you to select a login method, add `"hasCompletedOnboarding": true` to `~/.claude.json` (macOS/Linux) or `%USERPROFILE%\.claude.json` (Windows), then restart your terminal and try again.
223
224
 
225
+ ### Proxy Mode vs. Paid Mode
226
+
227
+ Toggle in **Settings** → **Claude CLI**:
228
+
229
+ | Feature | 🔌 Proxy Mode | 💳 Paid Mode |
230
+ | :--- | :--- | :--- |
231
+ | **Backend** | Local Server (Antigravity) | Official Anthropic Credits |
232
+ | **Cost** | Free (Google Cloud) | Paid (Anthropic Credits) |
233
+ | **Models** | Claude + Gemini | Claude Only |
234
+
235
+ **Paid Mode** automatically clears proxy settings so you can use your official Anthropic account directly.
236
+
224
237
  ### Multiple Claude Code Instances (Optional)
225
238
 
226
239
  To run both the official Claude Code and Antigravity version simultaneously, add this alias:
@@ -248,384 +261,20 @@ Then run `claude` for official API or `claude-antigravity` for this proxy.
248
261
 
249
262
  ---
250
263
 
251
- ## Available Models
252
-
253
- ### Claude Models
254
-
255
- | Model ID | Description |
256
- | ---------------------------- | ---------------------------------------- |
257
- | `claude-sonnet-4-5-thinking` | Claude Sonnet 4.5 with extended thinking |
258
- | `claude-opus-4-5-thinking` | Claude Opus 4.5 with extended thinking |
259
- | `claude-sonnet-4-5` | Claude Sonnet 4.5 without thinking |
260
-
261
- ### Gemini Models
262
-
263
- | Model ID | Description |
264
- | ------------------- | ------------------------------- |
265
- | `gemini-3-flash` | Gemini 3 Flash with thinking |
266
- | `gemini-3-pro-low` | Gemini 3 Pro Low with thinking |
267
- | `gemini-3-pro-high` | Gemini 3 Pro High with thinking |
268
-
269
- Gemini models include full thinking support with `thoughtSignature` handling for multi-turn conversations.
270
-
271
- ---
272
-
273
- ## Multi-Account Load Balancing
274
-
275
- When you add multiple accounts, the proxy intelligently distributes requests across them using configurable selection strategies.
276
-
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, quota awareness, 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
- - **Quota Awareness**: Accounts with critical quota (<5%) are deprioritized; exhausted accounts trigger emergency fallback
302
- - **Emergency Fallback**: When all accounts appear exhausted, bypasses checks with throttle delays (250-500ms)
303
- - **Automatic Cooldown**: Rate-limited accounts recover automatically after reset time expires
304
- - **Invalid Account Detection**: Accounts needing re-authentication are marked and skipped
305
- - **Prompt Caching Support**: Session IDs derived from conversation enable cache hits across turns
306
-
307
- ### Monitoring
308
-
309
- Check account status, subscription tiers, and quota anytime:
310
-
311
- ```bash
312
- # Web UI: http://localhost:8080/ (Accounts tab - shows tier badges and quota progress)
313
- # CLI Table:
314
- curl "http://localhost:8080/account-limits?format=table"
315
- ```
316
-
317
- #### CLI Management Reference
318
-
319
- If you prefer using the terminal for management:
320
-
321
- ```bash
322
- # List all accounts
323
- antigravity-claude-proxy accounts list
324
-
325
- # Verify account health
326
- antigravity-claude-proxy accounts verify
327
-
328
- # Interactive CLI menu
329
- antigravity-claude-proxy accounts
330
- ```
331
-
332
- ---
333
-
334
- ## Web Management Console
335
-
336
- The proxy includes a built-in, modern web interface for real-time monitoring and configuration. Access the console at: `http://localhost:8080` (default port).
337
-
338
- ![Antigravity Console](images/webui-dashboard.png)
339
-
340
- ### Key Features
341
-
342
- - **Real-time Dashboard**: Monitor request volume, active accounts, model health, and subscription tier distribution.
343
- - **Visual Model Quota**: Track per-model usage and next reset times with color-coded progress indicators.
344
- - **Account Management**: Add/remove Google accounts via OAuth, view subscription tiers (Free/Pro/Ultra) and quota status at a glance.
345
- - **Manual OAuth Mode**: Add accounts on headless servers by copying the OAuth URL and pasting the authorization code.
346
- - **Claude CLI Configuration**: Edit your `~/.claude/settings.json` directly from the browser.
347
- - **Persistent History**: Tracks request volume by model family for 30 days, persisting across server restarts.
348
- - **Time Range Filtering**: Analyze usage trends over 1H, 6H, 24H, 7D, or All Time periods.
349
- - **Smart Analysis**: Auto-select top 5 most used models or toggle between Family/Model views.
350
- - **Live Logs**: Stream server logs with level-based filtering and search.
351
- - **Advanced Tuning**: Configure retries, timeouts, and debug mode on the fly.
352
- - **Multi-language Interface**: Full support for English, Chinese (中文), Indonesian (Bahasa), and Portuguese (PT-BR).
353
-
354
- ---
355
-
356
- ## Advanced Configuration
357
-
358
- 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.
359
-
360
- ### Configurable Options
361
-
362
- - **API Key Authentication**: Protect `/v1/*` API endpoints with `API_KEY` env var or `apiKey` in config.
363
- - **WebUI Password**: Secure your dashboard with `WEBUI_PASSWORD` env var or in config.
364
- - **Custom Port**: Change the default `8080` port.
365
- - **Retry Logic**: Configure `maxRetries`, `retryBaseMs`, and `retryMaxMs`.
366
- - **Rate Limit Handling**: Comprehensive rate limit detection from headers and error messages with intelligent retry-after parsing.
367
- - **Load Balancing**: Adjust `defaultCooldownMs` and `maxWaitBeforeErrorMs`.
368
- - **Persistence**: Enable `persistTokenCache` to save OAuth sessions across restarts.
369
- - **Max Accounts**: Set `maxAccounts` (1-100) to limit the number of Google accounts. Default: 10.
370
- - **Endpoint Fallback**: Automatic 403/404 endpoint fallback for API compatibility.
371
-
372
- Refer to `config.example.json` for a complete list of fields and documentation.
373
-
374
- ---
375
-
376
- ## macOS Menu Bar App
377
-
378
- 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)
379
-
380
- > **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.
381
-
382
- ![AntiGravity Claude Proxy Bar](https://github.com/IrvanFza/antigravity-claude-proxy-bar/blob/main/images/application.png?raw=true)
383
-
384
- ### Key Features
385
-
386
- - **Server Control**: Start/stop the proxy server with a single click or ⌘S shortcut.
387
- - **Status Indicator**: Menu bar icon shows server running state at a glance.
388
- - **WebUI Access**: Open the web management console directly from the menu.
389
- - **Port Configuration**: Customize the proxy server port (default: 8080).
390
- - **Account Selection Strategy**: Choose between Hybrid, Sticky, or Round-Robin load balancing strategies.
391
- - **Auto-Start Options**: Launch server on app start and launch app at login.
392
- - **Native Experience**: Clean, native SwiftUI interface designed for macOS.
393
-
394
- ---
395
-
396
- ## API Endpoints
397
-
398
- | Endpoint | Method | Description |
399
- | ----------------- | ------ | --------------------------------------------------------------------- |
400
- | `/health` | GET | Health check |
401
- | `/account-limits` | GET | Account status and quota limits (add `?format=table` for ASCII table) |
402
- | `/v1/messages` | POST | Anthropic Messages API |
403
- | `/v1/models` | GET | List available models |
404
- | `/refresh-token` | POST | Force token refresh |
405
-
406
- ---
407
-
408
- ## Testing
409
-
410
- Run the test suite (requires server running):
411
-
412
- ```bash
413
- # Start server in one terminal
414
- npm start
415
-
416
- # Run tests in another terminal
417
- npm test
418
- ```
419
-
420
- Individual tests:
421
-
422
- ```bash
423
- npm run test:signatures # Thinking signatures
424
- npm run test:multiturn # Multi-turn with tools
425
- npm run test:streaming # Streaming SSE events
426
- npm run test:interleaved # Interleaved thinking
427
- npm run test:images # Image processing
428
- npm run test:caching # Prompt caching
429
- npm run test:strategies # Account selection strategies
430
- npm run test:cache-control # Cache control field stripping
431
- ```
432
-
433
- ---
434
-
435
- ## Troubleshooting
436
-
437
- ### Windows: OAuth Port Error (EACCES)
438
-
439
- On Windows, the default OAuth callback port (51121) may be reserved by Hyper-V, WSL2, or Docker. If you see:
440
-
441
- ```
442
- Error: listen EACCES: permission denied 0.0.0.0:51121
443
- ```
444
-
445
- The proxy will automatically try fallback ports (51122-51126). If all ports fail, try these solutions:
446
-
447
- #### Option 1: Use a Custom Port (Recommended)
448
-
449
- Set a custom port outside the reserved range:
450
-
451
- ```bash
452
- # Windows PowerShell
453
- $env:OAUTH_CALLBACK_PORT = "3456"
454
- antigravity-claude-proxy start
455
-
456
- # Windows CMD
457
- set OAUTH_CALLBACK_PORT=3456
458
- antigravity-claude-proxy start
459
-
460
- # Or add to your .env file
461
- OAUTH_CALLBACK_PORT=3456
462
- ```
463
-
464
- #### Option 2: Reset Windows NAT
465
-
466
- Run as Administrator:
467
-
468
- ```powershell
469
- net stop winnat
470
- net start winnat
471
- ```
472
-
473
- #### Option 3: Check Reserved Ports
474
-
475
- See which ports are reserved:
476
-
477
- ```powershell
478
- netsh interface ipv4 show excludedportrange protocol=tcp
479
- ```
480
-
481
- If 51121 is in a reserved range, use Option 1 with a port outside those ranges.
482
-
483
- #### Option 4: Permanently Exclude Port (Admin)
484
-
485
- Reserve the port before Hyper-V claims it (run as Administrator):
486
-
487
- ```powershell
488
- netsh int ipv4 add excludedportrange protocol=tcp startport=51121 numberofports=1
489
- ```
490
-
491
- > **Note:** The server automatically tries fallback ports (51122-51126) if the primary port fails.
492
-
493
- ---
494
-
495
- ### "Could not extract token from Antigravity"
496
-
497
- If using single-account mode with Antigravity:
498
-
499
- 1. Make sure Antigravity app is installed and running
500
- 2. Ensure you're logged in to Antigravity
501
-
502
- Or add accounts via OAuth instead: `antigravity-claude-proxy accounts add`
503
-
504
- ### 401 Authentication Errors
505
-
506
- The token might have expired. Try:
507
-
508
- ```bash
509
- curl -X POST http://localhost:8080/refresh-token
510
- ```
511
-
512
- Or re-authenticate the account:
513
-
514
- ```bash
515
- antigravity-claude-proxy accounts
516
- ```
517
-
518
- ### Rate Limiting (429)
519
-
520
- 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.
521
-
522
- ### Account Shows as "Invalid"
523
-
524
- Re-authenticate the account:
525
-
526
- ```bash
527
- antigravity-claude-proxy accounts
528
- # Choose "Re-authenticate" for the invalid account
529
- ```
530
-
531
- ---
532
-
533
- ## Safety, Usage, and Risk Notices
534
-
535
- ### Intended Use
536
-
537
- - Personal / internal development only
538
- - Respect internal quotas and data handling policies
539
- - Not for production services or bypassing intended limits
540
-
541
- ### Not Suitable For
542
-
543
- - Production application traffic
544
- - High-volume automated extraction
545
- - Any use that violates Acceptable Use Policies
546
-
547
- ### Warning (Assumption of Risk)
548
-
549
- By using this software, you acknowledge and accept the following:
550
-
551
- - **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.
552
-
553
- - **Account risk**: Providers may detect this usage pattern and take punitive action, including suspension, permanent ban, or loss of access to paid subscriptions.
554
-
555
- - **No guarantees**: Providers may change APIs, authentication, or policies at any time, which can break this method without notice.
556
-
557
- - **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.
558
-
559
- **Use at your own risk. Proceed only if you understand and accept these risks.**
560
-
561
- ---
562
-
563
- ## Legal
564
-
565
- - **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.
566
-
567
- - "Antigravity", "Gemini", "Google Cloud", and "Google" are trademarks of Google LLC.
568
-
569
- - "Claude" and "Anthropic" are trademarks of Anthropic PBC.
570
-
571
- - Software is provided "as is", without warranty. You are responsible for complying with all applicable Terms of Service and Acceptable Use Policies.
572
-
573
- ---
574
-
575
- ## Development
576
-
577
- ### For Developers & Contributors
578
-
579
- 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.
580
-
581
- #### Quick Start
582
-
583
- ```bash
584
- git clone https://github.com/badri-s2001/antigravity-claude-proxy.git
585
- cd antigravity-claude-proxy
586
- npm install # Automatically builds CSS via prepare hook
587
- npm start # Start server (no rebuild needed)
588
- ```
589
-
590
- #### Frontend Development
591
-
592
- If you need to modify styles in `public/css/src/input.css`:
593
-
594
- ```bash
595
- # Option 1: Build once
596
- npm run build:css
597
-
598
- # Option 2: Watch for changes (auto-rebuild)
599
- npm run watch:css
600
-
601
- # Option 3: Watch both CSS and server (recommended)
602
- npm run dev:full
603
- ```
604
-
605
- **File Structure:**
606
- - `public/css/src/input.css` - Source CSS with Tailwind `@apply` directives (edit this)
607
- - `public/css/style.css` - Compiled & minified CSS (auto-generated, don't edit)
608
- - `tailwind.config.js` - Tailwind configuration
609
- - `postcss.config.js` - PostCSS configuration
610
-
611
- #### Backend-Only Development
612
-
613
- If you're only working on backend code and don't need frontend dev tools:
614
-
615
- ```bash
616
- npm install --production # Skip devDependencies (saves ~20MB)
617
- npm start
618
- ```
619
-
620
- **Note:** Pre-compiled CSS is committed to the repository, so you don't need to rebuild unless modifying styles.
621
-
622
- #### Project Structure
623
-
624
- See [CLAUDE.md](./CLAUDE.md) for detailed architecture documentation, including:
625
- - Request flow and module organization
626
- - Frontend architecture (Alpine.js + Tailwind)
627
- - Service layer patterns (`ErrorHandler.withLoading`, `AccountActions`)
628
- - 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)
629
278
 
630
279
  ---
631
280
 
@@ -644,6 +293,8 @@ MIT
644
293
 
645
294
  ---
646
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
+
647
298
  ## Star History
648
299
 
649
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.4.4",
3
+ "version": "2.5.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",