pi-mono icon indicating copy to clipboard operation
pi-mono copied to clipboard

Anthropic's ephemeral cache markers are not used in OpenRouter API calls

Open v01dpr1mr0s3 opened this issue 1 week ago • 6 comments

The issue:

When I use Anthropic models via OpenRouter, apparently cache markers are not used, if I look at my OR activity details:

Image

And there's no mention of caching in generation details (these are several requests from a single pi session):

Image

Possible cause:

I asked Opus 4.5 to find why. Here are their ideas:

When using Anthropic models via OpenRouter (e.g., anthropic/claude-3.5-sonnet), the harness routes through openai-completions.js instead of anthropic.js. This means no cache_control: { type: "ephemeral" } markers are being added to the messages.

In openai-completions.js (used for OpenRouter): No cache_control markers are added anywhere

Obligatory illustration:

Image

v01dpr1mr0s3 avatar Jan 09 '26 04:01 v01dpr1mr0s3