Status: [UNTESTED] Endpoints found: http://127.0.0.1:8000/v1/chat/completions http://127.0.0.1:8000/v1/signup http://127.0.0.1:8000/v1/scan http://127.0.0.1:8000/v1/rag-integration http://127.0.0.1:8000/v1/usage Source: https://github.com/sangiya/ai-shield-cloud # AI Shield Cloud A multi-tenant hosted API around [`ai-shield`](../ai-shield): a REST scan endpoint, an OpenAI-compatible chat-completions proxy, API key auth, per-org usage tracking, self-serve signup, and Stripe billing — plus a Next.js dashboard — Phases 2 and 3 of the [plan](../ai-shield/PLAN.md). ## Why it exists - **The proxy is OpenAI-compatible on purpose.** `/v1/chat/completions` matches the OpenAI request/response shape, so integrating AI Shield into an existing app is a `base_url` change, not a rewrite — the single biggest adoption lever for a security product. - **A blocked request never reaches the LLM provider.** The user's message is scanned first; on `verdict == "block"` the proxy returns an OpenAI-error-shaped 400 immediately and never calls the upstream model — no wasted tokens, no risk of the injection reaching a real completion. - **PII is redacted on both sides of the call.** The user's message is redacted before being forwarded to the LLM provider, and the model's response is scanned and redacted again before it reaches the caller — a model can echo back PII it was never given the unredacted version of. - **API keys are hashed, never stored in plaintext.** Standard practice (the same shape Stripe/GitHub use): the raw key is shown exactly once, at creation time, and cannot be recovered from the database afterward. - **The app has no cloud-provider-specific code.** Config comes entirely from environment variables (`AI_SHIELD_CLOUD_DATABASE_URL`, etc.) — the same container image runs against local SQLite, a docker-compose Postgres, a managed RDS/Cloud SQL instance, or (Phase 4) a Kubernetes Postgres, with zero code changes. ## Architecture ``` ai_shield_cloud/ ├── config.py Settings from environment variables ├── db.py SQLAlchemy engine/session (StaticPool for in-memory tests) ├── models.py Org, ApiKey, ScanLog (the whole multi-tenant schema) ├─