1

Install Docker

G4F can be run using Docker. Ensure that you have Docker installed on your system. You can check if you have Docker installed by running the following command in your terminal:

user@mac-air:~$ docker --version
> Docker version 23.0.5, build bc4487a

If you don’t have Docker installed, you can download it from the official Docker website.

2

Pull the g4f Docker image

You can pull the g4f Docker image using the following command:

docker pull hlohaus789/g4f

This will download the latest version of the g4f Docker image.

3

Run the g4f Docker container

Once the image is pulled, you can run the g4f Docker container with the following command:

docker run -p 8080:8080 -p 1337:1337 -p 7900:7900 --shm-size="2g" -v ${PWD}/hardir:/app/hardir hlohaus789/g4f:latest

This command will start the g4f container and expose the necessary ports.

4

Access the Web UI

After starting the container, you can access the included web client at:

http://localhost:8080/chat/

Alternatively, you can set the API base in your own client to:

http://localhost:1337/v1

This can be used with the openai python package, API Specifications

5

(Optional) View the container desktop

If you need to log in to a provider, you can view the desktop from the container at:

http://localhost:7900/?autoconnect=1&resize=scale&password=secret
6

All set! You now have g4f running in a Docker container. You can navigate to Basic Usage for further instructions.