Responses Third Party Prompt Cache Patch
Patch the installed OpenClaw dist bundle so shouldStripResponsesPromptCache(model) stops deleting prompt_cache_key and prompt_cache_retention for third-party OpenAI-compatible Responses endpoints.
Source: https://github.com/tsunheimat/openclaw-responses-prompt-cache-patch
Quick install for OpenClaw
clawhub install responses-third-party-prompt-cache-patch --workdir ~/.openclaw/workspace
Risks
- Write directly into the OpenClaw installation directory under
dist/. - Require Python 3 and Node.js on the target machine.
- Need a gateway restart after apply or rollback for the change to take effect.
Quick start
Run from this skill directory:
python3 scripts/patch_prompt_cache.py --dry-run
python3 scripts/patch_prompt_cache.py
openclaw gateway restart
Roll back
python3 scripts/revert_prompt_cache.py
openclaw gateway restart
Target selection
- Default to the currently installed OpenClaw root by resolving the
openclawexecutable. - Accept
--root /path/to/openclawto patch a copied fixture or a different installation. - Scan
dist/pi-embedded-*.jsfirst, then fall back to otherdist/*.jsbundles only if the target function moved.
What the scripts do
scripts/patch_prompt_cache.py
- Support
--dry-run - Create timestamped backups before writing
- Apply a narrow patch only inside
shouldStripResponsesPromptCache(model) - Run
node --checkafter writing - Auto-restore the fresh backup if syntax validation fails
- Detect already-patched bundles and upgrade-style reapply situations
scripts/revert_prompt_cache.py
- Restore the latest matching backup for each currently patched bundle
- Support
--dry-run - Validate restored files with
node --check
Recommended verification flow
- Run
--dry-runon the real installation. - Copy the target bundle into a fixture and run
--root <fixture>for real apply testing. - Run apply again to confirm idempotency.
- Run rollback on the same fixture.