OpenAI Codex User Guide with 3 Real-World Examples

OpenAI has just released Codex inside the ChatGPT app . Codex is a tool that helps developers and teams offload their daily programming work.

 

This tutorial will show you how to use the Codex inside ChatGPT to perform real-world tasks on GitHub repositories, even if you are not a professional programmer. We will use the Codex to:

  1. Apply code fixes and create pull request.
  2. Explain a complex function within the code base.
  3. Identify and resolve errors based on Q&A style prompts.

You'll see how Codex works in a secure sandbox, creating verifiable code changes and helping you deliver faster without leaving ChatGPT.

What is OpenAI Codex?

OpenAI Codex is a cloud-based software engineering agent that can write and edit code, run tests, fix bugs, and even submit pull requests. Each task is performed in its own sandbox environment.

Codex is powered by codex-1, a version of the o3 model tuned to real-world development workflows. This agent is built for safety, testability, and developer productivity. You can navigate Codex using AGENTS.md files or interact with it directly in the ChatGPT sidebar.

With the Codex CLI, you can also bring these capabilities directly into your terminal.

Setting Up OpenAI's Codex

Setting up Codex only takes a few minutes. Here's a simple step-by-step guide to get you started.

Step 1: Locate the Codex tool

Start by logging into ChatGPT. On the left toolbar, look for Codex. Note that Codex is currently only rolled out to Pro, Team, and Enterprise users.

 

OpenAI Codex User Guide with 3 Real-World Examples Picture 1

Step 2: Get Started with Codex

Click on Codex and you will be taken to another tab for initial setup. Click on Get Started and follow the authentication process as shown in the next step.

OpenAI Codex User Guide with 3 Real-World Examples Picture 2

 

Step 3: Multi-factor authentication

Click Set up MFA to continue and scan the QR code using your favorite authenticator app (like Google Authenticator or Authy ). Enter the code to verify and you're done!

OpenAI Codex User Guide with 3 Real-World Examples Picture 3

Step 4: Connect to GitHub

Once multi-factor authentication is complete, we'll connect Codex to GitHub.

OpenAI Codex User Guide with 3 Real-World Examples Picture 4

 

Step 4.1: Authorize GitHub Connector

'Connect to GitHub' will take you to a pop-up window to authorize GitHub Connector. Read through the pop-up window and click Authorize ChatGPT Connector.

OpenAI Codex User Guide with 3 Real-World Examples Picture 5

Step 4.2: Add a GitHub account

Once GitHub is connected, you'll need to add your account. Under the GitHub organization tab, select Add a GitHub account .

OpenAI Codex User Guide with 3 Real-World Examples Picture 6

 

OpenAI Codex User Guide with 3 Real-World Examples Picture 7

This will take you to another pop-up to select Install and Authorize . Click to authorize and all your repositories will appear on the ChatGPT interface. You can also authorize only selected repositories.

OpenAI Codex User Guide with 3 Real-World Examples Picture 8

Step 4.3: Create environment

Select the repository you want to work with and click Create environment .

OpenAI Codex User Guide with 3 Real-World Examples Picture 9

 

This will take you to Data Controls . The Codex is still in active development and you may see an optional prompt to allow the use of your data to improve the model. You can disable this and continue.

OpenAI Codex User Guide with 3 Real-World Examples Picture 10

Now your environment is ready to explore. The Codex allows users to start tasks in parallel with pre-selected tasks.

OpenAI Codex User Guide with 3 Real-World Examples Picture 11

Simply click Start tasks or select the task of your choice. This will take you to an interface where you can ask a question or ask the agent to code a feature for you.

OpenAI Codex User Guide with 3 Real-World Examples Picture 12 OpenAI Codex User Guide with 3 Real-World Examples Picture 13

 

Once all the tasks are ready, choose the one you want to do - or you can do multiple tasks in parallel.

Step 5: AGENTS.md file (optional)

The AGENTS.md file is a special configuration file introduced by OpenAI for use with the Codex platform, specifically designed to help guide AI agents as they work in your codebase. You can think of it as a developer's guide for your AI teammates, much like a README.md, but focused on guiding automated agents. Here's an example of an AGENTS.md file:

# AGENTS.md ## Code Style - Use Black for Python formatting. - Avoid abbreviations in variable names. ## Testing - Run pytest tests/ before finalizing a PR. - All commits must pass lint checks via flake8. ## PR Instructions - Title format: [Fix] Short description - Include a one-line summary and a "Testing Done" section

When Codex runs a task on your codebase, it will:

  1. Searches for AGENTS.md files whose scope includes the files it is modifying.
  2. Apply the instructions in those files to format, test, and record your changes.
  3. Prefer deeper nested instructions when applying multiple files (like cascading configuration).

3 Real-World Examples from OpenAI's Codex

Let's explore how Codex can help you in real-world development using 3 examples run on a repository.

Example 1: Basic fixes and typos

Sometimes Codex breaks a request down into sub-tasks — like fixing a typo, improving a README, or writing tests — all within the same workspace.

OpenAI Codex User Guide with 3 Real-World Examples Picture 14 OpenAI Codex User Guide with 3 Real-World Examples Picture 15

You can start a new task within an existing task based on initial reviews, request changes to an existing codebase, or ask a question via the text box. To expand a task or fix a new bug, click Code and start a new subtask directly.

OpenAI Codex User Guide with 3 Real-World Examples Picture 16

Once you are happy with the changes, click Push , which will create a new pull request. After a few seconds, you can click View Pull Request to access the pull request and merge it into the main request.

Example 2: Explaining the codebase

Next, use the Codex for a non-editing task: Explore the codebase and ask what you can do next. This is especially useful if you're new to a project, trying to get involved quickly, or just having trouble understanding how a certain feature works.

OpenAI Codex User Guide with 3 Real-World Examples Picture 17

The Codex has guided the project and provided a clear, beginner-friendly breakdown of the structure of the codebase. Instead of simply listing the files, the Codex has grouped them by purpose:

  1. It highlights that qwen3_demo.py is the main script, which initializes two Gradio-based interfaces - one for switching reasoning modes and one for multilingual translation.
  2. It identifies qwen3_demo.ipynb as an alternative to the interactive notebook.
  3. It points to test_qwen3_demo.py for unit testing and README.md for documentation and video tutorials.

Additionally, the Codex lists 'key points to know,' such as dependencies (the Ollama CLI), the role of the _run_ollama function, and tips for extending the interface. It even suggests next steps, such as exploring model versions, improving the UI, and adding error handling.

Example 3: Find and fix errors

Codex can scan your entire codebase, identify errors, suggest fixes, and show you previews of the changes. It's similar to reviewing code changes on GitHub.

OpenAI Codex User Guide with 3 Real-World Examples Picture 18

You can review the logs to understand the background process for the changes made by clicking Logs .

OpenAI Codex User Guide with 3 Real-World Examples Picture 19

Codex returns a summary of the changes made, along with the files created or affected by those changes. You can also ask questions about the changes or request that Codex write new code to improve the current implementation.

OpenAI Codex User Guide with 3 Real-World Examples Picture 20 OpenAI Codex User Guide with 3 Real-World Examples Picture 21

Once you are satisfied with the code fixes, click Push and Create New PR to open a new pull request.

OpenAI Codex User Guide with 3 Real-World Examples Picture 22

After a few seconds, you can click View Pull Request  to access the pull request and merge it into the main request.

OpenAI Codex User Guide with 3 Real-World Examples Picture 23

Codex helps merge changes with just a few clicks.

OpenAI Codex User Guide with 3 Real-World Examples Picture 24 OpenAI Codex User Guide with 3 Real-World Examples Picture 25

Main files are updated seamlessly on the repository.

OpenAI Codex User Guide with 3 Real-World Examples Picture 26

5 ★ | 1 Vote

May be interested