# Caching

To enable caching, you can use the `CacheControl` object when defining the parts of a message.

[Learn more about how caching works in OpenRouter](https://openrouter.ai/docs/features/prompt-caching)

{% tabs %}
{% tab title="JSON" %}

```json
{
  "role": "user",
  "content": [
    {
      "type": "text",
      "text": "Based on the book text below:"
    },
    {
      "type": "text",
      "text": "HUGE TEXT BODY HERE",
      "cache_control": {
        "type": "ephemeral"
      }
    },
    {
      "type": "text",
      "text": "List all main characters mentioned in the text above."
    }
  ]
}
```

{% endtab %}

{% tab title="Orpheus" %}

```rust
use orpheus::

let message = Message::user([
    Part::text("Based on the book text below:"),
    Part::text("HUGE TEXT BODY HERE").with_caching(CacheControl::Ephemeral),
    Part::text("List all main characters mentioned in the text above."),
]);
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://orpheus.ajac-zero.com/features/caching.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
