Anthropic LLM Proxy on the Edge (Auth, Attribution, CORS)
An AI-cofounder / autonomous-startup-builder SaaS
Overview
An edge LLM proxy for an AI-cofounder / autonomous-startup-builder SaaS: a Cloudflare Worker that fronts the Anthropic API, adding authentication, per-project usage attribution and CORS so the agent fleet and app can call models safely.
Why It Exists
Many autonomous projects share model access, but each needs its own auth boundary, its own usage accounting and controlled browser access. A thin proxy in front of the provider centralizes keys, enforces auth, and records attribution without every caller holding raw credentials.
What We Built
A Worker (anthropic-proxy) with a small, focused source set: index.ts and api.ts for request handling, cors.ts for browser-origin control, and a convex/ module (auth.ts, crypto.ts, fly.ts, types.ts) that backs authentication, encryption and usage/attribution against Convex (with an accompanying schema.convex.sql and a separate wrangler.convex.toml). A test-attribution.md documents the usage-attribution behavior.
Technologies & Approach
TypeScript on Cloudflare Workers, deployed via Wrangler, with Convex holding auth and attribution state and crypto helpers protecting stored credentials. Keeping the proxy minimal and edge-deployed gives low-latency model access while concentrating security and accounting in one place.
Outcome / Impact
Gives the platform a single, auditable choke point for model traffic, authenticated, CORS-controlled and attributed per project, so agents can use Anthropic models without handling provider keys directly.
Capabilities Demonstrated
- Edge proxy in front of the Anthropic API
- Authentication and encrypted credential handling
- Per-project LLM usage attribution
- CORS-managed access for browser clients