clickai.dev
← Legend / The harness

Prompt caching

Prompt caching is the reuse of an already-processed context prefix, billed at a fraction of fresh input — a cache hit costs a tenth of the base input rate, against a surcharge to write the entry. The prefix runs tools, then system, then messages, in that order, and the cache matches the longest one it can. So the front of a context is expensive to change and the back is cheap to extend, which is why appending to a file the agent has already read costs less than rewriting its top, and why adding one tool definition invalidates the cache for every prompt that uses tools. Most of the advice about keeping instructions stable is really an economic argument wearing a quality costume.

establishedSettled. Documented by a primary source and not seriously disputed.

Legend last revised .