All Questions
Llm Gateway Cost And Caching medium

A low-traffic internal tool sends a 4,000-token stable system prompt with each request, but requests arrive only once every few hours. Prompt cache entries expire after a few minutes of inactivity, writes cost about 1.25x normal input, and reads about 0.1x. Should you enable prompt caching for this tool?

  1. A No: with gaps longer than the TTL, every call is a cache write at about 1.25x, costing more than no caching.
  2. B Yes: cached reads cost about one tenth of normal input, so any stable prefix cuts its input cost by roughly 90%.
  3. C Yes: caching also discounts output tokens, which dominate cost, so the savings hold even at very low request rates.
  4. D No: prompt caching only matches text shared with other tenants' prompts, and an internal tool has no other tenants.

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

Get the app

Related questions