Codex Web
Codex Web is the cloud version that allows you to access Codex from any device and run tasks in an isolated environment.
* * *
## Accessing Codex Web
Access the cloud Codex:
https://chatgpt.com/codex
### Prerequisites
* ChatGPT Plus / Pro / Business / Enterprise plan
* Or use OpenAI API Key
> When using an API Key, some cloud features may not be available.
* * *
## Cloud Environments
Environment is a core concept of Codex Web β each environment is an isolated workspace.
### Creating an Environment
1. Connect your GitHub account
2. Select a repository
3. Configure setup script and environment variables
4. Choose network access policy
### Task Execution Flow
Cloud tasks are executed following this flow:
1. Create container, clone repository to selected branch
2. Run setup script to install dependencies
3. Apply network access settings
4. Agent executes task (editing code, running commands, validating results)
5. Display results and file changes
* * *
## Default Image
The cloud uses a default container image named `universal`:
* Pre-installed common languages: Python, Node.js, Go, Rust
* Includes common tools: npm, pip, cargo, git
* Can pin runtime versions
### Version Pinning
## Pinning Versions
# Environment Setup
# Pin Python version
python_version = "3.11"
# Pin Node.js version
node_version = "20"
* * *
## Setup Script
The setup script runs automatically when the container is created:
### Auto Detection
Codex automatically detects project type and runs corresponding installation:
* Node.js: Automatically runs npm install / yarn / pnpm
* Python: Automatically runs pip install / poetry install
### Manual Script
## Custom Setup Script
# Setup Script
# Configured in environment settings
npm install
npm run build
pip install -r requirements.txt
### Maintenance Script
The maintenance script runs when a cached container starts up:
* Used for updating dependencies or rebuilding
* Faster than full setup
> The setup script and Agent run in different Bash sessions; export commands won't persist.
* * *
## Environment Variables and Secrets
### Environment Variables
Environment variables are available throughout the task:
## Setting Environment Variables
# Environment Variables
NODE_ENV=production
DEBUG=false
API_ENDPOINT=https://api.example.com
### Secrets
Secrets are used to store sensitive information:
* Extra encrypted storage
* Decrypted only during task execution
* Only available in setup scripts
* Automatically removed in Agent phase
| Type | Visibility Scope | Purpose |
| --- | --- | --- |
| **Environment Variables** | Setup script + Agent | General configuration |
| **Secrets** | Setup script only | API Keys, passwords |
* * *
## Network Access Control
Network access in cloud environments is restricted by default:
### Default Settings
| Phase | Network Access |
| --- | --- |
| **Setup Script** | Allowed (needed for installing dependencies) |
| **Agent** | Blocked (default) |
### Agent Network Access Options
| Setting | Description |
| --- | --- |
| **Off** | Completely block network access |
| **On** | Allow network access (can restrict domains) |
### Domain Whitelist
## Domain Configuration
# Network Configuration
# Preset whitelist
domain_allowlist = "common-dependencies"
# Includes: github.com, npmjs.com, pypi.org, etc.
# Custom Domains
domain_allowlist = [
"github.com",
"api.mycompany.com"
]
# Restrict HTTP Methods
allowed_methods = ["GET", "HEAD", "OPTIONS"]
### Security Risks
Enabling Agent network access increases risks:
* Prompt injection (getting instructions from malicious websites)
* Data leakage (sending code or keys externally)
* Downloading malicious dependencies
> Enable Agent network access only when necessary and use domain whitelisting.
* * *
## Container Caching
Cloud caches container states to accelerate subsequent tasks:
* Cache lasts up to 12 hours
* Automatically invalidated when setup script or environment variables change
* New tasks start faster
* * *
## Cloud Task Management
### Creating Tasks
1. Select environment
2. Enter task description
3. Choose model and configuration
4. Start task
### Task Monitoring
* View progress in real time
* See file changes
* Check command output
### Result Handling
* View diffs of changes
* Create Pull Request
* Download changed files
* * *
## Parallel Tasks
Cloud supports running multiple tasks in parallel:
* Handle different features simultaneously
* Multiple environments work independently
* Improve overall efficiency
> Avoid having multiple tasks modify the same file at once, which could cause conflicts.
* * *
## Common Questions
### Q: What's the difference between Cloud and local?
Cloud runs on remote servers, suitable for parallel tasks and remote access; local directly operates on your files.
### Q: How is it billed?
Cloud tasks consume credits, with costs calculated based on model and usage.
### Q: Can I access local files?
Cloud cannot access local files, but can synchronize via Git.
### Q: When do I need network access?
Only needed when the Agent requires real-time data or external APIs; setup scripts are usually sufficient.
YouTip