Skip to content

Feature Request: Support prompt_cache_key metadata for provider-side cache routing #16357

Description

@lumenclaw-cloud

Problem

When running multiple sessions (e.g., 18+ sessions), identical or similar prompts may be routed to different GPU clusters by OpenRouter, causing cache misses and higher latency/cost.

Proposed Solution

Expose prompt_cache_key (or similar mechanism) in configuration to allow users to:

  1. Route similar prompts to the same cache bucket
  2. Improve cache hit rates for high-frequency patterns (e.g., heartbeat checks)
  3. Optimize for multi-session setups

Use Case

  • 18 active sessions with 1h heartbeat intervals
  • Each heartbeat sends similar system context
  • Currently cache misses due to random routing
  • Would benefit from stable routing keys

Context

This request is inspired by Kimi K2.5's implementation guidance (via @Hxtu0 on X/Twitter), which highlights:

  • Explicit prompt_cache_key helps route requests to appropriate clusters
  • Setting session_id in metadata.user_id achieves similar routing
  • Avoiding round hours (e.g., 10:00) prevents thundering herd issues

References

Priority

Nice-to-have for cost optimization in high-session-count deployments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions