Skip to content

Google AI Studio Proxy: HTTPS_PROXY, Base URL, Region Error

Three different things are called a proxy for AI Studio. This page sorts them out and says what to check when the region message appears.

Which "proxy" do you mean?

Which "proxy" do you mean?
ItemWhat it isHow to set itDoes it change Google's decision?
Network proxy for the AI Studio siteYour browser or system sends traffic through a proxyOperating system or browser proxy settingsNo: the region and account checks stay the same
Network proxy for API calls from codeThe SDK or curl connects to the API through a proxyHTTPS_PROXY and NO_PROXY, or the SDK's client argumentsNo: same API, same terms
Base URL (gateway)The SDK talks to your own endpoint, which forwards to the APIbase_url in the SDK's HTTP optionsNo: the gateway must still pass your key header on
Backend proxy for keysA server of yours that holds the key for browser or mobile appsNot a network proxy: an application designNot related to location

Source: Google AI Studio documentation (API keys) and the Google Gen AI Python SDK README, read on 14 November 2026.

What the region message means

Google's page on available regions lists the countries and territories where the Gemini API and AI Studio are available. A visitor from outside the list may see that the region is not supported, and for Colab the restriction follows the region the Colab instance runs in. The terms say you may only access the services within an available region, and that you must be 18 or older.

A proxy does not make a region available: it only changes the network address a request leaves from. Use one when your own network requires it, or when you are working in a listed country and want a stable exit that matches where the account is. Do not use one to reach a service where Google does not offer it; that is against the terms and can put the account at risk.

API calls: test the proxy, then set HTTPS_PROXY

# 1) Test the proxy login outside Python (HTTP port)
curl -x "http://LOGIN:PASSWORD@HOST:2222" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  "https://generativelanguage.googleapis.com/v1beta/models"

# 2) Same proxy for the SDK: set it before the program starts
export HTTPS_PROXY="http://LOGIN:PASSWORD@HOST:2222"
export NO_PROXY="localhost,127.0.0.1"
python app.py

Example only: replace LOGIN, PASSWORD and HOST with the values from My assets and use your own key. Not run against Google on the writing machine.

Python SDK: a proxy in the client arguments

# pip install google-genai
from google import genai
from google.genai import types

# base_url: only if you run your own gateway in front of the API
# client_args / async_client_args: passed to the HTTP client (shape taken from the SDK README)
http_options = types.HttpOptions(
    client_args={"proxy": "http://LOGIN:PASSWORD@HOST:2222"},
    async_client_args={"proxy": "http://LOGIN:PASSWORD@HOST:2222"},
)
client = genai.Client(http_options=http_options)  # key from GEMINI_API_KEY
print(client.models.generate_content(model="MODEL_NAME", contents="Say hi").text)

The client_args shape is taken from the Google Gen AI SDK README (shown there for SOCKS5); check it against your installed version. Replace the placeholders and the model name.

Base URL: only for your own gateway

The SDK's base_url sends requests to an endpoint you choose, such as an API gateway. It is not a network proxy and it does not make a region available. REST calls use the host generativelanguage.googleapis.com and carry the key in the x-goog-api-key header, so a gateway has to forward that header.

If you only wanted your traffic to leave through a particular IP, you do not need a base URL: HTTPS_PROXY or the client arguments are enough.

Errors people mix up

AI Studio says the region may not be supported

Check Is your country on the official available-regions list, and is the account of an adult?

Fix Compare with the list; in Colab the region of the Colab instance counts. If you are outside the list, the service is not offered to you.

Stop when Do not keep changing proxies: the decision is Google's, not the network's.

403 PERMISSION_DENIED with FREE_TIER_VERIFICATION_REQUIRED

Check Has the project been verified, or does it have billing?

Fix Verify the project or set up billing as the troubleshooting page says. A new key in the same project does not help, because eligibility is per project.

400 failed_precondition

Check Is a prerequisite such as billing missing?

Fix Check the project's billing status. The docs say not to retry 400, 402 or 403 errors.

407 or the connection times out through the proxy

Check Are host, port and login right, and does curl through the same proxy work?

Fix Use the curl test above, then see the proxy authentication guide.

A stable exit that matches your account

If you work in a country where Gemini is available and want one fixed address that matches the region of your account, a static ISP IP does not rotate during the lease: US$0.50 for 1 day or US$7.99 for 30 days (about US$0.27 a day). Choose HTTP for HTTPS_PROXY and the SDK; HTTP uses port 2222 and SOCKS5 port 3333 on proxy.proxy302.com.

There is no free trial; the smallest purchase is one IP for one day. A proxy does not change Google's region rules or your account's eligibility.

Set it up: steps

  1. Step 1

    Check your country against the official available-regions list and confirm the account is eligible.

  2. Step 2

    Buy a static ISP IP in the country where you actually work and copy host, port, username and password from My assets.

  3. Step 3

    Test the login with the curl command, then set HTTPS_PROXY (or the client arguments) before your program starts.

  4. Step 4

    Call the API once and confirm it answers; if you get a 403, read the message, not the network.

    Expected result A normal response, or a clear 4xx message about the project.

FAQ

How do I use a proxy with Google AI Studio?

For the site, set the operating system or browser proxy. For API calls, set HTTPS_PROXY before the program starts, or pass a proxy in the SDK's client arguments.

What is the Gemini proxy URL?

The SDK's base_url points at an endpoint of your choosing, such as your own gateway. The API itself is at generativelanguage.googleapis.com.

Will a proxy fix "region not supported"?

No. Availability depends on the official region list, your account and the terms; a proxy changes only the network address.

Why do I get a 403 with a working proxy?

A 403 is often about the project: verification, free-tier eligibility or billing. Eligibility is checked per Google Cloud project, so a new key does not change it.

Does Google Colab follow my own region?

Google says region restrictions in Colab apply to the region the Colab instance is in.

Reference links

7
  1. Google AI Studio docs: Available regions

    Official documentation · Confirmed on:

    Read on 14 November 2026: the Gemini API and Google AI Studio are available in the listed countries and territories, and the list includes the United Kingdom and Switzerland; a visitor from an unlisted region may see that the region may not be supported; for Colab, restrictions follow the region of the Colab instance.

  2. Google AI Studio docs: Terms of Service

    Official documentation · Confirmed on:

    Read on 14 November 2026: you must be 18 or older to use the APIs; the Services may only be accessed within an available region; only Paid Services may be used when making API clients available to users in the European Economic Area.

  3. Google AI Studio docs: API keys

    Official documentation · Confirmed on:

    Read on 14 November 2026: keys are read from GEMINI_API_KEY or GOOGLE_API_KEY (GOOGLE_API_KEY wins if both are set); REST requests send the key in the x-goog-api-key header to generativelanguage.googleapis.com; for client-side apps the page recommends a backend proxy server so that the key stays on your server.

  4. Google AI Studio docs: Troubleshooting

    Official documentation · Confirmed on:

    Read on 14 November 2026: a 403 PERMISSION_DENIED can mean the project needs verification (FREE_TIER_VERIFICATION_REQUIRED), is not eligible for the free tier (eligibility is evaluated per Google Cloud project, not per key or location), has an outstanding balance, or the key was reported as leaked.

  5. Google AI Studio docs: API errors

    Official documentation · Confirmed on:

    Read on 14 November 2026: failed_precondition (400) means a prerequisite such as billing is not met; permission_denied (403) means no key permission or a restricted project; do not retry 400, 402 or 403 errors.

  6. Google Gen AI Python SDK README

    Official documentation · Confirmed on:

    Read on 14 November 2026: HttpOptions takes base_url to route requests through a custom endpoint such as an API gateway proxy; client_args and async_client_args are passed to the HTTP client, with a proxy entry shown for SOCKS5; the SDK reads HTTPS_PROXY from the environment (example: http://username:password@proxy_uri:port).

  7. Proxy302 product facts and price list

    Product observation · Confirmed on:

    Product facts file of the site (values checked on 10 November 2026): protocols and ports, prices in US$ (1 PTC = US$1), lease terms, quantity limits, no free trial.

Ready to try it?

Create an account, top up once, then pick rotating residential, static ISP or datacenter IPs and have one running in your browser within minutes.