AI Security for Apps Reference Architect·续
Figure 8: LLM traffic has a bitrate of less than 4 KB/s
Once LLM endpoints are identified, Cloudflare API security capabilities automatically label the endpoints with a cf-llm label; this allows for easy filtering in analytics and for easily applying security policies to all LLM endpoints.

Figure 9: Cloudflare AI Security for Apps LLM Discovery
The below diagram highlights the overall LLM discovery and AI threat mitigation. Once LLM endpoints are discovered, detections will automatically run on those endpoints. Mitigation is done by creating a WAF security policy with the AI-specific context and fields AI Security for Apps provides.

Figure 10: Cloudflare AI Security for Apps LLM discovery and AI threat mitigation
LLM Prompt Detection
Cloudflare looks for specific patterns and via analysis detects and extracts LLM prompts within the body of incoming requests. Detection runs on incoming traffic. Currently, the detection only handles requests with a JSON content type (application/json). Cloudflare will populate the existing Security for AI Apps fields ↗︎ based on the scan results. Respectively, you can see these results in the Security Analytics dashboard by filtering on the cf-llm managed endpoint label and reviewing the detection results on your traffic.
Additionally, the respective populated fields can be used in security rule expressions (custom rules and rate limiting rules) to protect your application against AI-specific threats like PII exposure.
AI Security Threat Detections with AI Security for Apps
AI Security for Apps currently provides detections and mitigation for critical AI security threats. The threats AI Security for Apps helps mitigate for map to the following risks in the OWASP Top 10 for LLM Applications ↗︎ as shown in the table below.

Figure 11: AI Security for Apps helps mitigate top LLM risks
When enabled, the AI security detections run on incoming traffic, searching for any LLM prompts attempting to exploit the model. Security policies can be created via both WAF custom rules and rate limiting rules.
PII Exposure
Prevent data leaks of personally identifiable information (PII) — for example, phone numbers, email addresses, social security numbers, and credit card numbers.
AI Security for Apps helps prevent PII being sent in the request and respectively AI models being trained on this data which can consequently expose PII in subsequent requests.

Figure 12: Cloudflare AI Security for Apps - PII exposure detection and mitigation
Unsafe Topics
Detect and moderate unsafe or harmful prompts – for example, prompts potentially related to violent crimes.
AI Security for Apps helps prevent AI models from receiving requests with harmful requests and preventing the model from learning and responding to requests that can be deemed harmful and Enterprises can potentially even be held liable for.

Figure 13: Cloudflare AI Security for Apps - PII unsafe topics detection and mitigation
Prompt Injection and Jailbreak
Detect prompts intentionally designed to subvert the intended behavior of the LLMs as specified by the developer
AI Security for Apps detects attempts to manipulate, misuse, or elicit unintended outputs. A prompt injection score signifying the likeliness of a prompt injection or jailbreak attempt is given to every request that is routed to an LLM endpoint. A score of less than 20 signifies a prompt injection attack.

Figure 14: Cloudflare AI Security for Apps - Prompt injection and jailbreak detection and mitigation
Analytics and Prompt Logging
AI Security for Apps provides for always-on detections and continuous visibility via analytics into all AI security threats, regardless of if a security policy is in place or not. Once an LLM endpoint has been discovered via LLM discovery, all detections are run on traffic to that endpoint and any detected attacks are logged. The below diagram demonstrates this.

Figure 15: Cloudflare AI Security for Apps - Always-on detection
You can also see any suspicious activity quickly bubbled up under Security Overview and Security Analytics for users to easily review and take action on.

Figure 16: Suspicious activity alerts for AI-specific threats
The powerful analytics capabilities allow users to jump to immediate threats like PII exposure and unsafe topics and within each of these even filter down further based on specific categories within the identified threat. There are categories for both PII exposure and unsafe topics. For example, below we are filtering the logs with PII detected further based on the specific category of Credit Card.

Figure 17: Filtering logs based on AI-specific threats
Within discovered endpoints, under the Endpoints tab and within Security > Web assets, users can also easily filter on the cf-llm label for discovered LLM-specific endpoints as shown below.
Here, the power of the Cloudflare platform and cross-product integration is on full display. Not only are the respective discovered LLM endpoints labeled with cf-llm, but Cloudflare API Security capabilities has also automatically attached managed risk labels such as cf-risk-missing-auth, signifying identified risks associated with the respective endpoint.

Figure 18: LLM discovery and auto labeling of API endpoint security risks
Users can also log the exact prompts in the request via prompt logging. Log request details, including the request body are easily accessible via Security Analytics. In the figure below, notice that only users with the respective private key configured can decrypt and view the payload contents.

Figure 19: AI Security for Apps - Prompt logging with payload encrypted
Once decrypted, users can view the exact LLM prompt and even the specific category detected as shown below.

Figure 20: AI Security for Apps - Prompt logging with payload decrypted
Summary
AI is powerful and organizations continue to adopt AI at a rapid pace, but without protections in place, it's risky. Cloudflare provides a layered security approach incorporating AI Security to protect your AI-powered applications.
AI Security for Apps complements WAF providing the same operational model and can detect and mitigate threats like PII exposure, unsafe content, and prompt injection / jailbreak. Further, Cloudflare's powerful LLM discovery, analytics, and prompt logging capability provide users the deep visibility to easily understand and take appropriate action to secure AI-powered applications.
Related Resources
- Cloudflare AI Security for Apps Product Page ↗︎
- Cloudflare Blog: AI Security for Apps ↗︎
- Cloudflare Developer Docs: AI Security for Apps ↗︎
- Self-guided Product Tour: AI Security for Apps ↗︎
- Video: Cloudflare AI Security Suite: Protect AI-powered apps with AI Security for Apps ↗︎
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/reference-architecture/architectures/ai-security-for-apps/#page","headline":"AI Security for Apps Reference Architecture","description":"This article highlights how Cloudflare's AI Security for Apps complements Cloudflare WAF by providing an AI protection layer for detecting and mitigating threats to AI-powered applications.","url":"https://developers.cloudflare.com/reference-architecture/architectures/ai-security-for-apps/","inLanguage":"en","image":"https://developers.cloudflare.com/reference-architecture/architectures/ai-security-for-apps/og.png?v=9fa474969109368c","dateModified":"2026-08-24","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: This reference architecture discusses the traditional challenges customers face with web applications, how the Cloudflare CDN resolves these challenges, and CDN architecture and design. title: Content Delivery Network (CDN) Reference Architecture image: https://developers.cloudflare.com/reference-architecture/architectures/cdn/og.png?v=206536e407d66b82
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/reference-architecture/llms.txt
Use this file to discover all available pages before exploring further.
