Codex
Recommended configuration order:
- Edit the config file directly (preferred): write
~/.codex/config.toml— see the Manual Config section below - Environment variable: export
OPENAI_API_KEYin the current shell — see the API Key section - cc-switch tool (fallback):
https://github.com/farion1231/cc-switch/releases— it modifies the same official config and environment variables
Prerequisites
Codex CLI is installed through npm, so prepare these first:
Node.jsnpm(normally included with Node.js)
Use the official Node.js download page: https://nodejs.org/en/download
- macOS / Windows: download and install the
LTSrelease from that page - Linux: use the distro-specific method or binary package linked from the same page
On macOS, if you already use Homebrew, you can also run:
brew install nodeThis installs both Node.js and npm.
After installation, npm is usually available automatically. Then verify:
node -v
npm -vOnce npm is available, install Codex.
Install
npm i -g @openai/codexAPI Key
When Codex uses API key auth mode, it usually stores the local credential in ~/.codex/auth.json.
If you only want to inspect the local file, use this as reference:
{
"auth_mode": "apikey",
"OPENAI_API_KEY": "codex_your_api_key"
}OPENAI_API_KEY is your codex_... or sk-... key. In most cases auth.json does not need manual editing; it is mainly useful to verify that Codex is using apikey mode locally.
For a temporary shell-only test, you can also export:
export OPENAI_API_KEY="codex_your_api_key"Manual Config Reference
Check ~/.codex/config.toml:
model_provider = "custom"
model = "gpt-5.4"
disable_response_storage = true
model_reasoning_effort = "high"
[model_providers]
[model_providers.custom]
name = "custom"
base_url = "https://api.gemiaude.com/v1"
requires_openai_auth = true
wire_api = "responses"
[notice.model_migrations]
"gpt-5.2-codex" = "gpt-5.4"Use a root endpoint such as https://api.gemiaude.com/v1 in base_url, not the full /v1/responses path.
This setup uses Codex API key auth with a custom model provider and the responses wire API. The API key comes from ~/.codex/auth.json or the current shell's OPENAI_API_KEY.
Verify
codexIf Codex starts normally and resolves the model to gpt-5.4, the setup is working.
VS Code Extension
As of March 31, 2026, OpenAI officially provides a Codex IDE extension for VS Code and states that it is compatible with most VS Code forks.
If you want to use Codex inside VS Code:
- Install the official
Codexextension from the VS Code marketplace. - Open VS Code settings and search for
Codexto find extension-specific UI settings. - The settings that actually control model choice, approvals, and sandbox behavior still live in the shared
~/.codex/config.toml.
For this gateway, the VS Code extension does not need a separate custom config path. Reuse the same ~/.codex/config.toml and API key setup shown above. Opening the extension sidebar and starting a session successfully confirms that the shared config is active.
