[UNTESTED] [avnijainnn/Stream-guarded-ML-gateway] 1 endpoint(s)
ChatGPT
API Proxy/ChatGPT
2,145 characters
Status: [UNTESTED]
Endpoints found:
http://localhost:8080/v1/chat/completions
Source: https://github.com/avnijainnn/Stream-guarded-ML-gateway
# Stream-Guarded ML Gateway
High-performance streaming reverse proxy in front of a vLLM-compatible OpenAI API. The gateway intercepts the SSE token stream, windows chunks through an async buffer, and runs a lightweight spaCy grounding check against a JSON facts file. If a claim conflict is detected mid-stream, the client receives an immediate `grounding_abort` event and the upstream generation is cancelled.
## Architecture
```
browser / client
| SSE
frontend :3000 (nginx)
|
gateway :8080 (Go)
|------------------+
| SSE reverse proxy |
v v
vLLM :8000 validator :8090
(mock or GPU) (spaCy + facts/*.json)
```
- **Speculative mode (default):** tokens are flushed to the client immediately for low TTFT. Validation runs on sentence/window boundaries; a violation aborts the live stream.
- **Strict mode (`GATE_MODE=strict`):** frames are held until the current window validates, then released.
## Quick deploy (CPU / mock vLLM)
This is the path that runs on a laptop without a GPU. The mock server speaks the OpenAI chat-completions streaming protocol so the proxy, validator, UI, and benchmark are real.
```bash
cp .env.example .env
docker compose up --build -d
```
If Docker is not installed, run a local CPU stack (Python gateway + mock vLLM):
```bash
pip install fastapi uvicorn pydantic httpx
# optional: pip install spacy && python -m spacy download en_core_web_sm
set FACTS_DIR=%cd%\facts
start python -m uvicorn --app-dir mock-vllm app:app --host 127.0.0.1 --port 8000
start python -m uvicorn --app-dir validator app:app --host 127.0.0.1 --port 8090
set VLLM_BASE_URL=http://127.0.0.1:8000
set VALIDATOR_URL=http://127.0.0.1:8090
python -m uvicorn --app-dir gateway pygateway:app --host 127.0.0.1 --port 8080
```
Then open http://localhost:8080 (UI is served by the gateway). On Windows you can also run `scripts\run_local.cmd`.
Open (Docker):
- UI + in-browser TTFT probe: http://localhost:3