Metadata-Version: 2.4
Name: antigravity-proxy
Version: 0.1.0
Summary: OpenAI-compatible FastAPI pass-through proxy for the local Antigravity listener
Author: Antigravity Proxy contributors
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Framework :: FastAPI
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: fastapi>=0.110
Requires-Dist: uvicorn>=0.27
Requires-Dist: httpx>=0.27
Requires-Dist: python-dotenv>=1.0

# Antigravity OpenAI-Compatible Proxy

A small FastAPI reverse proxy that passes OpenAI-compatible `/v1/*` requests directly to the local Antigravity listener at `http://127.0.0.1:8901/v1`. It preserves the requested model name and request body, and streams Server-Sent Events. Antigravity CLI/service owns sign-in and OAuth; this proxy does not obtain credentials or alter model names. If Antigravity is signed in, its listener handles the authenticated request.

## Run on Termux (Android)

Install Python and unzip in Termux if needed:

```sh
pkg update
pkg install python unzip
```

Unzip the project, enter its folder, install the package and dependencies, then start it:

```sh
unzip antigravity-proxy.zip
cd antigravity-proxy
cp .env.example .env
python -m pip install .
antigravity-proxy
```

Keep the Antigravity CLI/service running and listening at the configured local URL. The defaults are `ANTIGRAVITY_LOCAL_URL=http://127.0.0.1:8901/v1` and `PROXY_PORT=8000`. To change them, edit `.env` before starting the proxy. For a local development run instead of installing, use `python main.py`.

Test the proxy:

```sh
curl http://127.0.0.1:8000/health
curl http://127.0.0.1:8000/v1/models
curl -N http://127.0.0.1:8000/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{"model":"YOUR_MODEL","messages":[{"role":"user","content":"Hello"}],"stream":true}'
```

`/health` checks the upstream `/v1/models` endpoint and returns HTTP 200 on success or 503 if the listener is unavailable or returns an error. The proxy deliberately removes incoming `Authorization` headers; use Antigravity's own signed-in listener.

## Build and upload to PyPI from Termux

PyPI does not accept a project-source ZIP as a Twine upload. Twine uploads the source distribution and wheel built from this project. From the unzipped project directory:

```sh
python -m pip install --upgrade build twine
python -m build
python -m twine upload dist/*
```

Twine will prompt for credentials. For a PyPI API token, enter `__token__` as the username and the complete token (including the `pypi-` prefix) as the password. Create the project/token on PyPI first. The name `antigravity-proxy` must be available on PyPI; if it is already taken, change `project.name` in `pyproject.toml` to an available name and rebuild before uploading.
