{
  "slug": "anthropic-api-framer-without-cors",
  "title": "How to call anthropic api from framer without cors",
  "metaTitle": "call anthropic api from framer - RealComposer",
  "metaDescription": "How to call anthropic api from framer without cors. Framer fetch to RealComposer with streaming-friendly he. Framer CORS fix for Anthropic via.",
  "headline": "Framer AI widgets with edge Claude proxy",
  "category": "ecosystem",
  "categoryLabel": "Platforms & Frameworks",
  "urgency": 9,
  "clientPlatform": "Framer",
  "upstreamServices": [
    "Anthropic"
  ],
  "searchIntentQuery": "how to call anthropic api from framer without cors",
  "directAnswerSummary": "Framer fetch to RealComposer with streaming-friendly headers. For \"how to call anthropic api from framer without cors\", 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/anthropic-api-framer-without-cors with an rc_live_ client token. POST upstream calls are not stored in caches.default; clients must send JSON bodies and headers forward unchanged.",
  "problem": {
    "title": "Framer cannot attach secret headers to Anthropic",
    "explanation": "Framer runs in the browser or a sandbox without a secret store. Anthropic rejects unsigned browser origins or requires server-only headers.",
    "risks": [
      "Proxy hacks that break when vendors tighten CSP",
      "Zapier-only workarounds adding cost and latency",
      "Guest users seeing failed network requests in demos"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Add vault secrets for this pipeline",
      "description": "Create ANTHROPIC_API_KEY vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders."
    },
    {
      "stepNumber": 2,
      "title": "Configure upstream steps and output mapping",
      "description": "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."
    },
    {
      "stepNumber": 3,
      "title": "Fetch inside Framer overrides",
      "description": "Allowed origins on the token should list every Framer host that calls this URL.",
      "codeSnippet": "fetch('https://realcomposer.com/v1/workspace/anthropic-api-framer-without-cors', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "How to call anthropic api from framer without cors",
    "method": "POST",
    "cacheTtlSeconds": 0,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "anthropic",
        "upstreamUrlTemplate": "https://api.anthropic.com/v1/messages",
        "httpMethod": "POST",
        "headersTemplate": {
          "x-api-key": "{{secrets.ANTHROPIC_API_KEY}}",
          "anthropic-version": "2023-06-01",
          "Content-Type": "application/json"
        },
        "timeoutMs": 10000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "role",
          "sourcePath": "content.0.text",
          "type": "string",
          "sourceStep": "anthropic"
        },
        {
          "targetPath": "model",
          "sourcePath": "model",
          "type": "string",
          "sourceStep": "anthropic"
        },
        {
          "targetPath": "stopReason",
          "sourcePath": "stop_reason",
          "type": "string",
          "sourceStep": "anthropic"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_anthropi",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "anthropic-api-framer-without-cors"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "role": "sample",
    "model": "sample",
    "stopReason": "sample"
  },
  "curlSnippet": "curl -X POST \"https://realcomposer.com/v1/workspace/anthropic-api-framer-without-cors\" \\\n  -H \"Authorization: Bearer rc_live_client_token\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"model\":\"example\"}'",
  "faqs": [
    {
      "question": "Can Framer call Anthropic without holding the production key?",
      "answer": "Store ANTHROPIC_API_KEY for anthropic-api-framer-without-cors. Framer never sees decrypted values."
    },
    {
      "question": "Does POST traffic get cached?",
      "answer": "anthropic-api-framer-without-cors keeps cache TTL at 0 because it uses POST upstream calls or per-user responses. Add ids to query strings before enabling GET cache."
    },
    {
      "question": "How do I rotate upstream credentials?",
      "answer": "Upstream steps in anthropic-api-framer-without-cors honor timeoutMs and optional fallback JSON without leaking secrets."
    }
  ],
  "relatedRecipeSlugs": [
    "connect-custom-rest-api-to-framer",
    "anthropic-api-proxy-flutterflow"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/anthropic-api-framer-without-cors",
    "markdown": "https://realcomposer.com/recipes/anthropic-api-framer-without-cors.md",
    "json": "https://realcomposer.com/recipes/anthropic-api-framer-without-cors.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=anthropic-api-framer-without-cors&via=agent"
  }
}