Skip to content
Glossary · LLM costs

Prompt caching

Also called context caching.

Definition

Reusing the processed start of a prompt across calls, so repeated input is billed at a lower rate.

Last updated

What it is.

When many requests start with the same long prefix, such as instructions, tool definitions or a reference document, the provider can keep the processed prefix for a short time. Later calls that start with exactly the same prefix read it from the cache instead of processing it again.

Cached reads are billed below normal input tokens. Writing to the cache can cost more than normal input on some providers, and the cache expires after a period without use. Some providers cache automatically; others need you to mark where the cached part ends.

Why it matters

For chat assistants, agents and document tools, most input is the same on every call. Caching can make that repeated part much cheaper and often faster to start answering. Whether it pays off depends on how often the same prefix is reused before it expires.

Watch out

Common mistakes.

  1. 01

    Putting changing content, like a timestamp or user name, at the very start. Any change in the prefix breaks the cache.

  2. 02

    Caching prompts that are rarely reused before the cache expires, so you pay the write cost without the savings.

  3. 03

    Comparing providers on the list input price alone when most of your input would be cached.

Tools

Work it out with a tool.

Related

Related terms.

Building something with this? Ask an engineer.

OceanLab designs and builds production software. Tell us what you are planning and we will reply with how we would approach it.

OceanLab

Enterprise Software Engineering - Human + AI

Languages

Locations

Global Headquarters

21 Merchant Road, 3rd Floor, Singapore 058267

Main corporate office and leadership operations

North America Office

548 Market Street, PMB 12472, San Francisco, CA 94104

Client operations and business development

India Office

402 Shivalik Shilp II, SG Highway, Ahmedabad 380015

Engineering and delivery center

© 2026 - Copyright. All Rights reserved OceanLab