Cloudflare AI Gateway Upstream Configuration

This guide will help you configure Cloudflare AI Gateway as GPT-Load's upstream proxy, optimizing AI service request performance and stability through Cloudflare's global network.

Important Notice

Cloudflare AI Gateway only supports certain AI service providers. Before configuration, please confirm that your required AI service channels are in Cloudflare's support list. If your channel is not available in the API platform dropdown list, then that channel is not available.

1
Register and Login to Cloudflare

Access Cloudflare Dashboard

Go to Cloudflare official website to register an account and login to the console

https://dash.cloudflare.com

2
Enter AI Gateway Management Page

Navigate to AI Gateway

Select Menu

In the left navigation bar, select in order: AI → AI Gateway

Access Management Page

Enter the AI Gateway management page, where you can see the current gateway list

Cloudflare AI Gateway menu navigation screenshot

Click image to enlarge

3
Create AI Gateway

Click Create Gateway

On the AI Gateway page, click the “Create Gateway” button to start configuring a new gateway

Configure Gateway Parameters

Set Gateway Name

gpt-load

The name can be set arbitrarily, here using “gpt-load” as an example

Keep Default Settings

Other configuration items can keep their default values

Important Configuration Items

  • Do not enable caching - CF's cache has bugs in some channels
  • Do not enable gateway authentication - Keep authentication function disabled
Cloudflare AI Gateway creation form screenshot

Click image to enlarge

4
Get Channel Proxy Address

View API Endpoints

Click API Button

After creation is complete, click the “API” button in the upper right corner

Select Target Channel

Find your required AI service provider in the API platform dropdown list and copy the corresponding proxy address

Each AI service provider has a corresponding proxy address, make sure to select the correct channel

Cloudflare AI Gateway API endpoint list screenshot

Click image to enlarge

5
Configure to GPT-Load

Add Upstream Address

Copy Proxy Address

Copy the proxy address obtained from Cloudflare AI Gateway to the upstream address configuration of the corresponding group in GPT-Load

Example Address:

https://gateway.ai.cloudflare.com/v1/b7fbxxxxxfdba/gpt-load/google-ai-studio

Where b7fbxxxxxfdba is your account ID, gpt-load is the gateway name, google-ai-studio is the specific AI service provider

GPT-Load Configuration Example

GPT-Load configuring Cloudflare AI Gateway upstream address example screenshot

Click image to enlarge

Gemini Channel Special Notice

Important Reminder

When using Gemini channel type with Cloudflare AI Gateway:

  • Recommended: Use Gemini native format calls, works normally
  • Not recommended: Use Gemini official OpenAI format calls, may cause garbled output issues

This is a known issue with Cloudflare AI Gateway, it is recommended to always use Gemini native format to ensure optimal compatibility.

Network Routing Issue Reminder

About Regional Blocking Reminder

If your GPT-Load server is located in mainland China or Hong Kong, Cloudflare may route requests to Hong Kong nodes.

Since many AI service providers (such as OpenAI) do not support this region, this may cause User location is not supported errors.

If you encounter this issue, please adjust your server's network environment and retry.

Verify Configuration

Test Connection

After configuration is complete, send a test request to confirm the proxy is working properly. If you encounter problems, please check the Cloudflare AI Gateway status and GPT-Load configuration for correctness.