# Prompt Cache Savings Calculator for Agent Tool Prefixes

> Source: https://netray.co/tools/prompt-cache-savings-calculator-for-agent-tool-prefix
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Free Tools

## Short answer

Compares input spend with and without prompt caching for a stable tool and system prefix, and sweeps cache hit rate.

## Category

ai-automation

## Audience

- AI engineer
- ERP integration developer
- IT manager

## Tool

**Kind:** calculator

**Currency:** $

**Inputs:**

#### Stable prefix size

**Key:** prefix

**Type:** number

**Default:** 8000

**Min:** 0

**Step:** 500

**Unit:** tokens

**Help:** System prompt plus tool definitions that are identical across calls.

#### Dynamic tokens per call

**Key:** dynamic

**Type:** number

**Default:** 2000

**Min:** 0

**Step:** 250

**Unit:** tokens

**Help:** User text, history and tool results.

#### Calls per day

**Key:** calls

**Type:** number

**Default:** 5000

**Min:** 0

**Step:** 250

#### Base input price per million tokens

**Key:** price

**Type:** number

**Default:** 3

**Min:** 0

**Step:** 0.1

**Unit:** $ per 1M

#### Cache read price as fraction of base

**Key:** read_mult

**Type:** number

**Default:** 0.1

**Min:** 0

**Max:** 1

**Step:** 0.05

**Help:** Check your provider. Some discount cached reads heavily.

#### Cache write price as multiple of base

**Key:** write_mult

**Type:** number

**Default:** 1.25

**Min:** 1

**Max:** 3

**Step:** 0.05

**Help:** Some providers charge a premium on a cache miss that writes the prefix.

#### Cache hit rate

**Key:** hit

**Type:** slider

**Default:** 80

**Min:** 0

**Max:** 100

**Step:** 5

**Unit:** %

**Outputs:**

#### Daily input cost without caching

**Key:** uncached

**Expr:** calls * (prefix + dynamic) / 1000000 * price

**Format:** currency

#### Daily input cost with caching

**Key:** cached

**Expr:** calls * (prefix * (hit / 100 * read_mult + (1 - hit / 100) * write_mult) + dynamic) / 1000000 * price

**Format:** currency

#### Daily savings

**Key:** saved_day

**Expr:** uncached - cached

**Format:** currency

**Primary:** true

#### Monthly savings (30 days)

**Key:** saved_month

**Expr:** saved_day * 30

**Format:** currency

**Primary:** true

#### Savings as share of input cost

**Key:** saved_pct

**Expr:** saved_day / max(uncached, 0.000001) * 100

**Format:** percent

#### Break-even hit rate

**Key:** breakeven

**Expr:** clamp((write_mult - 1) / max(write_mult - read_mult, 0.000001) * 100, 0, 100)

**Format:** percent

**Description:** Below this hit rate caching costs more than it saves.

**Chart:**

#### Daily savings by cache hit rate

**Type:** line

**X:** hit

**From:** 0

**To:** 100

**Steps:** 21

**Series:**

- saved_day

**Disclaimer:** Pricing structures differ by provider and may include minimum cacheable sizes and time-to-live limits. Enter your provider's actual multipliers.

## Content

**Intro:** Agents re-send the same system prompt and tool definitions on every call. If your provider offers prompt caching, that stable prefix can be billed far below the base price on a hit. This tool shows what that is worth.

**Sections:**

#### How to use it

**Body:** Set the token size of the stable prefix: system prompt plus tool definitions that do not change between calls. Enter dynamic tokens per call and daily call volume. Then enter your provider's cache read and write multipliers and an expected hit rate. You get daily and monthly savings, the share of input spend saved and the break-even hit rate. The chart sweeps hit rate from zero to one hundred so you can see how sensitive savings are to cache misses.

#### Formula

**Body:** Without caching, input cost is calls times total tokens times price. With caching, the prefix is billed at the read fraction on hits and at the write multiple on misses, while dynamic tokens stay at the base price. Break-even hit rate is (write multiple minus 1) divided by (write multiple minus read fraction): below it, the write premium on misses outweighs the discount on hits.

**Bullets:**

- Keep the prefix byte-identical and place dynamic content after it.
- Sort tool lists deterministically.
- Cache lifetimes are short, so low traffic lowers hit rate.

#### Common mistakes

**Body:** Putting a timestamp or user name at the top of the prompt breaks the prefix and drops the hit rate to zero. Changing tool order between deployments or between users has the same effect. Also check that your prefix exceeds the provider's minimum cacheable length, and remember that caching reduces price and often latency but not the window space the prefix uses.

**Cta:** If you run private models instead, the equivalent is prefix caching in the serving engine. Netray can help tune that for your ERP agents.

**Faq:**

#### What is a typical cache hit rate?

**Answer:** It depends on traffic. Steady, frequent traffic with an unchanging prefix can see high hit rates, while sporadic use lets cache entries expire between calls. Measure from your provider's usage fields and enter the real figure.

#### Does caching change answers?

**Answer:** No. It reuses computed state for an identical prefix, so the model sees the same input. It affects billing and latency, not the content of the response.

#### What breaks the cache?

**Answer:** Any change before the cached boundary: edited system prompt, reordered or modified tool definitions, injected dates or user-specific text near the top. Keep volatile content after the stable prefix.

#### Is this relevant for self-hosted models?

**Answer:** The concept is similar. Engines such as vLLM support automatic prefix caching, which saves GPU compute instead of dollars. The same prefix discipline applies, but the savings show up as throughput.

## Search terms

prompt caching savings calculator, llm prompt cache cost, cache hit rate input token cost, agent prefix caching, reduce llm input cost caching, cached token pricing calculator

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
