Endpoint: https://api.shopaikey.com
Codex CLI is OpenAI's official command-line tool (CLI) for pair programming, code refactoring, and debugging right in your terminal.
0. Automatic Setup (Recommended)
macOS / Linux
curl -fsSL https://cdn.shopaikey.com/codex/setup.sh | bash
Windows (PowerShell)
irm https://cdn.shopaikey.com/codex/setup.ps1 | iex
The script automatically installs Codex CLI (if not already installed), backs up old settings, and configures your API key.
1. Install Codex
:::tip We recommend using the automatic setup script in section 0 for quick configuration! :::
You can choose one of three ways to install Codex:
Codex CLI (Command Line Interface)
For the command-line version, run:
npm i -g @openai/codex@latest
Codex CLI Package: https://www.npmjs.com/package/@openai/codex
VS Code Extension
For VS Code, install the official extension:
https://marketplace.visualstudio.com/items?itemName=openai.chatgpt
Or search for codex directly in the VS Code Extension Marketplace.
Codex App (Desktop)
To use the desktop app, download from:
https://developers.openai.com/codex/quickstart?setup=app
2. Locate the Codex Configuration Directory
First, open Terminal (or Command Prompt on Windows).
Then run the command for your operating system to open the configuration directory:
Windows
In CMD:
start "" "%USERPROFILE%\.codex"
macOS / Linux
open "$HOME/.codex"
The .codex directory will open — this is where Codex configuration files are stored.
3. Create Configuration Files
Inside the .codex directory, create the following two files:
config.toml file
Create config.toml with the following content:
model_provider = "shopaikey"
model = "gpt-5.2"
model_reasoning_effort = "xhigh"
network_access = "enabled"
disable_response_storage = true
windows_wsl_setup_acknowledged = true
model_verbosity = "high"
[model_providers.shopaikey]
name = "shopaikey"
base_url = "https://api.shopaikey.com/v1"
wire_api = "responses"
requires_openai_auth = true
auth.json file
Create auth.json with the following content:
{
"OPENAI_API_KEY": ""
}
4. Enter Your API Key
In the auth.json file, enter your API key in the OPENAI_API_KEY field:
{
"OPENAI_API_KEY": "sk-your-api-key-here"
}
The API key can be obtained from your ShopAIKey dashboard.
Then save the file.
5. Launch and Test
Open a terminal and run:
codex
If configured successfully, you'll enter chat mode and can start using Codex.
Important Notes
:::warning CLI Usage Notes
- Do not switch models mid-session: After launching the CLI, avoid switching models within the same session.
- If you've switched models: Restart Codex with the following command to continue using the desired model:
codex -m gpt-5.3-codex -c model_reasoning_effort="xhigh"
:::
:::warning When does configuration take effect?
- Every time you edit
config.tomlorauth.json, you must restart Codex for the configuration to take effect. - How to restart: Press
Ctrl + Cto exit the current Codex session, then runcodexagain. - Applies to: VS Code Extension and Codex App also use the same configuration system. :::
6. Usage Guide
After configuration, you can start using Codex CLI.
Launch Interactive Mode
In your project directory, type:
codex
You'll enter the chat interface. You can ask:
"Explain this project's structure to me"
"Create a test file for the login function in src/auth.js"
Run Commands Directly (Single Shot)
Send a quick request without entering chat mode:
codex "Refactor utils.js to make the code cleaner"
Choose a Model
Codex CLI supports various models. Specify a model when launching:
codex --model gpt-5 "Explain the calculateTotal function"
View the full model list at Model Pricing.
Advanced Configuration (Optional)
Using Environment Variables
In addition to config files, you can use environment variables to configure Codex:
Linux / macOS
export OPENAI_BASE_URL="https://api.shopaikey.com/v1"
export OPENAI_API_KEY="sk-your-api-key-here"
Windows (PowerShell)
$env:OPENAI_BASE_URL = "https://api.shopaikey.com/v1"
$env:OPENAI_API_KEY = "sk-your-api-key-here"
Windows (CMD)
set OPENAI_BASE_URL=https://api.shopaikey.com/v1
set OPENAI_API_KEY=sk-your-api-key-here
Using a .env File
You can also create a .env file in the ~/.codex/ directory:
OPENAI_BASE_URL=https://api.shopaikey.com/v1
OPENAI_API_KEY=sk-your-api-key-here
Troubleshooting
Codex cannot connect
- Verify that
base_urlinconfig.tomlis exactlyhttps://api.shopaikey.com/v1 - Verify that the API Key in
auth.jsonis valid - Try restarting Codex after editing the configuration
"command not found" error
- Ensure Codex CLI is installed:
npm i -g @openai/codex@latest - Run
source ~/.zshrc(macOS/Linux) to reload environment variables
Model not working correctly
- Check that the model name in
config.tomlmatches the model you want to use - Restart Codex with a specific model parameter:
codex -m gpt-5.2 -c model_reasoning_effort="xhigh"