Metadata-Version: 2.4
Name: antigravity-proxy
Version: 0.1.3
Summary: OpenAI-compatible FastAPI wrapper for the Antigravity agy CLI
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 wrapper that accepts OpenAI-compatible requests and invokes the local `agy` CLI. A chat request passes its requested model to `agy --model <model> --prompt <prompt>`. `/v1/models` runs `agy models` and exposes the returned model IDs. Antigravity CLI handles sign-in; model names are passed through unchanged.

## Run on Termux (Android)

The `agy` command must already be installed, available in Termux's `PATH`, and signed in. Install the proxy from PyPI:

```sh
pkg update
pkg install python
python -m pip install --upgrade antigravity-proxy
antigravity-proxy --web
```

Then open `http://127.0.0.1:8091/index.html` in a browser. The UI gets the model list from `agy models` and sends chat requests through the same local proxy. The `--web` mode binds only to `127.0.0.1:8091`. To run the API without the UI, start `antigravity-proxy`; it listens on port 8000 by default.

To configure the CLI executable or API port, create a `.env` file in the directory where you start the command. Defaults are `AGY_EXECUTABLE=agy` and `PROXY_PORT=8000`:

```sh
printf 'AGY_EXECUTABLE=agy\nPROXY_PORT=8000\n' > .env
```

To run from an unpacked source checkout instead, install its dependencies with `python -m pip install .` and start it with `python main.py --web`.

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` runs `agy models` and returns HTTP 200 if the command succeeds, or 503 if it cannot start or returns an error. Chat requests execute `agy --model <model> --prompt <prompt>` without shell interpolation. Streaming requests are returned as SSE while stdout is produced by the CLI.
