DFENS Cloud

Integrate the hosted service.

Everything else in this section (API integration, Configuration, Deployment) is written for running DFENS yourself. If you signed up on portal.dfens.ai — Developer, Pro, or Team — this page is your starting point instead: what signup actually gives you, and the handful of things that differ from a self-hosted deployment. The rule engine, request/response schemas, and block behaviour underneath are identical either way.

Two developer paths, one engine

DFENS Cloud (this page): we run the proxy, you get an endpoint and an API key in minutes, no deployment. Self-hosted / VPC (Enterprise): you run the engine inside your own boundary — see Deployment. Switching later means pointing your app at a different base URL; your rules and audit format carry over unchanged.

What signup gives you

Once your Cloud subscription is active — as soon as you verify your email on Developer (free), or once payment is confirmed on Pro/Team — your customer portal issues:

The key does double duty: it authenticates the request and identifies your account. There's no separate tenant header to set.

Authenticate every request

Present the key on every request in the X-AI-Firewall-Key header — the same header name the self-hosted engine's optional client authentication uses, but administered differently: self-hosted, it's one static token you set yourself via config; on Cloud, it's the individual key your account issued, already tied to your subscription and revocable from the portal.

openai client → DFENS Cloud
# Point the OpenAI SDK at your Cloud endpoint
export OPENAI_BASE_URL=https://api.dfens.ai/v1

curl -X POST https://api.dfens.ai/v1/chat/completions \
  -H "X-AI-Firewall-Key: $DFENS_API_KEY" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o","messages":[{"role":"user","content":"hello"}]}'

Your own Authorization header still authenticates to the upstream provider — DFENS forwards it untouched on allowed traffic and strips X-AI-Firewall-Key before anything leaves for your provider. A missing or unrecognized key returns 401.

Same engine, same schemas

Provider routes, the reverse-proxy vs. /v1/inspect choice, streaming and truncation behaviour, and block-response shapes are all exactly what API integration describes — that page applies to Cloud traffic unchanged. This page only covers what's different: how you authenticate, and the errors that come from being a metered, multi-tenant service rather than a deployment only you can see.

Cloud-specific errors

On top of the block/streaming/status codes in API integration, Cloud traffic can also be refused for account-level reasons — always a JSON body naming the reason, never a silent drop:

StatusMeaning
401Missing or unrecognized X-AI-Firewall-Key.
403Subscription suspended (e.g. non-payment) — contact your account team.
429quota_exhausted — your plan's included usage for this cycle is used up. See Pricing for what each tier includes and to move up a tier.
429Per-minute rate limit exceeded. Honour the Retry-After header and retry.

Exact inclusion figures and what happens beyond them (hard cap vs. metered overage) vary by plan — Pricing is the source of truth for current numbers, kept separate from this integration reference so the two don't drift out of sync with each other.

Your customer portal

portal.dfens.ai is self-serve account management — separate from your firewall traffic, and separate from the billing portal linked from your subscription email:

Next: API integration for the request/response schemas and block behaviour that apply to every request, Cloud or self-hosted.