All Questions
Llm Gateway Cost And Caching hard

For tracing, your gateway now puts a request ID and an ISO timestamp at the top of an 8,000-token system prompt, ahead of the tool definitions. Since the change, the provider's prompt cache hit rate is near zero and input spend has risen sharply. Which fix costs the least?

  1. A Enable semantic caching on the system prompt so that near-identical prefixes differing only in the timestamp are treated as prompt cache hits.
  2. B Move the request ID and timestamp after the static system prompt and tool definitions so the leading tokens are byte-identical across calls.
  3. C Round the timestamp to the nearest minute, since the provider caches any repeated block of text in the prompt regardless of where it appears.
  4. D Move the request ID to a metadata header but keep the timestamp first, since one short changing field cannot invalidate a multi-thousand-token cached prefix.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions