Skip to content

OpenAI Compatible Cache Matrix

lqdflying edited this page Jul 4, 2026 · 15 revisions

OpenAI Compatible Cache Matrix

ChatHub's built-in openaicompatible provider supports both /v1/chat/completions and /v1/responses, but compatible gateways do not all use the same cache hints. Use this page as a settings checklist.

Quick Preset Checklist

Legend: Checked means turn the switch on. Unchecked means turn the switch off. Backticked values are dropdown/select values.

apikl.ai

Use this when the provider-probe confirms the apikl.ai behavior.

UI setting Value
Use Responses API Specification Checked
OpenAI-compatible cache preset apikl.ai
Chat prompt_cache_key Checked
Chat Session_id Checked
Responses prompt_cache_key Auto-generate
Responses Session_id Unchecked
Responses store Default

pptoken.org

Use this for the legacy ChatHub Responses state-cache behavior.

UI setting Value
Use Responses API Specification Checked
OpenAI-compatible cache preset pptoken.org
Chat prompt_cache_key Unchecked
Chat Session_id Unchecked
Responses prompt_cache_key Auto-generate
Responses Session_id Unchecked
Responses store true

Custom

Use this when the provider-probe confirms a different combination.

UI setting How to choose
Use Responses API Specification Checked to call /v1/responses; unchecked to call /v1/chat/completions.
OpenAI-compatible cache preset Custom
Chat prompt_cache_key Check only if the chat probe confirms body prompt_cache_key helps.
Chat Session_id Check only if the chat probe confirms the Session_id header helps.
Responses prompt_cache_key Select Auto-generate only if the Responses probe confirms body prompt_cache_key helps; otherwise select Do not send.
Responses Session_id Check only if the Responses probe confirms the Session_id header helps.
Responses store Select the value confirmed by the probe: Default, true, or false.

Selecting a built-in preset writes the full matrix above. Any manual matrix edit switches the preset to Custom.

What Each Setting Sends

UI setting API path What ChatHub sends
Use Responses API Specification checked /v1/responses Routes requests to Responses API.
Use Responses API Specification unchecked /v1/chat/completions Routes requests to Chat Completions API.
Chat prompt_cache_key checked /v1/chat/completions Body prompt_cache_key: <derived stable key>.
Chat Session_id checked /v1/chat/completions Header Session_id: <derived stable key>.
Responses prompt_cache_key = Auto-generate /v1/responses Body prompt_cache_key: <derived stable key>.
Responses prompt_cache_key = Do not send /v1/responses No body prompt_cache_key.
Responses Session_id checked /v1/responses Header Session_id: <derived stable key>.
Responses store = Default /v1/responses No store field is sent.
Responses store = true /v1/responses Body store: true.
Responses store = false /v1/responses Body store: false.

Probe Workflow

Use the repo-local chathub-provider-probe skill and dedicated probe environment variables:

export PROBE_OPENAICOMPATIBLE_API_KEY='...'
export PROBE_OPENAICOMPATIBLE_PROXY_URL='https://provider.example.com/v1'
export PROBE_OPENAICOMPATIBLE_MODEL='gpt-5.5'

Interactive cache detection must be round-bounded:

node skills/chathub-provider-probe/scripts/probe-openai-compatible.mjs --phase cache-round --runs 6

Rules:

  • Use six runs for the first cache round and later interactive rounds.
  • Test one strategy per unconfirmed endpoint per round.
  • Pause after every round and ask the user to verify the request IDs in provider dashboard/logs.
  • Keep /v1/chat/completions and /v1/responses status separate.
  • If one endpoint is confirmed, lock that strategy and continue only the unconfirmed endpoint.
  • Use cache-matrix only for non-interactive exhaustion after explicit approval.

Runtime Notes

  • Provider config is stored as openAICompatCache.
  • Legacy responseStateMode: "provider" normalizes to the pptoken.org Responses behavior when no matrix exists.
  • Runtime-only fields are stripped before upstream request bodies are sent.
  • Responses Session_id-only mode must not force a body prompt_cache_key.
  • Cache keys are derived from stable prompt parts such as model, system/developer messages, first user message, reasoning effort, and tools.

Clone this wiki locally