RealComposer

Anthropic Safe & Unsafe Practices

Direct Answer

Anthropic API keys (sk-ant-) are server-only. The SDK only allows browser calls when you opt in with a dangerous direct browser access flag, which exposes the key to visitors. Route Claude calls through a server or edge proxy with workspace spend limits.

Credentials & Where They Belong

Server only
API key (sk-ant-)

Bills usage to your workspace. Create one per environment.

Safe Practices

  • Use workspaces with spend limits

    Isolate production and testing keys and cap monthly spend per workspace.

  • Pin model and max_tokens server-side

    Never accept model or token limits from the client request body.

Unsafe Practices

  • Enabling direct browser access in production

    The flag exists for prototypes. In production it publishes your key to every visitor.

  • Passing unbounded conversation history from the client

    Attackers can send huge contexts to inflate cost. Trim and cap on the server.

The RealComposer Pattern

Keep ANTHROPIC_API_KEY in the vault and expose a fixed-model pipeline that returns only the text content block your UI renders.

START BUILDING FREE

Frequently Asked Questions

Q:Is the anthropic-dangerous-direct-browser-access header safe?

Only for local prototypes with your own key. Production apps should proxy requests so the key never reaches the browser.

Security & Secret Vault

Anthropic api proxy for flutterflow chat app

Mirrors OpenAI pattern: Messages API with Anthropic key injected at edge. For "anthropic api proxy for flutterflow chat app", store ANTHROPIC_API_KEY in Secret Vault, call https://api.anthropic.com/v1/messages from a Worker, and let FlutterFlow hit only https://realcomposer.com/v1/workspace/anthropic-api-proxy-flutterflow with an rc_live_ client token. POST upstream calls are not stored in caches.default; clients must send JSON bodies and headers forward unchanged.

Sub-10ms edgeView Recipe
Security & Secret Vault

Hide Anthropic API Key in an Expo App

EXPO_PUBLIC_ variables and app config extra fields are inlined into every Expo build and EAS Update bundle, so an Anthropic key placed there is public. Call a RealComposer pipeline instead: it injects ANTHROPIC_API_KEY as the x-api-key header at the edge and returns just the reply text.

Sub-10ms edgeView Recipe
Security & Secret Vault

Hide anthropic api key in nextjs chat interface

Next.js client chat UI calls edge stream; Anthropic never touches browser. For "hide anthropic api key in nextjs chat interface", store ANTHROPIC_API_KEY in Secret Vault, call https://api.anthropic.com/v1/messages from a Worker, and let Next.js / React hit only https://realcomposer.com/v1/workspace/hide-anthropic-api-key-nextjs with an rc_live_ client token. POST upstream calls are not stored in caches.default; clients must send JSON bodies and headers forward unchanged.

Sub-10ms edgeView Recipe
Multi-API Aggregation

Combine anthropic claude with openai fallback router

Primary Anthropic Messages step plus OpenAI fallback step in one pipeline. For "combine anthropic claude with openai fallback router", store ANTHROPIC_API_KEY, OPENAI_API_KEY in Secret Vault, call https://api.anthropic.com/v1/messages from a Worker, and let Frontend / Web hit only https://realcomposer.com/v1/workspace/combine-anthropic-with-openai-fallback with an rc_live_ client token. POST upstream calls are not stored in caches.default; clients must send JSON bodies and headers forward unchanged.

Sub-10ms edgeView Recipe

Combine anthropic with supabase vector rag search

Anthropic completion plus Supabase vector match results composed at edge. For "combine anthropic with supabase vector rag search", store ANTHROPIC_API_KEY, SUPABASE_SERVICE_ROLE_KEY in Secret Vault, call https://api.anthropic.com/v1/messages from a Worker, and let Next.js / React hit only https://realcomposer.com/v1/workspace/combine-anthropic-supabase-vector-rag with an rc_live_ client token. POST upstream calls are not stored in caches.default; clients must send JSON bodies and headers forward unchanged.

Sub-10ms edgeView Recipe

Related Concepts