Theme
Language

Prompt caching

Prompt caching on supported models: a repeated prefix is read from cache far more cheaply than full input. For Claude, cache_control breakpoints; on /v1/messages the gateway adds them for you. curl examples.

Prompt caching saves on a repeating request prefix (system instruction, history, tool descriptions). For supporting models a repeated prefix is read from the cache much cheaper than normal input — on the order of tens of percent of the full price. Cache support for each variant is shown on the Modelspage.

OpenAI-compatible path

On /v1/chat/completions models of the OpenAI family cache automatically: an identical stable prefix on repeated requests is read from the cache. No special fields are needed — the main thing is not to change the start of the request. That is why the body is passed to the endpoint byte for byte, without reordering fields.

Claude: cache_control

Claude works differently: it caches only when there are explicit cache_control breakpoints in the body — repeating the prefix does not switch caching on by itself. Put such a breakpoint at the end of the unchanged part (system or the last block):

curl https://getvibeapi.com/v1/messages \
  -H "x-api-key: $GETVIBE_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-5.5",
    "max_tokens": 256,
    "system": [
      {
        "type": "text",
        "text": "A large fixed instruction worth caching…",
        "cache_control": { "type": "ephemeral" }
      }
    ],
    "messages": [{"role": "user", "content": "Question about the instruction"}]
  }'
If you do not pass a breakpoint of your own, the gateway inserts one for you — on /v1/messages and on /v1/chat/completions alike. If you manage the cache yourself, your markup stays as is.

Claude agents: there is a native endpoint

For Claude we support the native Anthropic format — /v1/messages with the x-api-key header. It is what Claude Code and the Anthropic SDK use: the body goes upstream as it is, with no translation from the OpenAI shape, so both the cache breakpoints and the cache_creation / cache_read fields in the response survive intact.

That is a measurement, not a promise: on 2026-08-21 an agent session on claude-opus-5 over /v1/messages — 119 requests, 15M input tokens — read 91.6% of its input from the cache. How much cache you actually get is always visible in the response usage and in the request statistics in your dashboard.

GetVibe API prompt caching — cache_control, cheap cache reads | GetVibe API