- Cloudflare Workers Proxy for most LLM services.
- Only proxy, no logs, no request‑body modification.
- Sign up / Sign in to Cloudflare → go to the Dashboard.
- Verify your email and account according to the prompts.
- Open Compute → Workers & Pages or click directly here.
-
Click Create Application → Start With Hello World.
-
Copy the JavaScript from worker.js and replace the demo code in the editor.
-
Configure the variables at the top of the editor, e.g.:
const TARGET_ORIGIN = "https://api.groq.com"; // Target API URL const GEORESTRICT = false; // Geo restrictions
-
Click Deploy. After deployment you can access your API via the Worker domain.
Cloudflare’s default secondary domain
workers.devmay be restricted in some regions, so you might need to bind a custom domain.
- Own a domain and add it to Cloudflare).
1.1. You can purchase a domain directly from Cloudflare or from another registrar such as GoDaddy.
If you don’t want to spend money, consider a free service like DigitalPlat or DNSHE. For commercial use, buy a proper domain.
1.2. After buying the domain, click Onboard a Domain on the dashboard home page and follow the prompts to set the name servers. - In the Worker’s Settings tab, click Add under Domains & Routes to bind the custom domain.
After binding, latency in some regions may improve, but traffic still routes through Cloudflare, so results in certain areas may still be sub‑optimal.
- Toggle geographic restrictions by setting the variable at the top of the file; the logic runs only when
GEORESTRICT = true. - Add the country codes you want to allow directly in the code.
Example:
// ...
const country = (request.cf && request.cf.country) || "XX";
if (country !== "CN") {
return new Response(
// ...Cloudflare supplies GeoIP data, which may occasionally be inaccurate.