Skip to main content

Codex

Codex is an offering created by OpenAI that’s designed to understand and write computer code. Codex is included in ChatGPT Plus, Pro, Business, Edu, and Enterprise plans. Codex takes the usual ChatGPT coding functionality one step further by focusing on it more in depth with the use of environments. Instead of just translating what you say into code, it suggest fixes when your program has errors, understands context of programs and can push code changes to Github. This makes it feel like you have a smart coding partner that’s available 24/7.

Codex works across many programming languages, like Python, JavaScript, and more. If you’re new to a specific coding language, Codex can guide you through the generated output step by step, explaining what each piece of code does. It can also save you time by automating repetitive tasks or generating longer, more complex programs. Codex is accesible within ChatGPT so you can use natural language to ask coding questions and get ready-to-use answers.

Codex can be accessed by selecting the "Codex" option on the left side of a ChatGPT chat. Users can then describe a task that they want performed and Codex will complete that task.

Codex is very versatile and can be interacted with through the Codex interface in ChatGPT, a computer terminal, an IDE, or even through Github.

To begin using Codex, users must connect Codex to their Github profile. This can be done in a variety of ways. Selecting either highlighted button will initiate the process of signing into your Github profile.

Users will then see this screen and should select "Continue to GitHub".

Users will then be prompted to sign into their GitHub accounts. After which, users will be asked to "Authorize ChatGPT Codex Connector" and should do so.

At that point, GitHub and Codex should successfully be connected. @codex can be mentioned in pull requests to begin other tasks or answer questions.

Once Github and Codex are connected, users can specify what environment to run codex in. Environment is synonymous with repo. Environments can be added via the 'Settings' button in the top left corner of the codex screen.

Once in the settings, navigate to the "Environments" section on the left side of the page. From there, environments available in the enterprise can be seen as well as the button to "Create environment". Select that button to add your own Github repository as an environment. Once selected, specify what organization, repo, name and description you would like for the environment.

Warning
If you do not want your code visible to the entire enterprise, ensure that you change the "sharing" settings to "Only you" when creating a new environment. The default sharing method allows anyone across the CES ChatGPT tenant to view your code.

Code execution information can also be specified when creating environments. This includes information like container images, environment variables, setup scripts, etc.

Learn more about the different wats to interact with Codex
IDE
Terminal
Web Interface

When using Codex through an IDE (Visual Studio Code in this example) for your first time, you will be asked to install the Codex extension. Once you install Codex on your IDE, you will see the OpenAI logo on the left side of your VS Code window. Select the icon.

Once the icon has been selected, you will see an option to "Sign in with ChatGPT". Select that option and sign in with your username and password associated with your ChatGPT Edu account.

Once you are finished inputting your username and password, you will see the following screen. On this screen, select "Continue".

Once continuing, you will see the following screen and can now return to VS Code.

Once back in VS Code, you will see this screen and can select "Next".

The next few screens will give you a brief walkthrough of Codex within VS Code. Once you reach the following screen, you are ready to use Codex in VS Code.

At this point, Environment, mode, and reasoning level can be adjusted. Environment will determine what environment Codex runs in. Mode will determine how much autonomy Codex will have when completing your task (requiring approval to make individual edits to code, running commands in a given workspace, running commands outside of the workspace, etc). Reasoning level determines how much reasoning will occur before Codex gives an answer or produces/alters code.

Note
A "local" environment can be selected through the IDE if the user does not wish to attach the given code to any repository/environment.

When working with Codex from your terminal for the first time, navigate to OpenAI's Codex installation guide. Follow the instructions there, which will include installing the Codex CLI with your preferred package manager.

Once Codex is installed, type and run "codex" in your terminal to get started.

Instructions for Codex upgrades, as well as instructions on how to modify model and reasoning, can be found on OpenAI's developer platform.

Note
The web application is not the preferred method of using Codex for more complex and consistent development. Consider using an IDE if you will be generating more than a few snippets of code with Codex.

When first using the Codex web interface, you will need to select an environment where the code will run. An environment can be selected from the drop down menu next to the file selector icon.

An environment can also be selected by clicking on the "Settings" button in the top right corner of the screen.

The "Environments" tab on the left side of the page can then be selected, which will display options for environments as well as the option to create a new environment.