OpenAI Codex Installation

Configure OpenAI Codex in your development environment and use it through i7Relay relay service, supporting team intranet and self-hosted relay deployment.

What is OpenAI Codex

OpenAI Codex is an advanced code generation AI based on GPT models, specifically optimized for programming tasks. It can:

  • Generate code from natural language descriptions
  • Auto-complete code snippets
  • Explain and refactor existing code
  • Support multiple programming languages

Through i7Relay relay service, you can stably use OpenAI services in domestic network environments.

Install Node.js (Skip if already installed)

bash
# Ubuntu / Debian users
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo bash -
sudo apt-get install -y nodejs
node --version

# macOS users
sudo xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install node
node --version

Ensure Node.js version ≥ 18.0
Tip: If you have previously installed other local relay/proxy tools that occupy the same port, it may cause conflicts. It is recommended to disable or uninstall them before continuing.

Install Codex CLI

bash
npm i -g @openai/codex
codex -V

For the latest gpt-5.2 model, run:

bash
codex -m gpt-5.2

Configure Environment Variables

Starting from OpenAI Codex (v0.36.0), .env configuration will not be read by default. Make sure to use the env_key = "I7RELAY_KEY" configuration tutorial below

Add the following configuration in ~/.codex/config.toml file:

Regarding env_key = "I7RELAY_KEY" - this refers to the name of the environment variable, do not replace it with your personal center key. This only specifies using an environment variable named I7RELAY_KEY below
model_provider = "i7relay"
model = "gpt-5.2"
model_reasoning_effort = "high"
disable_response_storage = true
preferred_auth_method = "apikey"

[model_providers.i7relay]
name = "i7relay"
base_url = "https://i7dc.com/api"
wire_api = "responses"
requires_openai_auth = true
# This refers to the name of the environment variable, do not replace it with your personal center key. This only specifies using an environment variable named I7RELAY_KEY below
env_key = "I7RELAY_KEY"

Add the following configuration in ~/.codex/auth.json file:

{
    "OPENAI_API_KEY": null
}

Then configure environment variables

Must be configured or it won't work
export I7RELAY_KEY="your-personal-center-key"
Start using OpenAI Codex and let AI become your programming assistant! 🚀
Bring endless innovation and opportunities with AI
About
Features
Docs
Pricing
Contact us
Terms & Policies
Terms of Use
Privacy Policy
Specified Commercial Transactions Act