Skip to content
ML Academy

Introduced on day 54

Prompt caching

A provider feature that reuses the processed form of an identical prompt prefix, billing cached reads at a fraction of the input price and lowering time to first token.

In detail

A hit needs the same prefix, so stable content (tools, system instructions, reference documents) goes first and variable content last; changing an earlier part invalidates everything after it. Cache lifetimes are short and small prompts may not be cached, so check the cache read and write token counts instead of assuming a hit rate. Output is unchanged. Rules differ by provider.