Skip to content

Session affinity (for prompt caching) per provider #229

Description

@cometkim

Problem Statement

It seems that OCR currently lacks explicit session affinity control.

Depending on the provider, it may need to provide an explicit header to enable prompt caching.

  • OpenAI: prompt_cache_key in body.
  • Anthropic: don't use explicit parameter. (undeterministic)
  • Cloudflare/Fireworks/Mistral/others: Commonly x-session-affinity in header.

Since the "session" must be managed by OCR, users cannot provide the provider themselves.

Proposed Solution

Define the session key in OCR's lifecycle. Maybe related to #59 (comment)

Inject it to the request, or provide a template variable so that the user can configure extra_headers directly. e.g. x-session-affinity: {ocr_session_key}

Alternatives Considered

No response

Affected Area

Configuration

Additional Context

No response

Activity

  1. added theissue type on Jun 26, 2026
  2. added
    enhancement
    on Jun 26, 2026
  3. added 4 commits that reference this issue on Jul 13, 2026
    cc14dda
    870332f
    cc6a342
    50e401b
  4. added 6 commits that reference this issue on Aug 6, 2026
    0f62851
    7648b51
    c1cfa6f
    1a430c3
    59c7db6
    312e358
  5. added a commit that references this issue on Aug 14, 2026
    144607f
  6. added a commit that references this issue on Sep 17, 2026
    2223784
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions