> ## Documentation Index
> Fetch the complete documentation index at: https://docs.weflayr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompt caching optimisation

> Providers charge less for tokens at the start of a prompt they have already seen.

When two calls share the same opening text, the second one can reuse that prefix from cache instead of paying full price for it.

## Improvements it proposes

Weflayr looks at each feature's real calls, measures how much of that achievable caching you already capture, and proposes two kinds of improvements to capture the rest:

* **Config changes**: finds the best the caching settings based your AI calls and on each provider's own caching rules (retention, explicit vs implicit caching, minimum cacheable length, breakpoints and so on).
* **Prompt-structure changes**: reorders the prompts when it makes sense so more of it can be cached.

<Frame>
  <video src="https://mintcdn.com/weflayr/_Mt_r8ZiFzCJL_Dd/images/product/prompt-caching-front.mp4?fit=max&auto=format&n=_Mt_r8ZiFzCJL_Dd&q=85&s=83b7f47346bbea30fb683400a0b8f5e4" poster="/images/product/prompt-caching-front-poster.jpg" aria-label="Prompt caching page with the savings summary, one row per feature with its captured caching share, and the all-ship impact simulation" controls loop muted playsInline preload="metadata" className="w-full rounded-xl" data-path="images/product/prompt-caching-front.mp4" />
</Frame>

Open a feature to see its analysis.

<Frame>
  <video src="https://mintcdn.com/weflayr/-Mt-2Smg-srMobua/images/product/prompt-caching-detail.mp4?fit=max&auto=format&n=-Mt-2Smg-srMobua&q=85&s=937ba9b90aef353eacf987a4daf7b37a" poster="/images/product/prompt-caching-detail-poster.jpg" aria-label="Prompt caching detail with header stats, improvement findings and the impact simulation" controls loop muted playsInline preload="metadata" className="w-full rounded-xl" data-path="images/product/prompt-caching-detail.mp4" />
</Frame>

## Details on prompts

**View details on prompts** on a finding shows the real calls it applies to, each as it ran versus with the fix, highlighting the tokens that would move into cache.

<Frame>
  <img src="https://mintcdn.com/weflayr/swYZJQfBVJ4AL5hK/images/product/prompt-caching-examples.png?fit=max&auto=format&n=swYZJQfBVJ4AL5hK&q=85&s=0d5d62d99818237f826e1630739ca9ab" alt="Per-example view comparing a prompt as it ran and with the caching fix applied" width="1512" height="767" data-path="images/product/prompt-caching-examples.png" />
</Frame>
