feat: reuse agy CLI token + --no-webui + /anthropic prefix alias + schema fix - #360
Open
AntonIXO wants to merge 1 commit into
Open
feat: reuse agy CLI token + --no-webui + /anthropic prefix alias + schema fix#360AntonIXO wants to merge 1 commit into
AntonIXO wants to merge 1 commit into
Conversation
Add support for importing and reusing the Antigravity CLI (agy) OAuth token, so the proxy can authenticate without a separate browser OAuth flow or a full Antigravity IDE installation. Key changes: - New 'agy' account source: reads ~/.gemini/antigravity-cli/antigravity-oauth-token and refreshes the token using the same OAuth client_id/secret the proxy already hardcodes (agy uses the same Google OAuth client). Optional write-back of refreshed access tokens via AGY_TOKEN_WRITEBACK=1. - CLI command 'import-agy' (npm run accounts:import-agy) to import the agy token, resolve the account email, and save it as source='agy'. - --no-webui flag (or DISABLE_WEBUI/NO_WEBUI env vars) to disable the WebUI for headless/API-only deployments, saving ~30-50MB RAM. - /anthropic prefix alias: rewrites /anthropic/v1/* → /v1/* so third-party tools (e.g. Hermes Agent) that auto-detect Anthropic-compatible endpoints via URL suffix heuristic work out of the box. - Schema sanitizer fix: convert non-string enum/const values to strings (Google Cloud Code API rejects boolean/number enum values with TYPE_STRING errors). Co-authored-by: Anton Ivanov <antonix@devpins.org>
Author
|
Rewrote to golang to better match antigravity patters and performance: https://github.com/AntonIXO/antigravity-claude-proxy-go |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds three features that make the proxy work headlessly alongside the Antigravity CLI (agy) and third-party tools like Hermes Agent:
1. Reuse agy CLI OAuth Token (source: 'agy')
The standalone Antigravity CLI (agy) stores its Google OAuth token at ~/.gemini/antigravity-cli/antigravity-oauth-token. Crucially, agy uses the same Google OAuth client_id + client_secret that this proxy already hardcodes in OAUTH_CONFIG. This means the proxy can refresh agy's refresh_token directly — no separate browser OAuth flow and no full Antigravity IDE installation required.
This is the same pattern used by hermes-claude-auth (reusing ~/.claude/.credentials.json) and opencode-antigravity-auth.
New CLI command:
```bash
npm run accounts:import-agy
AGY_TOKEN_PATH=/custom/path npm run accounts:import-agy
```
New env vars:
2. --no-webui Flag
Disables the WebUI for headless servers. Saves ~30-50MB RAM.
```bash
npm start -- --no-webui
DISABLE_WEBUI=1 npm start
```
3. /anthropic Prefix Alias
Third-party tools (e.g. Hermes Agent) auto-detect Anthropic-compatible endpoints via URL suffix heuristic (/anthropic). This PR adds middleware that rewrites /anthropic/v1/* → /v1/*.
4. Schema Sanitizer Fix
Google's Cloud Code API rejects non-string enum values. The schema sanitizer was converting const: true (boolean) to enum: [true] (boolean array), which Google rejected. This PR converts all enum/const values to strings.
Testing