Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 2.57 KB

File metadata and controls

53 lines (39 loc) · 2.57 KB

README_CN🇨🇳

  • Cloudflare Workers Proxy for most LLM services.
  • Only proxy, no logs, no request‑body modification.

How To Use

Step A – Have or Get a Cloudflare Account (Preparation Works)

  1. Sign up / Sign in to Cloudflare → go to the Dashboard.
  2. Verify your email and account according to the prompts.
  3. Open Compute → Workers & Pages or click directly here.

Step B – Create Worker and Paste JavaScript (Deploy Works)

  1. Click Create Application → Start With Hello World.

  2. Copy the JavaScript from worker.js and replace the demo code in the editor.

  3. 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
  4. Click Deploy. After deployment you can access your API via the Worker domain.

Step C – Bind & Customize (Advanced)

Domain Bind

Cloudflare’s default secondary domain workers.dev may be restricted in some regions, so you might need to bind a custom domain.

  1. 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.
  2. 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.

GeoIP Access Restrictions

  • 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.