An enterprise platform needs to implement multi-turn conversation with Claude for a customer support application. Each support session averages 15 turns. The team's initial implementation re-sends the entire conversation history on every turn. At turn 15, the average input token count is 28,000 tokens. The platform serves 10,000 concurrent sessions. A senior engineer proposes storing conversation history server-side and implementing a turn-delta approach. However, the Claude API requires the full messages array. What is the correct optimization that reduces token costs without changing the conversational experience?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Here's the deal — prompt caching on the conversation history prefix is the architecturally correct solution. For a multi-turn conversation, turns 1 through N-1 are identical in every API call within that session.
Full explanation below image
Full Explanation
Prompt caching on the conversation history prefix is the architecturally correct solution. For a multi-turn conversation, turns 1 through N-1 are identical in every API call within that session. By placing cache_control breakpoints at the end of the previous-turn content, all historical turns are served from cache — you pay only for the new user message tokens as input, not for re-processing the entire conversation history. At turn 15 with 28,000 token histories, this eliminates ~26,000 tokens of redundant processing per turn. Cache hits are charged at ~10% of normal input token rates. Option A (mid-conversation summarization) introduces a quality risk: the summary may omit details relevant to turns 8-15, degrading resolution quality — and it requires an additional API call. Option C's 5-turn sliding window is too aggressive for support sessions that often reference earlier details (e.g., 'as I mentioned at the start, my account number is...'); it degrades resolution quality. Option D's compression of assistant responses is fragile, computationally expensive, and the 30% savings claim is speculative — it also risks removing content that matters for coherence.