Skip to content

feat(openrouter): support cacheTtl provider option for extended cache TTL#993

Open
kargnas wants to merge 1 commit intoprism-php:mainfrom
kargnas:feat/cache-control-ttl
Open

feat(openrouter): support cacheTtl provider option for extended cache TTL#993
kargnas wants to merge 1 commit intoprism-php:mainfrom
kargnas:feat/cache-control-ttl

Conversation

@kargnas
Copy link
Copy Markdown
Contributor

@kargnas kargnas commented Mar 28, 2026

OpenRouter supports extended cache TTL via the ttl field: https://openrouter.ai/docs/guides/best-practices/prompt-caching

Before (5 min default, no way to extend):

  $message->withProviderOptions(['cacheType' => 'ephemeral']);
  // sends: "cache_control": {"type": "ephemeral"}

After (1h TTL):

  $message->withProviderOptions(['cacheType' => 'ephemeral', 'cacheTtl' => '1h']);
  // sends: "cache_control": {"type": "ephemeral", "ttl": "1h"}

Without cacheTtl, behavior is unchanged (no ttl key sent).

@kargnas kargnas force-pushed the feat/cache-control-ttl branch from 393110d to e59c6c5 Compare March 28, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant