GPT-Engineer: Generate an Entire Codebase with 1 Prompt!

GPT-Engineer: Your Personal Code-Building Sidekick - Because Even AI Wants to Be Your App-Savvy BFF!

GPT-Engineer: Generate an Entire Codebase with 1 Prompt!

The utilization of various AI models for code generation has evolved over time. Initially, ChatGPT demonstrated its ability to generate code. Subsequently, Auto-GPT introduced the concept of complete autonomy with GPT-4. Now, with the advent of GPT-Engineer, it is possible to construct entire applications using a single prompt.

The functioning of GPT-Engineer is straightforward. Users only need to describe their project, and GPT-Engineer takes care of the rest. There is no requirement to manually copy and paste code, create files, or set up the project environment independently.

To install and use GPT-Engineer, follow the steps below. This guide will address any errors encountered during installation and attempt to provide updates in case of changes in the GitHub repository.

Step 1: Clone the Repository

Begin by cloning the GitHub repository. Open a terminal and execute the following command:

git clone

Step 2: Set up GPT-Engineer

This action creates a new folder named gpt-engineer Change the directory using the following commands:

cd gpt-engineer
make install
source venv/bin/activate

If you encounter the error "No module named venv," you must set up a virtual environment that runs Python 3 (using pip or conda), activate it, and then repeat the above steps. Follow the appropriate commands based on your package manager:

# pip
python3 -m venv name-of-env
source name-of-env/bin/activate
cd gpt-engineer
(same steps above)

# conda
conda create --name name-of-env python=3.11.3
conda activate name-of-env
cd gpt-engineer
(same steps above)

Next, set your API key by executing the commands shown below. Obtain your OpenAI API Key by following the provided link.

# macOS/linux
export OPENAI_API_KEY=[your api key]

# windows
set OPENAI_API_KEY=[your api key]

Step 3: Run GPT-Engineer

Interacting with GPT-Engineer is done through the "main_prompt" file located in the projects folder. By default, there is an "example" folder available.

To start a new project, create a new folder using the command below:

cp -r projects/example/ projects/my-new-project

Now it’s time to edit the main_prompt file. If you open it up with a text editor, you’ll see the text below.

We are writing snake in python. MVC components split in separate files. Keyboard control.

Those are the instructions to create a snake game in Python. You can test it out as is, but for this demo, I’ll change the prompt to scrape my website.

Note: In case you leave the prompt as is, you should get this snake game after following the steps in the next section.

Test #1: Web Scraping

Scrape the article titles from the website "". The article titles are enclosed in an h2 tag. Export the data into a CSV file.

To run GPT-Engineer, use the following command:

gpt-engineer projects/my-new-project

Since my folder was named “web-scraping” the command will be gpt-engineer projects/web-scraping for me.

Check out the files generated!

All the generated files will be in projects/my-new-project/workspace.

Here are the files I got.

As you can see I got the .py files that do the scraping part for me and also I got the data I wanted in a CSV file.

All the data was successfully scraped!

Remember that you might still encounter some errors while following every step in this guide. This GitHub project is good but has some issues. Here are some I found.

Note 1: The requirements.txt file might not be generated. If that’s the case, duplicate the all_output.txt file (that should’ve been generated, and locate the requirements.txt section. Delete everything but the libraries specified in that section.

Note 2: If you get the error openai.error.ServiceUnavailableError: The server is overloaded or not ready yet just try again later and it should be fine.

Test #2: Create a Web App

As we do with ChatGPT, when you edit the main_prompt file you can be very specific with your prompt or not.

In this case, I’ll just type “Create a website about dogs” to see what it can deliver without much prompting.

Here are all the files I got.

Unfortunately, I’d still have to do some tweaks to get the web app running, but GPT-Engineer still simplified the whole process.

That’s it! Now it’s your time to build apps with GPT-Engineer. Let me know in the comment section whether GPT-Engineer got your request in one shot or if you still had to do some tweaks to get the code working.

For more info about GPT-Engineer, check the official repo.

📚 Want to dive deeper into AI-driven development and unlock more premium articles like this? Subscribe to stay updated and gain access to exclusive content. You won't want to miss out! ✨
☕️ Enjoyed the article? Consider buying me a coffee to support my work and receive even more premium articles on fascinating topics like this. Your support means the world! ☕️