Llm Gateway Cost And Caching easy
Your primary LLM provider is fully down for an hour, and no tested fallback exists for your agent feature. The product also has an FAQ answer feature backed by a semantic cache. What is the best degradation mode?
- A Queue all requests indefinitely and replay them once the primary provider recovers.
- B Retry each failed call in a tight loop until the primary provider starts responding.
- C Serve cached or reduced answers where possible and show a degraded-mode notice.
- D Send all traffic to whichever provider is up and assume the prompts behave the same.
Answer: C. Serve cached or reduced answers where possible and show a degraded-mode notice.
A planned degradation mode **trades completeness for availability**: cached FAQ answers keep working, and features that cannot run tell users so. Blind fallback is tempting, but untested prompts and tool schemas can produce wrong actions on another provider. Rerouting is right only when the fallback's prompts and tools have been validated in advance.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- Your gateway applies one 5-second timeout to all LLM calls. Classification calls work fine, but long streamed answers are frequently cut off. What is the best fix?
- A multi-tenant B2B support assistant answers questions using each customer's private knowledge base. To raise the semantic cache hit rate from 22% to 35%, an engineer proposes one shared cache across all tenants. What is the main problem?
- During a provider brownout returning 429 and 503 errors, the client SDK retries 3 times and the gateway also retries 3 times, both immediately. Provider load spikes, and the bill grows from partially streamed responses. What should you change?
- Finance asks for LLM spend broken down by tenant and by product feature. Today the gateway only sees the total on the provider's monthly invoice. What should you do?
- A retail assistant uses a semantic cache. Weeks after a store changed its holiday hours, users still receive the old hours from cached answers. What is the right fix?
- A feature sends 1,500 input tokens and receives 600 output tokens per request. Output tokens cost about 5x input tokens. Which single change cuts cost the most?