Codex CLI Setup
Learn how to configure Codex CLI to use Aiberm’s API. This guide covers installation and configuration for Windows, macOS, and Linux.
What is Codex CLI?
Codex CLI is OpenAI’s command-line interface designed for code-related terminal tasks. It emphasizes engineering-ready output with clearer, actionable code changes compared to general chat tools. By configuring it to use Aiberm, you can access multiple AI models through a cost-effective endpoint.
Prerequisites
Before you begin, ensure you have:
- An Aiberm account (Sign up here)
- An Aiberm API key (Get your key)
- Node.js v20 or higher with npm
Installation
Install Codex CLI globally using npm:
npm install -g @openai/codex
Verify installation:
codex --version
This should display the version number.
Configuration
Codex CLI uses a config.toml file for configuration. The config directory location varies by operating system:
- Windows:
%userprofile%\.codex - macOS/Linux:
~/.codex
Method 1: Manual Configuration
Navigate to the config directory and create or edit config.toml:
macOS/Linux:
mkdir -p ~/.codex
nano ~/.codex/config.toml
Windows:
mkdir $env:USERPROFILE\.codex -Force
notepad $env:USERPROFILE\.codex\config.toml
Add the following configuration:
model = "gpt-5.6-sol"
model_provider = "aiberm"
model_reasoning_effort = "xhigh"
[model_providers.aiberm]
name = "Aiberm API"
base_url = "https://aiberm.com/v1"
experimental_bearer_token = "sk-your-aiberm-api-key"
wire_api = "responses"
supports_websockets = false
Important: Replace sk-your-aiberm-api-key with the real API key created in Aiberm Console. Do not leave the example placeholder unchanged.
The API key is stored as plain text in config.toml on this computer. Do not commit this file to Git, upload it publicly, or share it with anyone else.
Method 2: One-Command Configuration
macOS/Linux:
mkdir -p ~/.codex && cat > ~/.codex/config.toml << 'EOF'
model = "gpt-5.6-sol"
model_provider = "aiberm"
model_reasoning_effort = "xhigh"
[model_providers.aiberm]
name = "Aiberm API"
base_url = "https://aiberm.com/v1"
experimental_bearer_token = "sk-your-aiberm-api-key"
wire_api = "responses"
supports_websockets = false
EOF
Windows PowerShell:
$configPath = "$env:USERPROFILE\.codex"
New-Item -ItemType Directory -Force -Path $configPath | Out-Null
@"
model = "gpt-5.6-sol"
model_provider = "aiberm"
model_reasoning_effort = "xhigh"
[model_providers.aiberm]
name = "Aiberm API"
base_url = "https://aiberm.com/v1"
experimental_bearer_token = "sk-your-aiberm-api-key"
wire_api = "responses"
supports_websockets = false
"@ | Out-File -FilePath "$configPath\config.toml" -Encoding utf8
Before running either one-command setup, replace sk-your-aiberm-api-key in the command with your real API key. The generated configuration will not work if the placeholder is left unchanged.
Verify Configuration
Check Node.js installation:
node -v
npm -v
Verify Codex CLI installation:
codex --version
Test API connection:
codex "Hi"
If configured correctly, Codex CLI should respond using Aiberm’s API.
Troubleshooting
401 Unauthorized Error
- Verify your API key is correct: Console → API Keys
- Confirm
experimental_bearer_tokencontains the complete API key - Confirm the placeholder
sk-your-aiberm-api-keywas not saved unchanged - Restart Codex CLI after saving
config.toml
403 Forbidden Error
- Check your API key’s validity
- Verify your account balance at https://aiberm.com/console
- Ensure your API key has access to the requested model
Network Errors
- Verify your internet connection
- Check if you can access https://aiberm.com in your browser
- Ensure your firewall allows outbound HTTPS connections
- Confirm the
base_urlinconfig.tomlis correct:https://aiberm.com/v1
Configuration Not Taking Effect
- Restart your terminal after editing
config.toml - Validate TOML syntax formatting (no extra spaces, proper quotes)
- Make sure each setting is on its own line
- Check the config file location is correct for your operating system
- Ensure the file is saved as
config.toml(notconfig.toml.txt)
Codex Command Not Found
macOS/Linux:
# Check if npm global bin is in PATH
npm config get prefix
# If needed, add to PATH in ~/.zshrc or ~/.bashrc:
export PATH="$(npm config get prefix)/bin:$PATH"
Windows:
- Verify npm global path is in system PATH
- Restart terminal after npm installation