CCAPrep
← All labs
D5·Fix the code

A cache that never hits

A support assistant sends a large shared system prompt on every request. Caching was enabled weeks ago, but `cache_read_input_tokens` is zero on every response and the bill never moved.

system = [
    {
        "type": "text",
        "text": f"Current time: {datetime.now().isoformat()}\n\n{PLAYBOOK}",
        "cache_control": {"type": "ephemeral"},
    }
]

response = client.messages.create(
    model="claude-opus-5", max_tokens=4096, system=system, messages=messages
)

1.Why does nothing ever read from cache?

2.Where should the timestamp go instead?