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

# Control prompt caching

> Reuse generated reasoning prompts or request a fresh one.

<Frame>
  <img src="https://mintcdn.com/openserv/wCXyJJTiOX6drWSJ/images/tutorials/prompt-caching.webp?fit=max&auto=format&n=wCXyJJTiOX6drWSJ&q=85&s=c326829b9db3e8cc5f41de2071354740" alt="A stable prompt entering a cache vault and branching into reusable request paths" width="1536" height="1024" data-path="images/tutorials/prompt-caching.webp" />
</Frame>

SERV caches generated reasoning prompts per organization. The cache is enabled by default.

## How caching works

On the first request with a system prompt, SERV generates a reasoning prompt and stores it. A later request with the same organization, prompt, and relevant reasoning configuration can reuse that generated prompt. The customer request still goes to the upstream model each time; caching applies to the SERV reasoning-generation step.

Cache entries are organization-scoped and expire automatically. A cache hit can reduce latency and generation cost. It does not cache the model’s answer.

Disable it for a request with `metadata.prompt_cache`:

```js theme={null}
const response = await client.chat.completions.create({
  model: "gpt-5.4-mini",
  metadata: { prompt_cache: "disabled" },
  messages: [
    { role: "system", content: "Analyze the latest version of this policy." },
    { role: "user", content: "Review these policy changes: ..." },
  ],
});
```

Keep system prompts stable when possible. Put changing data in user messages or tool results so generated reasoning can be reused safely.

Use `metadata.prompt_cache: "disabled"` when the system prompt represents a newly changed policy, when you are testing a fresh prompt version, or when you need to avoid reusing a previous reasoning transformation. Do not put secrets in a system prompt merely because caching is enabled; follow your organization’s data-handling policy.
