AiSecuritySettings
Source:
src/Cloudflare/AiSecurity/Settings.ts
AI Security for Apps (Firewall for AI) settings on a Cloudflare zone
(/zones/{zone_id}/ai-security/settings).
The settings object is a zone singleton — it always exists and is never
created or deleted, only toggled. Reconcile PUTs the desired enabled
value when the observed value differs; destroy restores the value the
zone had before Alchemy first managed it.
Declare at most one AiSecuritySettings per zone — two instances
managing the same zone would fight over the single underlying setting.
AI Security for Apps is entitlement-gated: on accounts without the
feature every call fails with the typed AiSecurityNotEntitled error
(Cloudflare error code 13101).
Enabling AI Security
Section titled “Enabling AI Security”Enable AI Security for Apps on a zone
const settings = yield* Cloudflare.AiSecuritySettings("AiSecurity", { zoneId: zone.zoneId, enabled: true,});Pin AI Security off
yield* Cloudflare.AiSecuritySettings("AiSecurity", { zoneId: zone.zoneId, enabled: false,});