Cache anthropic api for repeated prompt previews
Marketing demos with repeated sample prompts
Short TTL cache on identical preview completions (non-production). For "cache anthropic api for repeated prompt previews", store ANTHROPIC_API_KEY in Secret Vault, call https://api.anthropic.com/v1/messages from a Worker, and let Framer hit only https://realcomposer.com/v1/workspace/cache-anthropic-api-prompt-previews with an rc_live_ client token. POST upstream calls are not stored in caches.default; clients must send JSON bodies and headers forward unchanged.
Anthropic rate limits from Framer traffic
Without edge caching, identical Anthropic reads during a session still round-trip to the origin.
- HTTP 429 responses during launch traffic
- Surprise SaaS overages from duplicate reads
- Slower repeat views than necessary
How RealComposer Solves This at the Edge
Store upstream credentials in Secret Vault
Create ANTHROPIC_API_KEY vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders.
Configure upstream steps and output mapping
Use POST against https://api.anthropic.com/v1/messages. Allowed origins on the client token should match post pipelines set cache ttl to 0 because realcomposer only stores get responses at the edge.
Fetch inside Framer overrides
Authorize with Bearer rc_live_ and fetch the mapped JSON contract your UI already expects.
fetch('https://realcomposer.com/v1/workspace/cache-anthropic-api-prompt-previews', {
headers: { Authorization: 'Bearer rc_live_your_token' }
});
{
"requestId": "req_cache-an",
"upstreamLatencyMs": 142,
"audit": {
"region": "edge",
"trace": "cache-anthropic-api-prompt-previews"
},
"payload": {
"id": "sample_id",
"status": "active",
"nested": {
"tags": [
"demo"
],
"internal": true
},
"unused_blob": {
"foo": "bar",
"bar": "baz"
}
}
}
{
"role": "sample",
"model": "sample",
"stopReason": "sample"
}
Recipe Specs
- HTTP method
- POST
- Upstream calls
- 1
- Edge cache TTL
- No caching
- Client auth
- Restricted client token
- Mapped output fields
- 3
- Payload
- 254 B to 56 B (-78%)
curl -X POST "https://realcomposer.com/v1/workspace/cache-anthropic-api-prompt-previews" \
-H "Authorization: Bearer rc_live_client_token" \
-H "Content-Type: application/json" \
-d '{"model":"example"}'Developer Questions & Troubleshooting
Is it safe to log Anthropic responses in Framer?
Store ANTHROPIC_API_KEY for cache-anthropic-api-prompt-previews. Framer never sees decrypted values.
When does edge caching apply to this recipe?
cache-anthropic-api-prompt-previews vault headers attach server-side, but Anthropic or OpenAI model and messages must come from the client body.
Can I restrict which domains call this pipeline?
Upstream steps in cache-anthropic-api-prompt-previews honor timeoutMs and optional fallback JSON without leaking secrets.
Sources & Definitions Used in This Answer
Deploy this Framer + Anthropic Recipe
Clone this pre-configured pipeline into your RealComposer workspace in one click. We pre-populate upstream URLs, headers, and mapping rules.