@pedrofariasx/antigravity-openai-adapter
v1.0.5
Published
OpenAI-compatible API adapter for antigravity-claude-proxy. Converts OpenAI Chat Completions format to Anthropic Messages API format.
Maintainers
Readme
AGO Adapter (Antigravity OpenAI Adapter)
An adapter that exposes an OpenAI-compatible API to communicate with antigravity-claude-proxy. This allows using applications that expect the OpenAI API with Claude and Gemini models available through Antigravity.
How it Works
┌──────────────────┐ ┌─────────────────────┐ ┌────────────────────────────┐
│ OpenAI-enabled │────▶│ This Adapter │────▶│ antigravity-claude-proxy │
│ Application │ │ (OpenAI → Anthropic│ │ (Anthropic → Google │
│ (Chat API) │ │ format) │ │ Generative AI) │
└──────────────────┘ └─────────────────────┘ └────────────────────────────┘- Receives requests in OpenAI Chat Completions API format.
- Converts to Anthropic Messages API format.
- Forwards to antigravity-claude-proxy.
- Converts responses back to OpenAI format.
- Supports full streaming (SSE).
- Automatic Proxy Management: Can automatically start the upstream proxy if it's running on localhost.
- Transparent Routing: Unknown routes (like WebUI) are automatically proxied to the upstream.
Prerequisites
- Node.js 18 or higher
- antigravity-claude-proxy (automatically handled if on localhost, otherwise needs to be running)
Installation
Option 1: npm / npx
# Run directly with npx (automatic proxy start)
npx @pedrofariasx/antigravity-openai-adapter start
# Or install globally
npm install -g @pedrofariasx/antigravity-openai-adapter
antigravity-openai-adapter startOption 2: Docker
# Using Docker Compose
docker-compose up -d
# Using Docker Stack (Swarm)
docker stack deploy -c docker-stack.yml antigravityOption 3: Clone Repository
git clone https://github.com/pedrofariasx/antigravity-openai-adapter
cd antigravity-openai-adapter
npm install
npm startQuick Start
1. Start the Adapter
npx @pedrofariasx/antigravity-openai-adapter startBy default, the adapter will:
- Start on
http://localhost:8081. - Check if
antigravity-claude-proxyis needed. - Automatically run
npx antigravity-claude-proxy@latest startif the upstream is configured tolocalhost. - Proxy all non-API requests (like the WebUI) to the upstream proxy.
2. Use with OpenAI Applications
Configure your application to use:
Base URL: http://localhost:8081/v1
API Key: any-value (or your configured API_KEY)API Endpoints
| Endpoint | Method | Description |
|----------|--------|-----------|
| /v1/chat/completions | POST | Chat Completions (main) |
| /v1/models | GET | List available models |
| /health | GET | Health Check |
| /* | * | Proxied to antigravity-claude-proxy (WebUI, etc) |
Configuration
The adapter supports configuration via config.json, environment variables, or CLI arguments. It also supports .env files.
Environment Variables
| Variable | Description | Default |
|----------|-----------|--------|
| PORT | Server port | 8081 |
| UPSTREAM_URL | antigravity-claude-proxy URL | http://localhost:8080 |
| API_KEY | API Key for this adapter | - |
| UPSTREAM_API_KEY | API Key for upstream proxy | test |
| AUTO_START_PROXY | Auto-start proxy via npx | true |
| DEBUG | Enable debug logging | false |
CLI Arguments
antigravity-openai-adapter start --port=3000 --upstream=http://localhost:9000 --no-proxy --debug--no-proxy: Disables automatic starting of the upstream proxy.
Features Supported
✅ Supported
- Chat Completions API
- Streaming (SSE)
- System messages
- Multi-turn conversations
- Tool/Function calling
- Vision (Images)
- Temperature, top_p, max_tokens, stop sequences
- Unified routing for API and WebUI
❌ Not Supported
- Embeddings (
/v1/embeddings) - Legacy Completions (
/v1/completions) - Assistants API, Files API, Fine-tuning
Development
# Clone and install
git clone https://github.com/pedrofariasx/antigravity-openai-adapter
cd antigravity-openai-adapter
npm install
# Run in development mode (with watch)
npm run dev
# Run tests
npm testLicense
MIT
