Thursday, December 3, 2026 | London 10°C · Drizzle
DailyGlimpse

AI

Step-by-Step Guide: Install OpenAI Codex CLI on Windows 11 in 2026

Nicholas Renotte 2 min read

This guide walks you through installing OpenAI's Codex Command Line Interface (CLI) on a Windows 11 machine. Codex CLI brings AI-powered code generation and assistance directly into your terminal, making it a powerful tool for developers, students, and AI enthusiasts.

Prerequisites

Before starting, ensure your system meets these requirements:

  • Windows 11 with the latest updates
  • Python 3.10 or higher installed
  • Git installed
  • OpenAI API key (or access to Codex)
  • Optional: Windows Terminal for a better experience

Step 1: Install Python and Git

If you don't have Python, download the latest version from the official website. During installation, check "Add Python to PATH." For Git, download and install from git-scm.com.

Step 2: Set Up a Virtual Environment (Recommended)

Open PowerShell or Command Prompt and run:

python -m venv codex-env
codex-env\Scripts\activate

Step 3: Install OpenAI CLI and Codex Package

With the virtual environment active, install the required packages:

pip install openai-cli openai

Step 4: Configure Your API Key

Set your OpenAI API key as an environment variable:

set OPENAI_API_KEY=your-api-key-here

To make it permanent, add it via System Properties > Environment Variables.

Step 5: Initialize Codex CLI

Run the initialization command:

codex init

Follow the prompts to configure your preferences. You can choose the model, output style, and more.

Step 6: Start Using Codex CLI

Now you can generate code by typing commands like:

codex "Write a Python function to reverse a string"

Codex will output the generated code in your terminal.

Troubleshooting Tips

  • If you get a "command not found" error, ensure Python and Git are in your PATH.
  • For API authentication issues, double-check your key and billing status.
  • Use codex --help to see all available commands and options.

Conclusion

With Codex CLI installed, you can supercharge your coding workflow. Experiment with different prompts and integrate it into your favorite editor or pipeline. For advanced usage, refer to OpenAI's official documentation.

This tutorial originally appeared as a YouTube video by ProgrammingKnowledge.

React