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
Handlers
API Keys
Rate Limiting
Caching
MCP Server
MCP Gateway
AI Gateway
    IntroductionGetting StartedSource ControlUniversal API
    Providers
    Teams
    Apps
    Policies
      OverviewAPI key authenticationModel FilteringFallback ModelBudgets and CostsSemantic cacheAkamai AI FirewallComet Opik tracingGalileo tracing
    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
Policies

Semantic cache

ai-gateway-semantic-cache-v2-inbound

The semantic cache answers a request from a previous response when the new prompt is semantically similar to one already seen, skipping the provider entirely. One policy handles both halves: it checks the cache on the way in and, on a miss, stores the provider's response on the way out. There's no separate outbound policy to add.

A cache hit answers the request, so entries after it in the chain don't run. Place it after Budgets and Costs so hits still count toward the app's request limits.

Options

OptionDefaultWhat it does
semanticTolerance0.2How loose a match to accept. A response is reused at similarity ≥ 1 − tolerance, so 0.2 needs 0.8
expirationSecondsTtl3600How long a cached response stays valid, up to 30 days
maxConversationLength3Longest conversation to cache, in messages
endpointsChat Completions, Anthropic MessagesWhich API shapes to cache
namespaceThe app's IDCache partition. Only applies when the request has no app configuration

What isn't cached

  • Conversations longer than maxConversationLength—three messages by default—aren't cached at all.
  • The Responses API isn't supported. The cache covers Chat Completions and Anthropic Messages.
  • The cache always fails open: if the cache is unavailable, the request goes to the provider as normal.

One app can never read another's cached responses. The namespace is fixed to the app's ID whenever the request resolves to an app, so the namespace option only matters on a gateway that doesn't identify apps.

Reading cache outcomes

Each response carries the outcome as a Cache-Status header under the cache name zp-aigw-sem-cache, alongside x-ai-gateway-cache (HIT or MISS) and x-ai-gateway-cache-similarity.

Edit this page
Last modified on August 5, 2026
Budgets and CostsAkamai AI Firewall
On this page
  • Options
  • What isn't cached
  • Reading cache outcomes