ZuploZuplo
LoginStart for Free
  • Documentation
  • API Reference
Introduction
Getting Started
    Develop in the portal
      1 - Setup Your Gateway2 - Rate Limiting3 - API Key Auth4 - Deploy5 - Dynamic Rate LimitingDynamic MCP Server - Quickstart
    Develop locally with the CLI
      1 - Setup Your Gateway2 - Rate Limiting3 - API Key Auth4 - Deploy5 - Dynamic Rate LimitingDynamic MCP Server - Quickstart
Concepts
Development
Policies
    Policy Catalog
    Authentication
    Authorization
    MCP Authorization
    AI Gateway
      AI Gateway AuthenticationAI Gateway Model FilteringAI Gateway Fallback ModelAI Gateway MeteringAI Gateway Semantic CacheData Loss Prevention (DLP)Akamai AI FirewallComet Opik TracingGalileo TracingAI Gateway Configuration ExecutorAI Gateway Configuration Loader
    Security & Validation
    Metrics, Billing & Quotas
    Testing
    Request Modification
    Response Modification
    Upstream Authentication
    GraphQL
    Caching
    Other
    Guides
Handlers
API Keys
Rate Limiting
Caching
MCP Server
MCP Gateway
AI Gateway
    IntroductionGetting StartedSource ControlUniversal API
    Providers
    Teams
    Apps
    Policies
      OverviewAI Gateway AuthenticationAI Gateway Model FilteringAI Gateway Fallback ModelAI Gateway MeteringAI Gateway Semantic CacheData Loss Prevention (DLP)Akamai AI FirewallComet Opik TracingGalileo TracingAI Gateway Configuration ExecutorAI Gateway Configuration Loader
    Cookbooks
    Integrations
Developer Portal
Monetization
GraphQL
Deploying & Source Control
Analytics
Observability
Networking & Infrastructure
Account Management
Programming API
Build with AI
Zuplo CLI
Migration Guides
Platform LimitsVersion Support PolicySecuritySupportTrust & ComplianceChangelog
powered by Zudoku
AI Gateway

Akamai AI Firewall Policy

AI Gateway Policy

This policy is for use with the AI Gateway. See the AI Gateway documentation to learn how to configure and govern AI models with Zuplo.

The Akamai AI Firewall policy scans AI Gateway prompts and completions with Akamai Firewall for AI. One inbound policy protects both request and response content, including streaming responses, and blocks content that an Akamai rule denies.

For runtime inspection, the policy denies unknown endpoint shapes and handled Akamai detection-call failures by default. If a recognized request or successful response has an unparseable JSON body, the policy skips scanning that body and passes it through. Detection rules and categories are configured in Akamai Control Center.

Configuration

The configuration shows how to configure the policy in the 'policies.json' document.

Code
{ "name": "my-akamai-ai-firewall-v2-inbound-policy", "policyType": "akamai-ai-firewall-v2-inbound", "handler": { "export": "AkamaiAIFirewallV2InboundPolicy", "module": "$import(@zuplo/runtime)", "options": { "configurationId": "$env(AKAMAI_AI_FIREWALL_CONFIGURATION_ID)", "api-key": "$env(AKAMAI_AI_FIREWALL_API_KEY)" } } }

Policy Configuration

  • name <string> - The name of your policy instance. This is used as a reference in your routes.
  • policyType <string> - The identifier of the policy. This is used by the Zuplo UI. Value should be akamai-ai-firewall-v2-inbound.
  • handler.export <string> - The name of the exported type. Value should be AkamaiAIFirewallV2InboundPolicy.
  • handler.module <string> - The module containing the policy. Value should be $import(@zuplo/runtime).
  • handler.options <object> - The options for this policy. See Policy Options below.

Policy Options

The options for this policy are specified below. All properties are optional unless specifically marked as required.

  • configurationId (required) <string> - The configuration ID of the AI Firewall.
  • api-key (required) <string> - The API key for the AI Firewall.
  • applicationId <string> - The application ID to identify this usage of the AI Firewall (optional).
  • streamingAccumulation <object> - Configuration for accumulating and validating streaming responses.
    • enabled <boolean> - Enable accumulation and validation of streaming responses. Defaults to true.
    • eventsInterval <number> - Number of SSE events to accumulate before checking with Akamai (default: 5). Defaults to 5.
    • checkIntervalMs <number> - Time interval in milliseconds for periodic checks (alternative to chunk count).
  • endpoints <string[]> - The endpoint shapes this policy applies to. Omit to apply to all (openai-chat, openai-responses, anthropic-messages).
  • onUnknownShape <string> - What to do when the request shape cannot be inspected. As a guardrail, this policy defaults to 'deny' (fail closed) so uninspectable content is never served. Allowed values are deny, skip. Defaults to "deny".
  • onError <string> - What to do when the Akamai detect call itself fails (invalid API key, rate limit, outage). 'block' (the default) fails closed and returns a 502 so unverified content is never served; 'allow' fails open and lets the request through without inspection. Allowed values are block, allow. Defaults to "block".

Using the Policy

Akamai AI Firewall

The Akamai AI Firewall policy sends prompts and completions to Akamai Firewall for AI and blocks content that your Akamai configuration denies. One inbound policy covers both directions: it scans the request before the provider call and the response afterward, including streaming responses.

Detection rules and their categories live in Akamai Control Center. The policy enforces rules configured to deny; rules configured only to alert do not block the request.

Configure the policy

Create or select an Akamai Firewall for AI configuration and API key. Declare the policy once in config/policies.json, then add the declaration to each application policy chain that should be protected. To protect new applications by default, include it in the team's policy template.

Code
{ "name": "akamai-ai-firewall-v2-inbound", "policyType": "akamai-ai-firewall-v2", "handler": { "export": "AkamaiAIFirewallV2InboundPolicy", "module": "$import(@zuplo/runtime)", "options": { "configurationId": "your-configuration-id", "api-key": "$env(AKAMAI_AI_FIREWALL_API_KEY)" } } }

When an application chain entry should inherit these credentials, omit the entry's options. Entry options replace the declaration's complete options object; they do not merge with it.

Options

OptionDefaultWhat it does
configurationIdRequiredSelects the Akamai firewall configuration.
api-keyRequiredAuthenticates to Akamai. The property name includes the hyphen.
applicationIdUnsetSupplies an optional Akamai application identifier.
endpointsAll shapesLimits inspection to selected AI Gateway endpoint shapes.
onUnknownShapedenyDenies or skips a request whose shape cannot be inspected.
onErrorblockBlocks or allows traffic when the Akamai detection call fails.
streamingAccumulation.enabledtrueEnables response inspection for streaming requests.
streamingAccumulation.eventsInterval5Buffers this many stream events between checks.
streamingAccumulation.checkIntervalMsUnsetAlso runs checks on a timer when configured.

Unknown option keys and incomplete credentials are rejected. Invalid options fail closed so a broken chain never silently disables the guardrail.

Streaming behavior

For streaming responses, the gateway withholds each batch of events until the Akamai check passes. This prevents denied content from reaching the client, but the buffering and network check add latency. If a later batch is denied, the stream ends with a content-filter stop rather than changing the HTTP status of a response that has already started.

Block and failure behavior

A denied request or non-streaming response returns 400 in the request shape's native error format and includes the Akamai rule ID. Anthropic Messages uses an Anthropic-style error; Chat Completions and Responses use an OpenAI-style error. Provider error responses are not scanned.

SituationResult
Options are invalid or incompleteRequest rejected before unguarded traffic can run.
The endpoint shape cannot be inspected400, with code guardrail_uninspectable.
A recognized request body cannot be parsedRequest continues without input inspection.
A successful response body cannot be parsedResponse passes through without output inspection.
Akamai rejects the credentials, rate-limits the call, or is unavailable502, with code guardrail_unavailable.
The endpoint is excluded by endpointsRequest passes through without inspection.

Setting onError to allow changes service failures to fail open. An expired credential can then leave the gateway returning successful responses without inspection, so monitor firewall findings and sudden drops in block volume.

Additional resources

  • Akamai Firewall for AI
  • Akamai AI security solutions

Read more about how policies work

Edit this page
Last modified on August 18, 2026
Data Loss Prevention (DLP)Comet Opik Tracing
On this page
  • Configuration
    • Policy Configuration
    • Policy Options
  • Using the Policy
JSON
JSON