What you will have at the end
ai-cache on the Route chat-api: a prompt sent twice is answered the second time from Redis, with X-AI-Cache-Status: HIT, in 60 to 140 ms at the client instead of a second and a half, and the model is not called. The same question with one word changed is a miss, because the exact layer matches bytes. The semantic layer, which matches by meaning, needs an embedding provider and a Redis with the search module; the lab has neither, so this article shows its form and says it was not run. Every hit is a record in Traffic Explorer with gateway as the Upstream node, and the save is audited with the Redis password and the model key masked.
Prerequisites
- A Route to a model.
chat-apiservesPOST /ai/v1/chatwithai-proxyto a cloud model,ai-prompt-guardandai-prompt-decoratoras in Prompt rules at the gateway, without the template, and a single token limit of 300 a minute for the Route. - The cloud model is a real one on a real account, called with the lab’s own key. The key is masked in every screenshot and in the audit log, and no part of it is printed here.
- A Redis the gateway nodes can reach. The lab’s is
redis:6379with a password; Redis is the only store the Plugin offers. - Traffic logging turned on under Traffic Explorer › Settings, and a role that may manage Routes. The screenshots below were taken as
nora.becker.
The exact layer
Open the Route, Plugins, Add plugin, ai-cache. Under Basics, Layers has two checkboxes, exact and semantic; the help says exact is always needed and semantic adds a similarity match, and the note says which prompts can reach the semantic layer at all: only a plain-text chat prompt; an image, an audio block or a tool call keeps it in the exact layer. Under Exact layer, TTL is how long an answer stays, 600 seconds here. Policy is redis, and under it the Redis host, port, database, username and password, stored on the engine and shown only to roles that manage the Route, with the TLS switches beside them.

Further down, the cache key: Include consumer serves a signed-in Consumer only what was cached for them; Include variables adds request variables to the key; Share across routes is off, so every Route keeps a cache of its own. Cache status headers puts X-AI-Cache-Status on every answer and, on a hit, X-AI-Cache-Age. Bypass rules name a header and a value that send a request to the model and never cache it. Fail mode says what a request that did not pass through an AI proxy meets here.
Select Add plugin.
What a client sees
The same prompt four times, with a change in the middle:
### call 1, the prompt the first time
HTTP/1.1 200 OK X-AI-Cache-Status: MISS · 1.57 s
### call 2, the same prompt, byte for byte
HTTP/1.1 200 OK X-AI-Cache-Status: HIT X-AI-Cache-Age: 0 · 0.14 s
### call 3, "return policy" instead of "returns policy"
HTTP/1.1 200 OK X-AI-Cache-Status: MISS · 1.45 s
### call 4, the first prompt again
HTTP/1.1 200 OK X-AI-Cache-Status: HIT X-AI-Cache-Age: 2 · 0.06 s
The second and fourth answers are the first one, word for word, served from Redis; the third went to the model because one letter differed. That is what exact means, and it is the layer every installation gets. A support assistant whose users ask the same ten questions gets most of its hits here.
What Traffic Explorer shows
A hit is a record whose Upstream node is gateway: the gateway answered, and no provider was asked. A miss carries the provider’s address and its latency.

The semantic layer, configured and not run
Tick semantic under Layers and the Semantic layer block opens: Embedding with OpenAI or Azure OpenAI, their API key, Model, Dimensions, an Endpoint for a provider of your own, and Vector search in Redis with an Index prefix; the note under it is the one that decides whether it works: the Redis needs the RediSearch module, because without it every semantic lookup misses and only the log says so. Similarity threshold and Top K set how close a stored prompt must be, and the Message window switches say which messages of the conversation are embedded.

What the semantic layer would add, from the form alone: a prompt close enough to a stored one in meaning is served the stored answer, with X-AI-Cache-Similarity on the answer instead of the age. Whether “return policy” and “returns policy” land within the threshold is a measurement this article could not make.
What the audit log keeps
Adding the Plugin is a Route update with the ai-cache block added on the after side and the Redis password in it as ••••, next to the ai-proxy block whose provider key is masked on both sides. The note under the diff names the masked value that changed, plugins.ai-cache.redis_password.

What to do next
- Why a refused prompt never reaches the cache: Prompt rules at the gateway.
- Keep answering when the provider fails: Route LLM traffic with a fallback provider.
- Offer the same API to agents as tools: Your REST API as MCP tools.
- Caching, both layers, is on AI Gateway and in the AI Gateway datasheet.