Secure Anthropic Claude API Proxy for Frontend
Vault-backed Anthropic proxy tuned for Frontend / Web
Never place ANTHROPIC_API_KEY inside Frontend / Web source. RealComposer injects them when calling https://api.anthropic.com/v1/messages, so browsers see only a client token.
Anthropic keys in Frontend / Web network tabs
Frontend / Web ships code or scripts to end-user devices. Any Anthropic bearer token in those bundles can be copied from DevTools, proxies, or repackaged apps.
- Shared Frontend / Web projects revealing Anthropic tokens
- Sudden Anthropic quota burn from scripted abuse
- Inability to rotate keys without redeploying clients
How RealComposer Solves This at the Edge
Add vault secrets for this pipeline
Store ANTHROPIC_API_KEY in the vault. Frontend / Web never embeds the raw secret, only a revocable rc_live_ client token.
Configure upstream steps and output mapping
Configure headersTemplate to inject vault secrets, target https://api.anthropic.com/v1/messages, and Add output mapping fields that mirror the JSON contract your screen already expects.
Call from Frontend / Web
Allowed origins on the token should list every Frontend / Web host that calls this URL.
const res = await fetch('https://realcomposer.com/v1/workspace/anthropic-claude-api-frontend-proxy', {
headers: { Authorization: 'Bearer rc_live_your_token' }
});
{
"requestId": "req_anthropi",
"upstreamLatencyMs": 142,
"audit": {
"region": "edge",
"trace": "anthropic-claude-api-frontend-proxy"
},
"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/anthropic-claude-api-frontend-proxy" \
-H "Authorization: Bearer rc_live_client_token" \
-H "Content-Type: application/json" \
-d '{"model":"example"}'Developer Questions & Troubleshooting
Which Anthropic credential belongs in the vault for this pipeline?
Yes for anthropic-claude-api-frontend-proxy. Ship only an rc_live_ client token in Frontend / Web; RealComposer injects ANTHROPIC_API_KEY on https://api.anthropic.com/v1/messages.
What cache key does RealComposer use?
anthropic-claude-api-frontend-proxy vault headers attach server-side, but Anthropic or OpenAI model and messages must come from the client body.
What happens if an upstream step times out?
Upstream steps in anthropic-claude-api-frontend-proxy honor timeoutMs and optional fallback JSON without leaking secrets.
Sources & Definitions Used in This Answer
Deploy this Frontend / Web + Anthropic Recipe
Clone this pre-configured pipeline into your RealComposer workspace in one click. We pre-populate upstream URLs, headers, and mapping rules.