Codex Setup Guide
Install and configure Codex CLI, and connect to the Coding Flow platform via configuration files.
Codex is a CLI tool that supports OpenAI-compatible APIs and is configured via files. This guide walks you through installation and configuration.
Before you start, complete the Node.js installation guide.
Prerequisites
- A valid API Key (e.g.
sk-******) - An accessible service address (Base URL) (usually provided by your deployment/gateway)
Common service Endpoint for This Site
Step 1: Install Codex
Run the following command to download and install the latest version of Codex from the npm registry.
npm install -g @openai/codex@latestsudo npm install -g @openai/codex@latestsudo npm install -g @openai/codex@latestVerify installation
After installation, run the command below. If it prints a version number, the installation succeeded.
codex --versionStep 2: Create the configuration files
Codex uses configuration files for connection setup. You need to create two files: config.toml and auth.json.
Create the configuration directory
# Remove the old directory and create a new one
if (Test-Path "$env:USERPROFILE\.codex") { Remove-Item -Recurse -Force "$env:USERPROFILE\.codex" }
mkdir "$env:USERPROFILE\.codex"# Remove the old directory and create a new one
rm -rf ~/.codex && mkdir -p ~/.codex# Remove the old directory and create a new one
rm -rf ~/.codex && mkdir -p ~/.codexCreate the configuration files
# Create config.toml
@"
model_provider = "codingflow"
model = "gpt-5.4"
model_reasoning_effort = "high"
disable_response_storage = true
preferred_auth_method = "apikey"
[model_providers.codingflow]
name = "codingflow"
base_url = "https://api.codingflow.ai/v1"
wire_api = "responses"
requires_openai_auth = true
"@ | Out-File -FilePath "$env:USERPROFILE\.codex\config.toml" -Encoding utf8
# Create auth.json
@"
{
"OPENAI_API_KEY": "YOUR_API_KEY"
}
"@ | Out-File -FilePath "$env:USERPROFILE\.codex\auth.json" -Encoding utf8# Create config.toml
cat > ~/.codex/config.toml << 'EOF'
model_provider = "codingflow"
model = "gpt-5.4"
model_reasoning_effort = "high"
disable_response_storage = true
preferred_auth_method = "apikey"
[model_providers.codingflow]
name = "codingflow"
base_url = "https://api.codingflow.ai/v1"
wire_api = "responses"
requires_openai_auth = true
EOF
# Create auth.json
cat > ~/.codex/auth.json << 'EOF'
{
"OPENAI_API_KEY": "YOUR_API_KEY"
}
EOF# Create config.toml
cat > ~/.codex/config.toml << 'EOF'
model_provider = "codingflow"
model = "gpt-5.3-codex"
model_reasoning_effort = "high"
disable_response_storage = true
preferred_auth_method = "apikey"
[model_providers.codingflow]
name = "codingflow"
base_url = "https://api.codingflow.ai/v1"
wire_api = "responses"
requires_openai_auth = true
EOF
# Create auth.json
cat > ~/.codex/auth.json << 'EOF'
{
"OPENAI_API_KEY": "YOUR_API_KEY"
}
EOFImportant
Replace YOUR_API_KEY with the API Key you obtained from the Coding Flow platform.
Configuration parameters
config.toml: Configuration file that specifies the model provider, model name, reasoning effort, whether to disable response storage, and auth method.model_provider: Model provider name. Set it tocodingflow.model: Model name to use (e.g.gpt-5.4).model_reasoning_effort: Reasoning effort. Can behigh,medium, orlow.disable_response_storage:truedisables storing API responses (no history saved).preferred_auth_method: Auth method. Set it toapikey.[model_providers.codingflow]: Model provider configuration section.name: Provider name. Set it tocodingflow.base_url: Provider API base URL. Set it tohttps://api.codingflow.ai/v1.wire_api: API type to use.requires_openai_auth: Whether OpenAI auth is required.OPENAI_API_KEY: Authentication key. Set it toYOUR_API_KEY.
Step 3: Start using Codex
codexFAQ
Q: The encrypted content gAAA...uw== could not be verified. Reason: Encrypted content could not be decrypted or parsed
A: The encryption/decryption keys used during interaction are inconsistent. Try closing the current session, clearing the cache, and starting a new conversation.
Q: Do I need to run the setup script from a specific directory?
A: No. You can run it from any directory; it will use the correct configuration location automatically.
Q: Can I use the editor plugin and CLI at the same time?
A: Yes. They share the same configuration and do not interfere with each other.
Q: How do I configure it for remote development (SSH)?
A: Run the setup script on the remote server. VS Code Remote will automatically use the remote server’s configuration.
Q: What if it doesn’t work after setup?
A: Check the following:
- Whether the API Key was copied correctly (no extra spaces)
- Whether the Base URL is correct
- Whether the network can reach the Codex service
- Restart your editor/terminal and try again
Q: How do I update the API Key?
A: Re-run the setup script, or update it manually in your editor settings.
