Building Fun Projects with OpenAI Codex



Image by Author

 

OpenAI Codex CLI is an open-source tool designed to bring the power of AI coding assistants directly to your terminal. Similar to tools like Cursor AI and Windsurf, Codex CLI offers chat-driven development that not only understands your codebase but can also make changes, execute commands, and even build new projects from scratch.

In this guide, we will learn how to set up Codex CLI locally and explore its capabilities by building three fun projects. Along the way, we will test its multimodal feature, approval functionality, and its ability to understand and modify codebases.

 

Setting Up Codex CLI

 
1. Download and install Node.js (version 22 or newer, LTS recommended) from nodejs.org. Verify installation with:

 

2. Download Git from git-scm.com and verify with:

 

3. Install OpenAI Codex CLI

npm install -g @openai/codex

 

4. Set your OpenAI API key

export OPENAI_API_KEY="your-api-key-here"

 

5. Navigate to your project directory:

 

6. Initialize Git if needed:

 

7. Start Codex CLI in interactive mode:

 

Building Fun Projects with OpenAI Codex

 

1. Building A Portfolio Website

 
In this project, we will create a portfolio website inspired by an existing design. To start, we will take a screenshot of the portfolio website we want to replicate (https://tdhopper.com/) and provide it to the Codex CLI tool.

 

Building Fun Projects with OpenAI Codex
Image from tdhopper.com

 

Use the following command to provide the image location to Codex CLI:

codex --image "C:\Users\abida\Pictures\Screenshots\Screenshot 2025-04-26 194831.png"

 

Codex will analyze the image and provide a detailed explanation of what the image represents. By default, it uses the “o4-mini” model, with the approval setting set to “suggest”. 

 

Building Fun Projects with OpenAI Codex

 

Next, write the following prompt to instruct Codex to build a portfolio website based on the screenshot, but customized for your details:

Use the image to build a portfolio website for Abid Ali Awan, a professional data scientist who writes about AI and machine learning.

 

Since we are in “suggest” mode, Codex will ask for confirmation before creating files or running shell commands. Simply approve all the requests as they appear.

 

Building Fun Projects with OpenAI Codex

 

Once Codex completes the process, you will have a fully functional portfolio website built in just a few minutes. 

Replace placeholder links (e.g., profile image and blog links) with your actual profile image URL and blog URLs.

 

Building Fun Projects with OpenAI Codex

 

Double-click the index.html file to open the website in your browser.

 

Building Fun Projects with OpenAI Codex

 

The resulting website will be 90% similar to the original design, with your personal details and customizations. The process is quick, efficient, and produces a professional-looking portfolio website.

Note: The “suggest” mode ensures that you have full control over the file creation and execution process. This makes it easy to review and approve changes step by step.

 

2. Performing Data Analysis

 
In this project, we will analyze a dataset and generate a comprehensive data analytical report using Codex CLI. This example demonstrates how Codex can streamline data analysis and automate the creation of professional reports.

To begin, we’ll use the –auto-edit mode, which is semi-automatic. In this mode, Codex automates most tasks, including file creation and editing, without requiring your approval. However, it will still prompt you for confirmation when running shell commands.

Run the following Codex command to analyze the dataset:

codex --auto-edit "The dataset `placementdata.csv` is available in the root directory. Please perform detailed data analysis and generate an analysis report."

 

Within seconds, Codex will analyze the dataset (placementdata.csv) and generate a detailed analysis report in the form of a markdown file.

 

Building Fun Projects with OpenAI Codex

 

Once the report is generated, open the markdown file to review it. You will find a well-structured document with the following sections:

  1. Dataset Overview: Describes the structure and key characteristics of the dataset.
  2. Analysis Details: Includes statistical summaries and technical analysis.
  3. Insights: Highlights key findings from the data.
  4. Conclusion: Provides a summary of the results and actionable insights.

 

Building Fun Projects with OpenAI Codex

 

3. Developing Image Classification Application

 
In this project, we will build a machine learning application for classifying images. The application will use the ResNet18 pre-trained model and FastAPI for creating a custom user interface. To streamline the process, we will run Codex CLI in full autonomous mode, allowing it to handle everything from file creation to documentation.

Use the following command to instruct Codex to build the application:

codex --full-auto "Build an image classification application using ResNet18 and FastAPI with Custom UI"

 

Within a minute, Codex will generate all the necessary files, including the Python scripts, configuration files, and documentation. It will also provide a step-by-step guide on how to run the application locally.

 

Building Fun Projects with OpenAI Codex

 

1. First, we need to install all the necessary Python packages for this project.  

pip install -r requirements.txt

 

2. To run the app locally, use the command:  

uvicorn main:app --reload

 

3. Open the link http://127.0.0.1:8000 in your browser, upload an image, and view the top 5 predictions from your model, along with their probabilities.

 

Building Fun Projects with OpenAI Codex

 

The application is highly responsive and provides accurate predictions, even for images it wasn’t explicitly trained on (e.g., Ghibli-style images).

 

Conclusion

 
I find Codex CLI to be a superior tool compared to GitHub Copilot, particularly in terms of its accuracy, codebase understanding, and debugging capabilities. One of its standout features is its ability to execute projects with minimal intervention—most tasks require just a single command, and there’s rarely a need for follow-up commands to fix issues. The projects generated by Codex CLI work seamlessly right out of the box.

Another major advantage of Codex CLI is that it’s open-source, which opens up exciting possibilities for customization. Developers can integrate their own local language models (LLMs) or even proprietary models like DeepSeek R1 or Claude 3.7, making it a highly flexible and adaptable tool for various use cases.
 
 

Abid Ali Awan (@1abidaliawan) is a certified data scientist professional who loves building machine learning models. Currently, he is focusing on content creation and writing technical blogs on machine learning and data science technologies. Abid holds a Master’s degree in technology management and a bachelor’s degree in telecommunication engineering. His vision is to build an AI product using a graph neural network for students struggling with mental illness.

Recent Articles

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here