Metadata-Version: 2.4
Name: antigravity-proxy
Version: 0.1.1
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. For a chat request selecting `claude-sonnet-4-6`, it runs `agy --model claude-sonnet-4-6 --prompt "..."`. `/v1/models` runs `agy models` and exposes the returned model IDs. The CLI owns sign-in/OAuth; model names are passed through unchanged.

## Run on Termux (Android)

Install Python and unzip in Termux if needed. The `agy` command must already be installed, available in Termux's `PATH`, and signed in:

```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
```

The defaults are `AGY_EXECUTABLE=agy` and `PROXY_PORT=8000`. Change these in `.env` if needed. 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` 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.

## 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.
