Prove OpenAI Retry Cache HITs in n8n with Metrecept JWKS
Prove OpenAI Retry Cache HITs in n8n with Metrecept JWKS
Regular price
£52.99
Regular price
£52.99
Sale price
Unit price
/
per
⬇
Instant Digital Download
∞
Unlimited Downloads
★
Lifetime Access in Your Account
Couldn't load pickup availability
🔥
128+ Sold
Popular with n8n builders
⚡
23 people viewing
High interest right now
✅
9 added today
Fast-moving digital product
Prove OpenAI Retry Cache HITs in n8n with Metrecept JWKS
Regular price
£52.99
Regular price
£52.99
Sale price
Unit price
/
per
Prove OpenAI Retry Cache HITs in n8n (with Metrecept JWKS verification)
This n8n workflow sends the exact same OpenAI-style chat completion request to Metrecept twice—first to demonstrate a cache MISS, then (optionally) to produce and prove a cache HIT—verifying the returned receipt signature using Metrecept’s public JWKS.
What this workflow does
-
Accepts input via manual run or webhook: a POST request containing
promptormessages(optionallymodelandprove_retry). -
Normalizes and freezes the payload: converts your input into an OpenAI Chat Completions request body, freezes it as a JSON string, and returns HTTP 400 if no
messagesare provided. -
Sends the request to Metrecept: posts the frozen payload to
/v1/chat/completionsand captures cache/billing headers. Returns HTTP 402 on budget errors and HTTP 502 for other upstream failures. -
Generates a retry HIT (optional): when
prove_retryis enabled and the first response is a cache MISS, the workflow sends the identical payload again to trigger a cache HIT. - Verifies the receipt signature (JWKS): if a receipt JWS header is present, it fetches Metrecept’s public key directory (JWKS) and verifies the Ed25519 signature. If missing, it reports verification as unavailable.
-
Returns a consolidated proof object: includes mode, cache status, billed amounts, receipt verification result, and current usage from Metrecept
/v1/usage.
Use cases
- Audit that “retry” behavior in your OpenAI-style integrations actually yields cache HITs.
- Validate Metrecept receipt integrity for compliance or internal reliability testing.
- Estimate billed impact by comparing MISS vs HIT scenarios with returned usage data.
Technical details
-
n8n nodes:
webhook,if,set,code,switch, plus sticky notes for clarity. -
Metrecept integration: HTTP calls to
/v1/chat/completionsand/v1/usage, plus public JWKS fetch for receipt verification. -
Auth setup: an n8n HTTP Header Auth credential using
Authorization: Bearer <your_intermediate_key>.
