API Gateway HTTP API + Lambda Function URLs: Building a Prompt‑Caching LLM Proxy, Explained Simply A developer outlined a lightweight LLM proxy architecture that routes API Gateway HTTP APIs directly to Lambda Function URLs and adds a small in-process prompt cache, claiming sub-100 ms responses for repeated prompts. The setup uses Node.js 22's native fetch and diagnostics_channel, with SHA-256 prompt hashes stored in an in-memory Map that is rebuilt on cold starts, and enables binary media support to avoid a 6 KB body-drop bug. LLM‑powered features like code completion are often wrapped in heavyweight Lambda functions that add latency and cost. By letting API Gateway’s HTTP API route directly to a lightweight Function URL and adding a tiny in‑process cache, you get sub‑100 ms responses for repeated prompts. This post shows exactly how to wire it together with Node.js 22’s native fetch and diagnostics channel. When a user asks an LLM large language model the same question twice, the model does the same heavy computation both times. That work costs money and adds time. A prompt cache stores the model’s answer for a given prompt so the second request can be answered instantly, without contacting the model again. In plain English: Think of a cache like a sticky note you put on your desk. The first time you look up a phone number you write it down; the next time you need it, you just glance at the note instead of dialing the operator again. Why keep the cache inside the Lambda instead of an external store? The trade‑off is that the cache disappears when the Lambda container is recycled, but for high‑frequency prompts that’s fine; the next cold start will rebuild the cache quickly. // A very small in‑process cache. // Keys are SHA‑256 hashes of the prompt string. const cache = new Map