npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cddchen/antigravityide2api

v1.2.0

Published

Antigravity IDE Agent API → Anthropic Messages compatible proxy

Readme

antigravityide2api

Export the locally logged-in Antigravity IDE session as an Anthropic-compatible /v1/messages HTTP API, designed for use with Claude Code or any other Anthropic API compatible client.


Prerequisites

  1. Antigravity IDE installed and logged in on your local machine;
  2. Node.js >= 18;
  3. (Recommended) ripgrep (rg): installed and available in $PATH if using fast file search via native tools.

Method 1: Direct Usage via npx (Recommended)

No manual clone or global installation required—run directly using npx.

1. Extract Local IDE Credentials

Ensure Antigravity IDE is open and logged in, then run:

npx @cddchen/antigravityide2api@latest extract-token

Note: This reads OAuth credentials from the local IDE database and stores them safely with 0600 permissions at ~/.antigravityide2api/token.json. You only need to run this on initial setup or when your session expires.

2. Start the Proxy Server

Foreground execution (logs stream directly to the terminal):

npx @cddchen/antigravityide2api@latest
# Or explicitly:
npx @cddchen/antigravityide2api@latest start-fg

Background daemon:

# Start background daemon
npx @cddchen/antigravityide2api@latest start

# Check process status and masked token info
npx @cddchen/antigravityide2api@latest status

# Stop background daemon
npx @cddchen/antigravityide2api@latest stop

3. (Optional) Install Globally

If you prefer calling antigravityide2api directly without npx:

npm i -g @cddchen/antigravityide2api@latest

# Then use the CLI directly:
antigravityide2api extract-token
antigravityide2api start
antigravityide2api status
antigravityide2api stop

Method 2: Run from Source (Development)

Recommended if you want to inspect the source code, develop features, or customize behavior.

1. Clone & Install Dependencies

git clone https://github.com/cddchen/antigravityide2api.git
cd antigravityide2api
npm install

2. Build

# Compile TypeScript to dist/
npm run build

# Or run compiler in watch mode during development
npm run dev

3. Extract Local IDE Credentials

npm run extract-token
# Equivalent to: node dist/cli.js extract-token

4. Start Server

Foreground execution:

npm start
# Equivalent to: node dist/cli.js start-fg

Background daemon:

node dist/cli.js start    # Start background daemon
node dist/cli.js status   # Check status
node dist/cli.js stop     # Stop daemon

Debug mode (with live logcat and prompt inspection):

PORT=4000 DUMP_SYSTEM=1 DEBUG=1 node dist/server.js

Once started, visit http://127.0.0.1:4000/logcat to inspect inbound /v1/messages, outbound Antigravity contents, and each upstream functionCall plus its bridge mapping in real time (same frame; no tokens).

5. Run Tests

npm test

Claude Code Configuration

By default, the server listens at http://127.0.0.1:3000. Configure Claude Code with the following environment variables before starting:

# Point Claude Code to the local proxy
export ANTHROPIC_BASE_URL=http://127.0.0.1:3000

# If no API_KEY is set on the server, any non-empty string satisfies client checks
export ANTHROPIC_AUTH_TOKEN=test

Then start Claude Code:

claude

Session Continuity & Concurrency: Claude Code automatically attaches X-Claude-Code-Session-Id header to requests. The proxy uses this header to maintain the upstream session trajectory (sessionId, cascadeUuid, trajectoryUuid, incrementing stepIndex) across both plain text and tool-use turns. The proxy does not cache conversation history transcripts locally; full request history is faithfully reconstructed on each turn. Non-blocking leases protect against concurrent request races, immediately responding with HTTP 409 if a request is already in progress for that session.


CLI Reference

Commands can be invoked via antigravityide2api <command> or npx @cddchen/antigravityide2api@latest <command>:

| Command | Description | |---------|-------------| | (no args) / start-fg | Start proxy server in the foreground | | start | Start background daemon; stores PID and logs in the token directory | | stop | Stop background daemon | | status | Display token path, masked account count, and process status | | extract-token | Read OAuth credentials from the local Antigravity IDE | | trim-words | List effective filter words (defaults ∪ file ∪ env) | | trim-words add/rm/clear | Persist extra filter words in the config directory | | -h / --help | Show CLI usage help |


Environment Variables

| Variable | Default | Description | |----------|---------|-------------| | PORT | 3000 | HTTP listening port | | HOST | 127.0.0.1 | HTTP listening address (defaults to loopback for security) | | API_KEY | Empty | When set, requests must provide matching x-api-key or Bearer token | | TOKEN_FILE | ~/.antigravityide2api/token.json | Path to the credentials file | | DEFAULT_MODEL | gemini-3.6-flash-high | Default upstream model | | WORKSPACE_ROOT | Empty | Allowed directory boundary for file modifications (Write/Edit) | | REQUEST_TIMEOUT | 300000 | Upstream request timeout in milliseconds | | PENDING_TIMEOUT | 600000 | Multi-turn tool execution pending session timeout in milliseconds | | SESSION_IDLE_TIMEOUT | 1800000 | Idle keyed session retention timeout in milliseconds (X-Claude-Code-Session-Id) | | ANTIGRAVITY_BASE | https://daily-cloudcode-pa.googleapis.com | Upstream API base endpoint | | IDE_VERSION | local product.json ideVersion | Metadata and User-Agent version (auto-detected from local IDE) | | ANTIGRAVITY_SYSTEM | trimmed | System prompt strategy: full / trimmed / short | | ANTIGRAVITY_TRIM_WORDS | Empty | Extra filter words (comma-separated or JSON array). Case-insensitive substring match; hits become equal-length zero-width spaces, not deleted as whole lines. Longer phrases win (claude code before claude). Built-in defaults (trimmed mode only) cover file:// and background-task phrases in communication_style. File: trim-words.json next to the token. Restart after changes. | | ANTIGRAVITY_MAX_RETRIES | 3 | Maximum retry attempts upon upstream 429 / 503 errors (0 disables retry) | | ANTIGRAVITY_RETRY_BASE_MS | 1000 | Base delay in milliseconds for exponential backoff | | ANTIGRAVITY_RETRY_MAX_MS | 30000 | Maximum cap for backoff delay in milliseconds |


Verification & API Endpoints

Once the server is running, you can test it directly via curl:

# 1. Health check
curl -s http://127.0.0.1:3000/health

# 2. Dynamic upstream model catalog
curl -s http://127.0.0.1:3000/v1/models | jq '.data[] | {id, display_name}'

# 3. Test non-streaming message
curl -s -X POST http://127.0.0.1:3000/v1/messages \
  -H "Content-Type: application/json" \
  -d '{"model":"gemini-3.6-flash-high","max_tokens":100,"messages":[{"role":"user","content":"Hello"}]}'

Security & Disclaimer

  • For personal educational use and interaction with your own authenticated local session only. Use at your own risk.
  • Credential extraction is strictly read-only; it never modifies or writes back to the Antigravity IDE database.
  • The exported token.json is protected with 0600 file permissions. Never commit or share your token file.