February 21, 2025

How to install and Run on Local Computer gpt4free – Free LLM and Text-to-Image Models

In this large language model and machine learning tutorial, we explain how to install and run on a local computer gpt4free. Gtp4free is a graphics user interface and a collection of scripts for accessing and using most of popular large language models and text-to-image models for free. It uses different strategies to access the models online. Note that gpt4free is not running models locally, instead it uses different strategies to access models running on online servers. The YouTube tutorial is given below.

Installation of gpt4free

In the first step, you need to install Docker Engine. To install Docker Engine, follow the tutorial given here. After installing Docker Engine, open a terminal and type

cd ~
mkdir testGPT
cd testGPT

Then, type this:

mkdir -p ${PWD}/har_and_cookies ${PWD}/generated_images

sudo chown -R 1200:1201 ${PWD}/har_and_cookies ${PWD}/generated_images

Then, pull the Docker image

docker pull hlohaus789/g4f

Then, to run gpt4free, type this:

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

This should start a terminal and you will be able to access the gpt4free on the local host address (for more details see the YouTube tutorial). Let us explain this command

  • docker run: is used to create an instance of a container and to run it
  • -p 8080:8080 -p 7900:7900 is used to specify the access and container ports
  • –shm-size=”2g” – Docker shm size refers to the amount of shared memory allotted to a docker container.
  • -v ${PWD}/har_and_cookies:/app/har_and_cookies: The -v (or –volume) argument to docker run is for creating storage space inside a container that is separate from the rest of the container filesystem. The format -v <volume-name>:<mount-path> is a way of either feeding information into your container, or providing a way for your container to make files accessible to the host.
  • hlohaus789/g4f:latest is the image name