I'm trying to generate an image using the g4f library with the Gemini model, but I get a 404 error. The code was working before, but now it fails consistently.
Code:
from g4f.client import Client
client = Client()
response = client.images.generate(
model="gemini",
prompt="a white siamese cat"
)
image_url = response.data[0].url
Error:
Traceback (most recent call last):
File "c:\Users\USER\g4f\main.py", line 4, in
response = client.images.generate(...)
^^^^^^^^^^^^^^^^^^^^^^^
...
File "C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 643, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
The error occurs when undetected_chromedriver tries to download ChromeDriver (line 287 in patcher.py). It seems to be failing at fetching the ChromeDriver package.
Additional context: I'm in Russia, and I use a VPN/IP changer for g4f to work The error appeared suddenly, even though the same code worked before Sometimes restarting the code or the VPN helps temporarily, but the error returns
What I've tried: Restarting the code Toggling VPN/IP changer on/off The issue seems related to ChromeDriver download failing
Why is undetected_chromedriver trying to download ChromeDriver, and how can I fix the 404 error? Is there a way to manually provide ChromeDriver to avoid the automatic download? Could this be related to region blocking even with VPN?