Codex Complete Tutorial: From Registration and Installation to Hands-On Practice
Codex Complete Tutorial: From Registra…
A complete beginner's guide to OpenAI Codex covering setup, configuration, and real-world coding projects.
This comprehensive tutorial walks you through everything needed to get started with OpenAI's Codex AI programming agent—from registering a ChatGPT account and installing the desktop app, to configuring the sandbox environment, managing workspaces, and leveraging advanced features like Skills and MCP. Includes practical examples such as generating a Snake game and debugging Spring MVC projects.
Why Choose Codex: Core Advantages and Cost Analysis
In today's flourishing landscape of AI programming tools, OpenAI's Codex and Anthropic's Claude Code have become the first-tier AI agent tools. They're not simple large model chat tools, but genuine AI programming assistants that can execute tasks, modify code, and manipulate files for you.
AI Coding Agents are fundamentally different from traditional code completion tools. Traditional tools like early GitHub Copilot primarily predicted the next line of code based on context, while agents possess autonomous planning, execution, and feedback loop capabilities. They can understand high-level task descriptions, automatically break them down into multiple sub-steps, and sequentially execute file creation, code writing, dependency installation, error fixing, and other operations. This capability stems from the "Tool Use/Function Calling" mechanism of large language models—the model not only generates text but can also invoke predefined functions to manipulate the file system, run terminal commands, access the network, and more.
This article walks through Codex from scratch—downloading, installation, environment configuration, core features, and project practice. Even if you have zero programming experience, you can follow along step by step.
Codex vs. Claude Code
After comparing Codex, Claude Code, and Cursor in actual use, Codex currently offers the best overall experience. The main reasons include:
- Powerful underlying model: Powered by GPT 5.5, with superior Chinese language comprehension
- Outstanding requirements analysis: More precise decomposition of complex project requirements
- Full-stack development capability: Handles both frontend and backend, with better visual quality in generated frontend pages
- Rich MCP ecosystem: More third-party tool integration options
- Standalone desktop application: More convenient user experience
GPT 5.5 is OpenAI's latest-generation foundation model released in 2025, with significant improvements over GPT-4o in reasoning depth, long-context understanding, and multilingual capabilities. Its improved Chinese comprehension benefits from a substantially increased proportion of Chinese corpus in training data, as well as the introduction of more Chinese annotators' preference data during the RLHF (Reinforcement Learning from Human Feedback) phase. In code generation, GPT 5.5 achieves over 90% pass rates on benchmarks like HumanEval and MBPP, performing particularly well on complex tasks requiring cross-file understanding and architecture design.
Cost Comparison
The Claude model paired with Claude Code is relatively expensive, leading many users to settle for configuring domestic models like DeepSeek, which compromises the experience. Codex paired with GPT costs approximately 80-90 RMB per month with a Turkey-region account (about 160-200 RMB for US region), offering better value for money.
Complete ChatGPT Account Registration Process
Using Codex requires a ChatGPT account, which is the first hurdle that blocks many people.
Pre-Registration Preparation
- VPN access: This is a necessary prerequisite
- Prepare an email: Gmail, NetEase, or any email will work
- SMS verification platform account: For receiving phone verification codes
Registration Steps in Detail
- Visit the ChatGPT registration page, enter your email and set a password
- Log into your email to get the verification code and complete email verification
- For phone number verification, use an SMS verification platform: select the OpenAI service, choose an available foreign number, top up and get a virtual number
- Enter the virtual number on the registration page, send the verification code, then check and copy it from the SMS platform
Mobile Configuration (iPhone Example)
The final step of ChatGPT registration requires mobile authorization, so you must install the ChatGPT App on your phone:
- Register a US or Turkey-region Apple ID
- Switch the Apple ID's country/region to the United States
- Use a "US address generator" for the home address
- After switching, search and download ChatGPT from the App Store (requires iOS 16.1 or above)
- VPN access is also needed on mobile
Subscription Payment Method
GPT payment can only be completed on mobile: first add funds to your US-region Apple ID's App Store balance, then subscribe within the ChatGPT App. The $20/month plan is sufficient for individual users' daily needs, and the $8 free tier is adequate for learning purposes.
Codex Installation and Sandbox Environment Configuration
Codex Installation Process
Codex is not a traditional installer package—it's downloaded from the Microsoft Store. After installation, you'll see a "Welcome to Codex" prompt. Click "Continue with ChatGPT" and log in with your previously registered email.
Sandbox Environment Configuration (Critical Step)
After entering Codex for the first time, the most important step is setting up the sandbox environment (Setup). The sandbox is Codex's core security mechanism:
- Isolation: Completely separates Codex's workspace from other system files
- Security: Prevents AI from accidentally deleting system files or affecting other programs
- Permission control: AI can only access folders you authorize and perform operations you allow
- Recoverable from errors: If the sandbox has issues, simply clear and rebuild it without affecting the system
A Sandbox is an OS-level isolation technology originating from computer security. Codex's sandbox is implemented using containerization technology, similar to how Docker containers work: it creates an independent virtual file system and process space for the AI, and all operations within it (file read/write, command execution, network access) are confined to this isolated environment. Even if the AI executes a dangerous command like "rm -rf /", it only affects the sandbox interior without touching the host system. This design borrows from the browser sandbox concept—each tab in Chrome runs in an independent sandbox, so one page crashing doesn't affect others.
Click the Setup button and follow the prompts to complete configuration.
Workspace Creation and Multi-Task Management
Codex supports multiple projects running in parallel, with each task running independently without interference—this is one of its standout features.
Steps to Create a Workspace
- Create a directory on your local disk (e.g.,
D:\CodeX) - Create subfolders for each project under that directory
- Drag folders into Codex, or add them via "Use existing folder"
Three Permission Modes
Codex offers three permission modes—choose based on your needs and risk tolerance:
| Mode | Description | Use Case |
|---|---|---|
| Request Approval | Every external operation requires your confirmation | Beginners or sensitive projects, safest |
| Approve for Me | Low-risk operations execute automatically, high-risk still requires confirmation | Daily development, balancing efficiency and security |
| Full Access | AI has full autonomy | Test projects, most efficient but risky |
Hands-On Demo: Project Generation and Debugging
Quickly Generate a Demo Project
Type "Help me generate an HTML Snake game project," and Codex will automatically write the complete code. After generation, there are two preview methods:
- Find the HTML file in your local folder and open it in a browser
- Use the hidden sidebar browser plugin on the right side of Codex for direct preview
Annotation and Modification Feature
Not satisfied with the generated result? Codex supports adding annotations: directly mark the positions that need modification on the page, describe your requirements in natural language, and the AI modifies immediately. No need for screenshots—what you see is what you change, very intuitive.
Import Existing Projects for Debugging
This is the most common scenario in actual work:
- Add your local project folder to the Codex workspace
- Write clear prompts describing the problem
- AI analyzes and provides solutions
Real Case: A Spring MVC project was throwing errors—the code logic was completely correct but wouldn't run. Codex directly identified a version incompatibility issue and provided specific solutions such as downgrading the Spring MVC version.
Spring MVC version incompatibility is an extremely common issue in Java development. Spring framework version iterations involve numerous API changes. For example, upgrading from Spring 5.x to 6.x requires the minimum Java version to increase from 8 to 17, while the Jakarta EE namespace changes from javax.* to jakarta.*. This means if a project uses newer Spring Boot 3.x (with built-in Spring 6), but some third-party dependencies are still written based on the javax namespace, ClassNotFoundException and other runtime errors will occur. These issues are time-consuming for human developers to troubleshoot because error messages often point to framework internals rather than business code, but AI tools can quickly identify such patterns thanks to learning from vast numbers of open-source project issues and Stack Overflow discussions.
Prompt Tips: The clearer your description, the more precise the AI's response. Be sure to specify what IDE you're using, what version, what port, and what specific error you're getting. Vague descriptions only yield vague answers.
Advanced Features: Skills and MCP Explained
Skills: Encapsulated Reusable AI Capabilities
Skills are organized and encapsulated native capabilities of the large model, stored in Markdown files, and can be reused to execute fixed tasks. Essentially, Skills are similar to a combination of "system prompt templates + execution workflows"—they tell the AI through predefined Markdown documents how to think in specific scenarios, what tools to use, and what steps to follow. This aligns with the concept of "function encapsulation" in traditional programming: abstracting repetitive work into reusable modules.
Steps to Install a Third-Party Skill (PPT Generation Example):
- Download the Skill's zip package from GitHub and extract it
- Create a
.codex/skills/directory structure under your project directory - Place the extracted files into the skills directory
- Add the project in Codex, and you can invoke the Skill
When generating PPTs, more detailed prompts yield better results: specify the number of pages, style, color scheme, content structure per page, etc. The default output is a web-based PPT, but you can also request .pptx format files.
MCP (Model Context Protocol): Connecting External Tools
MCP is an external tool protocol that extends Codex's capabilities. When the large model itself isn't good at something (like real-time map route queries), you need to connect third-party services through MCP.
MCP (Model Context Protocol) is a standardized protocol proposed and open-sourced by Anthropic in late 2024, designed to solve the connection problem between large language models and external tools and data sources. Before MCP, every AI tool needed to develop separate integration interfaces for each external service, resulting in N×M complexity. MCP reduces this complexity to N+M by defining unified communication standards—tool providers only need to implement an MCP server once, and AI applications only need to implement an MCP client once. The protocol is based on JSON-RPC 2.0 and supports three core primitives: Resources (such as files and data), Tools (such as API calls), and Prompts (prompt templates). MCP has now been adopted by major AI vendors including OpenAI and Google, becoming the de facto industry standard.
Steps to Configure Amap (Gaode Maps) MCP:
- Find the Amap MCP on mcp.so
- Register on the Amap Open Platform (lbs.amap.com) and apply for an API Key
- Add the MCP server in Codex settings, filling in the command, parameters, and API Key
- When using, enter a prompt like "Help me use the AMAP-MAPS MCP to generate a public transit route from Wangjing West to Beijing South Railway Station"
Core Differences Between Skills and MCP
- Skills: Organize the large model's native capabilities, pure AI logic, suitable for internal tasks like fixed copywriting generation and data processing
- MCP: Connect external tools and services, suitable for real-time data queries, third-party API calls, and other scenarios where the large model itself falls short
- The two can be combined: Skills can also encapsulate MCP capabilities internally
Summary: The Right Way to Use AI Programming Tools
Although AI programming tools like Codex are extremely powerful, they cannot completely replace developers. For simple demo-level projects, you can get by without knowing code; but for complex project deployment, database operations, bug localization, and other scenarios, you still need basic technical knowledge to effectively "direct" the AI.
The current relationship between AI tools and programmers is collaboration, not replacement. Mastering tools like Codex is essentially about closing the information gap—the technology itself isn't difficult; what's hard is knowing it exists and putting it into practice.
Key Takeaways
Related articles
Google CEO Pichai Admits AI Coding Gap…
Google CEO Pichai Admits AI Coding Gap, Details Catch-Up Strategy and AGI Outlook
Google CEO Sundar Pichai admits Google lags in AI coding, details its catch-up strategy involving data flywheels, addresses Gemini controversies, and shares his evolving views on AGI.
Google CEO Admits Gemini Lags in Codin…
Google CEO Admits Gemini Lags in Coding: Lacking an Entry Point Is Just the Surface — What's the Real Problem?
Google CEO Pichai admits Gemini lags behind Cursor and Claude Code in AI coding, blaming lack of product entry points. But the real issues are failed product experience, lost developer trust, and ecosystem advantages that haven't converted to competitiveness.
Sonar Tests Code Quality Across 53 LLM…
Sonar Tests Code Quality Across 53 LLMs: Claude Has the Most Security Vulnerabilities, GPT-5 Code Volume Surges 5x
Sonar evaluates 53+ LLMs on 4,444 Java tasks: Claude has the highest security vulnerability density at 300/million lines, GPT-5 code volume surges 5x to 1.2M lines. Deep analysis of real-world code quality.