All Questions
Llm Gateway Cost And Caching hard

A feature sends a 3,000-token prompt and gets 1,200-token answers. Output tokens cost about 5x input tokens. One proposal halves the prompt to 1,500 tokens. Another caps answers at 400 tokens with a terser format. Which saves more, and why?

  1. A Halving the prompt, since input tokens outnumber output tokens 2.5 to 1 per request and therefore dominate the per-request cost of this feature.
  2. B Capping output: weighted at 5x, the answer is about two thirds of cost, so the cap saves about 44% versus about 17% for halving the prompt.
  3. C They save about the same, since providers bill on total tokens processed, so removing 1,500 input or 800 output tokens is roughly equivalent.
  4. D Halving the prompt, since shorter prompts also produce proportionally shorter outputs, compounding the savings on both sides of the bill.

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

Get the app

Related questions