All Questions
Llm Gateway Cost And Caching medium

Your assistant builds each request as: current timestamp, the user's query, then a 3,000-token system prompt and tool definitions that never change. Provider-side prompt caching is enabled, but the cache hit rate is near zero. What should you change?

  1. A Add a semantic cache keyed on the full request so prompts that differ only in the timestamp reuse a previous response.
  2. B Raise the prompt cache TTL, since the provider evicts the cached system prompt before the next matching request arrives.
  3. C Put the system prompt and tools first and the timestamp and query last, since the cache matches an exact prefix.
  4. D Send the system prompt as a separate message, since the provider deduplicates identical text blocks anywhere in a request.

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

Get the app

Related questions