> ## Documentation Index
> Fetch the complete documentation index at: https://docs.promptguard.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Self-Host vs Cloud

> An honest capability matrix of PromptGuard Cloud versus Self-hosted (Hybrid or Air-gapped), what is identical, what differs, why some parts are cloud-only.

> [!NOTE]
>
> The **detection engine is the same binary** in every Deployment mode. There are three: **Cloud** (we run everything), **Hybrid** (the engine runs on your servers and reports to our dashboard) and **Air-gapped** (engine and dashboard both run on your servers). "Self-hosted" below means Hybrid or Air-gapped; where the two differ, the row names the mode. Self-hosting does not give you a cut-down firewall, the `/guard` engine, policy enforcement, audit trail, and RBAC run on your servers. What differs is the *managed* surface around it: metering, hosted inference, the control plane, and a small amount of proprietary tooling that is stripped from customer images. This page is the honest line-by-line.

**Prefer to watch?** What changes when you self-host as a silent, step-by-step video:

**Tutorial 16** ·  · a silent follow-along of this page. Pressing
play loads the video from YouTube.
Watch on YouTube

## Capability matrix

| Capability | Cloud (managed) | Self-hosted | Notes |
| - | :-: | :-: | - |
| `/guard` detection engine (regex + heuristics) | ✅ | ✅ | Identical code path |
| Policy enforcement + custom policies | ✅ | ✅ | |
| Dashboard, event logging, Interactions | ✅ | ✅ | Hybrid uses our dashboard. Air-gapped runs its own, in the Helm chart and Docker Compose |
| Audit trail with hash-chain integrity | ✅ | ✅ | |
| Policy cache | ✅ | ✅ | |
| [Spend caps](https://docs.promptguard.co/gateway/spend-caps.md) | ✅ | ⚠️ Air-gapped only | Hybrid: refused (`upstream_spend_cap_unavailable_on_hybrid`). A Hybrid data plane sends requests to your provider itself, so a cap held by our dashboard would never see that spend. Air-gapped runs its own proxy and dashboard, so a cap applies there |
| [Suppressions](https://docs.promptguard.co/api-reference/guard.md#suppressions) | ✅ | ⚠️ Air-gapped only | Hybrid: refused (`suppression_unavailable_on_hybrid`). A Suppression lives in the dashboard's database and nothing carries it to a Hybrid engine, so it could not apply to the traffic it was made for. Once your Organization registers a Hybrid data plane, creating one is refused for all its projects. Air-gapped runs its own dashboard, so they apply there |
| Org / project RBAC | ✅ | ✅ | Enforced by the app (see below) |
| IP allowlist | ✅ | ✅ | |
| Webhooks | ✅ | ✅ | Signed (`X-PromptGuard-Signature`) once you generate a signing secret for the project, in every mode; without one, deliveries are unsigned. See [Verifying deliveries](https://docs.promptguard.co/platform/webhooks.md#verifying-deliveries) |
| Prometheus `/metrics` | ❌ | ✅ | Aggregate series only (no user, tenant or content labels), including per-detector latency. Self-hosted, a scraper presents `METRICS_TOKEN`, and with none set it answers `404`: [how to reach it](#monitoring-a-self-hosted-instance). Cloud serves it to our own monitoring only; read latency from your events instead |
| Helm chart (K8s) | ✅ | ✅ | `deploy/helm/promptguard` |
| **Managed ML inference** | ✅ hosted | ⚙️ CPU classifiers in-process | `ML_INFERENCE_MODE=local` runs the prompt-injection and toxicity classifiers and the multi-turn embeddings inside the engine, on weights you fetch yourself with your own Hugging Face account (PromptGuard does not ship them). A model missing from them is reported as unavailable on each scan |
| **LLM-judge detectors** (LLM Guard, agentic, hallucination) | ✅ hosted | ⚙️ optional judge service or your own endpoint | The Helm chart's optional judge service (vLLM on a GPU; bring your own GPU model server, not validated by PromptGuard) serves the judges in-network, or supply your own inference URL/token. Docker Compose ships no judge server |
| **Red-team attack engine + self-test UI** | ✅ | ❌ | Stripped from non-cloud builds |
| **Stripe billing + per-request quota metering** | ✅ | ❌ (signed license instead) | Self-host runs uncapped under a time-limited license |
| **Shadow AI agent auto-update / staged rollout / kill-switch** | ✅ | ❌ | Control-plane feature |
| Scheduled jobs (log retention, webhook and alert-email retries, billing resets) | ✅ | ✅ | Bundled: a `scheduler` service in Docker Compose, CronJobs in Helm, on the Cloud schedule. The TTL sweeps of caches and delivered webhooks run in the database and need `pg_cron` |
| Hosted [status page](https://status.promptguard.co) + uptime monitoring | ✅ | ⚙️ you run it | Point your own uptime monitor at `/health` |
| Sign-in codes, invitations and alert emails | ✅ | ⚙️ your mail relay | Set the `SMTP_*` settings in Docker Compose, or `api.smtp` in the Helm chart. There is no built-in relay: with none set, the engine starts, logs that email is off, and sends nothing |
| SSO / SCIM (OIDC via WorkOS) | ✅ | ⚙️ optional | Works self-host if you wire `WORKOS_*` |
| GeoIP enrichment | ✅ | ✅ | Resolved in-process from the [DB-IP](https://db-ip.com) IP-to-Country Lite database bundled into the API image, in every mode, no IP is sent to a third party. Country-level only. [IP Geolocation by DB-IP](https://db-ip.com), licensed [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) |
| Default-deny egress NetworkPolicy (Air-gapped) | - | ✅ | Blocks pod egress at the network layer. GeoIP, release lookups and hosted ML inference are off in code; the application can still attempt a few outbound calls when configured for them, and the policy is what stops them |

Legend: ✅ available · ⚙️ available but you operate/supply it · ⚠️ works, with the caveat stated · ❌ not available ·, not applicable

## Why the cloud-only items are cloud-only

> [accordion] Red-team attack engine & self-test UI
>
> The offensive red-team engine is proprietary attack tooling that is **stripped from non-cloud images at build time** (`DEPLOYMENT_MODE ≠ cloud`). It is internal IP we do not ship inside customer environments. The defensive detectors it exercises are fully present in self-host; only the built-in "attack yourself" harness is cloud-only. You can still run your own adversarial spot-checks against your live config by POSTing known-attack payloads to `/guard` in CI.

> [accordion] Managed ML and LLM-judge inference
>
> On Cloud we operate the classifier and LLM-judge inference for you. Self-hosted, `ML_INFERENCE_MODE=local` runs the prompt-injection and toxicity classifiers and the multi-turn embeddings inside the engine, from model weights you download yourself, with your own Hugging Face token and under each model's licence, which you accept on your own account ([Third-Party Models](https://docs.promptguard.co/security/third-party-models.md)); PromptGuard does not ship or redistribute them. It never calls hosted inference. The LLM judges need a judge server inside your network: the Helm chart's optional judge service (vLLM serving gpt-oss-safeguard-20b, which needs a GPU and weights you download; bring your own GPU model server, not validated by PromptGuard), or your own OpenAI-compatible server at `LLM_GUARD_BASE_URL`. Every detector that cannot run is listed on the scan result as unavailable, so reduced coverage is never read as a pass. `ML_INFERENCE_MODE=off` runs the (substantial) rule engine alone.

> [accordion] Stripe billing & quota metering
>
> Cloud enforces per-plan monthly request quotas through Stripe-backed subscriptions. A self-hosted instance has no reason to phone a billing provider, so it runs on a **signed, time-limited license** (365 days by default; a hybrid install renews it automatically through its daily check-in, an air-gapped one by installing the renewed licence we send) and is metered-but-uncapped: the counter increments for your own visibility, but requests are never hard-capped. With no license installed, billable requests get `503` until one is (health and maintenance keep running); an expired license keeps serving for 7 days, after which a lapsed/invalid license fails **closed** on billable requests (`503 LICENSE_INACTIVE`) while `/health` and `/docs` stay up.
>
> **Per-endpoint contracts are billed from a report you send monthly.** Shadow fleets are priced per Billable Endpoint, and with no billing provider to report to, the install exports the count instead: run `python -m shared.billing.services.endpoint_export_service --month YYYY-MM` in the API container once a UTC month has closed, and send the JSON it prints to PromptGuard. It lists each Organization's endpoints, grouped under the Organization invoiced for them, and names each machine by a hash only, never a hostname or user. The same month always exports the same file, so it can be audited against your inventory and re-run to check.

> [accordion] Shadow AI agent auto-update & staged rollout
>
> Staged rollout, kill-switch, and auto-update for the Shadow AI desktop agents are **control-plane** features: they need the hosted release/telemetry backend to target cohorts and halt a bad release. An air-gapped fleet distributes agent updates through your own MDM instead.

## Two things that behave differently self-hosted

> [!WARNING]
>
> **Tenant isolation is enforced by Postgres as well as by the app.** `deploy/apply-migrations.sh` gives a self-hosted Postgres the same schema and the same row-level security policies as Cloud (apart from the pgvector-backed `attack_corpus` table where pgvector is not installed). The API serves each request as `promptguard_app`, a database role those policies restrict to the request's Organization, so one missing filter in the application cannot read another Organization's rows. Org/project RBAC and IP allowlists are enforced by the application on top. Migrations and scheduled jobs keep a privileged role, so do not expose the database directly to untrusted clients. Run the script on install and on every upgrade; it stops with a non-zero exit at the first migration error, and the API must not be started until it has finished cleanly.

> [!WARNING]
>
> **Pin a stable node identity.** A license can carry a node fingerprint, which the instance compares with its own. Containerized deployments must set a stable `PROMPTGUARD_NODE_ID` (e.g. `uuidgen` once, then reuse), the default hardware fingerprint changes on each container redeploy and would fail that comparison. `PROMPTGUARD_NODE_ID` is yours to set, so the fingerprint is a guard against accidental reuse, not a lock: the signature and the expiry date are what enforce the license.

## Monitoring a self-hosted instance

The API serves Prometheus metrics at `GET /metrics`, on the same origin as everything else, and only to a scraper that presents `METRICS_TOKEN` as `Authorization: Bearer <token>`. With no `METRICS_TOKEN` set, `/metrics` answers `404`, and the API's startup log says so. It is never open, because in both shipped topologies the API's origin is reachable from outside: the Helm chart's default ingress serves every path, and on Docker Compose port 8080 is the origin browsers call.

* **Helm:** the chart generates `METRICS_TOKEN` into the API's Secret on first install and keeps it across upgrades. To choose it yourself, set `api.secrets.metricsToken`. Set `monitoring.serviceMonitor.enabled=true` and the Prometheus Operator scrapes every API pod, presenting the token from that Secret. Scrape pods, not the Service: the counters are per pod, so they are summed across pods. Set `monitoring.prometheusRule.enabled=true` to install the alert rules we run on Cloud, written against these series. For a Prometheus outside the cluster, read the token with `kubectl get secret <release>-api-secrets -o jsonpath='{.data.METRICS_TOKEN}' | base64 -d`.
* **Docker Compose:** set `METRICS_TOKEN` in your `.env` (generate one with `openssl rand -hex 32`) and restart the API. Scrape `http://<host>:8080/metrics`.

A Prometheus outside Kubernetes reads the token from a file:

```yaml theme={"system"}
scrape_configs:
  - job_name: promptguard-api
    metrics_path: /metrics
    authorization:
      type: Bearer
      credentials_file: /etc/prometheus/promptguard-metrics-token
    static_configs:
      - targets: ['<host>:8080']
```

The series are aggregate only: no user, tenant or content labels. They cover security events by decision, detection failures and scans that stopped early, request rate and duration, PromptGuard's own overhead, and how long each detector takes ([Latency Budgets](https://docs.promptguard.co/production/latency-budgets.md#per-detector-latency-self-hosted)). Two cover [conversation memory](https://docs.promptguard.co/api-reference/guard.md#conversations): `promptguard_conversation_memory_failures_total` counts turns scanned without their earlier turns because the store failed or was slow, and `promptguard_kv_entries_rows` estimates the rows in the `kv_entries` table that holds them (absent when the store is Redis).

## Choosing a model

| You want… | Deploy |
| - | - |
| Fastest start, we run everything, red-team self-test, managed inference | **Cloud** |
| Data must never leave your network; regulated/PHI-adjacent workloads | **Air-gapped** |
| Scanning on your infrastructure, reviewing in our dashboard | **Hybrid** |

Hybrid and Air-gapped deployments are an Enterprise-tier capability. See the [Compliance](https://docs.promptguard.co/security/compliance.md) page for the air-gap egress audit, or [contact sales](mailto:sales@promptguard.co) to scope a deployment.

## Next steps

> [card] [Enterprise Setup](https://docs.promptguard.co/production/enterprise-setup.md)
>
> Organizations, SSO, RBAC, and audit logs

> [card] [Compliance](https://docs.promptguard.co/security/compliance.md)
>
> Air-gap egress audit, build provenance, and certification status

> [card] [Shadow AI Deployment Modes](https://docs.promptguard.co/shadow-ai/deployment-modes.md)
>
> Personal, fleet, and air-gapped agent deployment

> [card] [Reliability](https://docs.promptguard.co/production/reliability.md)
>
> Fail-open vs fail-closed behavior


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.