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

# Prompt caching

> How Mantle orders the system prompt for caching, and the extra cache marks Claude routes get.

## How the prompt is ordered

Mantle builds the system prompt in a fixed order so a provider can cache the
part that stays the same. Sections that rarely change come first, and the
turn-varying ones come last. The date, time, and memory notice are separate
system messages, and they follow the conversation. Providers that keep message
order reuse the unchanged prefix on their own. There is no setting for this
order. [System Prompt](https://rasa.com/docs/mantle/reference/system-prompt.md) lists each section and when
it appears.

### Claude routes

Claude does not reuse a prefix unless the request marks it, so Mantle adds
those marks on routes that accept them. The model group in
[`integrations.yml`](https://rasa.com/docs/mantle/reference/integrations-yml#model_groups) decides which
marks a route gets.

A route must name its adapter, either with `provider` or with a model prefix
such as `anthropic/claude-sonnet-4-5`. A bare model name with no provider, such
as `claude-sonnet-4`, gets no mark. Add `provider: anthropic` to get one.

#### Which marks a route gets

| Route | System-prompt mark | Automatic caching |
| - | - | - |
| Claude on Anthropic's API | Yes | Yes |
| Claude on Anthropic's API with `api_base` or `base_url` | No | No |
| Claude on Bedrock, Vertex AI or Azure AI Foundry | Yes, at any endpoint | No |
| Non-Claude model | No | No |
| Claude-named model on an OpenAI-compatible gateway | No | No |

Automatic caching needs a direct call to Anthropic's API. A router member gets
it only when its model string carries the `anthropic/` prefix. A member with
`provider: anthropic` and a bare model name gets the system-prompt mark only.
The `ANTHROPIC_API_BASE` and `ANTHROPIC_BASE_URL` environment variables count
as a custom endpoint, because LiteLLM reads them for a route with no base of
its own.

A router gets a mark only when every route qualifies. A router that includes a
provider other than Claude gets neither mark. A router that mixes Anthropic's
API with Bedrock, Vertex AI or Azure AI Foundry gets the system-prompt mark
only.

#### What to expect

* **Trailing notes.** On Claude routes, LiteLLM moves every system message into
  the top-level `system` field. The date, time, and memory notice therefore sit
  before the conversation history. A change in them, such as a new minute or a
  memory update, misses the cached history, while the system-prompt entry
  still hits.
* **The first system message.** The mark covers the whole first system
  message. That includes the current-turn notice, the acknowledgement, the
  active skill or routing catalogue, and any pending confirmation. A change in
  any of them misses both cache entries.
* **Environment variables.** Mantle reads `ANTHROPIC_API_BASE` and
  `ANTHROPIC_BASE_URL` when the agent starts. Restart the agent after you change
  either one.
* **Cost.** A cache write costs 1.25 times the input price, and a read costs 0.1
  times. Entries last 5 minutes and are refreshed on each read. A conversation
  that is idle for more than 5 minutes pays the write again. Whether caching
  lowers your cost depends on how often conversations reuse the cached content.
* **Data.** Anthropic holds cached content under its
  [prompt caching terms](https://platform.claude.com/docs/en/build-with-claude/prompt-caching).
  On a direct Anthropic route, the cached content includes the conversation
  history.
* **Turning it off.** There is no setting to turn either mark off.

## See also

* [System Prompt](https://rasa.com/docs/mantle/reference/system-prompt.md): assembly order, including what sits in the first system message
* [Prompt templates](https://rasa.com/docs/mantle/reference/prompt-templates.md): the full text of each assembled prompt
* [`integrations.yml`](https://rasa.com/docs/mantle/reference/integrations-yml#model_groups): the model group that selects the route


## Related topics

- [Prompt templates](https://rasa.com/docs/mantle/reference/prompt-templates.md)
- [System Prompt](https://rasa.com/docs/mantle/reference/system-prompt.md)
- [integrations.yml](https://rasa.com/docs/mantle/reference/integrations-yml.md)
- [Deploying Fine-Tuned LLMs for Command Generation](https://rasa.com/docs/reference/deployment/deploy-fine-tuned-model.md)
- [Build an Agent with Prompts](https://rasa.com/docs/learn/ai-assisted-development.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.