Codex Setup
Use this guide to install Codex CLI and connect it to Accly Gateway with an Accly API key.
Codex should still use model_provider = "openai" in its config. That setting tells Codex which provider format to use; Accly is selected by changing the OpenAI-compatible base URL.
Requirements
- A paid Accly plan with Gateway API key access.
- An Accly API key with the
openaikey type. - A terminal on macOS, Linux, or Windows.
- A supported OpenAI model ID available to your Accly account.
1. Install Codex CLI
Choose one install option. These commands follow the official Codex CLI setup.
macOS/Linux standalone
curl -fsSL https://chatgpt.com/codex/install.sh | shFor unattended installs:
curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 shWindows standalone
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"npm
npm install -g @openai/codexHomebrew
brew install --cask codex2. Create an OpenAI-type Accly key
In the Accly app:
- Open chat.accly.net .
- Open settings.
- Go to API Keys.
- Create a new key.
- Choose
openai. - Copy the key immediately.
The full key is shown once. If you lose it, create a new key.
3. Start Codex and sign in with the key
Start Codex from a terminal:
codexOn first run, Codex prompts you to sign in. Choose the API key option for using an OpenAI API key, then paste the Accly key you created.
Do not export the key into your shell for this Codex setup. Let Codex complete the first-run sign-in flow and create its local Codex files.
4. Open config.toml
After the first successful Codex launch, open the user-level config file at ~/.codex/config.toml.
If the file does not exist yet, run codex once and complete the API key sign-in first.
macOS
open ~/.codex/config.tomlLinux
xdg-open ~/.codex/config.tomlIf your desktop environment does not handle xdg-open, use a terminal editor:
nano ~/.codex/config.tomlWindows
notepad $env:USERPROFILE\.codex\config.tomlCodex IDE extension
Open the Codex settings menu, then choose Codex Settings and Open config.toml.
5. Set Accly base URL and model
Add or update these settings in ~/.codex/config.toml:
model = "gpt-5.5"
model_provider = "openai"
openai_base_url = "https://api.accly.net/v1"model_provider = "openai" is correct here. It tells Codex to use OpenAI’s provider format, while openai_base_url routes those requests through Accly Gateway.
6. Restart Codex and use it
If Codex was open while you edited the config file, exit Codex and start it again from your project directory:
codexCodex now uses your Accly key, the OpenAI-compatible provider format, the Accly Gateway base URL, and the configured model.
Verify the setup
- Key type is correctThe key you pasted into Codex was created in Accly with the
openaikey type. - Provider format is OpenAIConfirm
model_provider = "openai"is in~/.codex/config.toml. - Base URL is AcclyConfirm
openai_base_url = "https://api.accly.net/v1"is in~/.codex/config.toml. - Usage appearsAfter a successful run, review API usage and limits in the Accly app.
Troubleshooting
| Symptom | Check |
|---|---|
config.toml is missing | Run codex once, choose API key sign-in, and complete the first-run setup. |
invalid_api_key | Confirm the key was copied correctly, is not revoked, and was created with the openai key type in Accly. |
model_not_allowed | Choose a model ID available to your plan, or switch to a plan with that model tier. |
missing_model | Add model = "gpt-5.5" to ~/.codex/config.toml, or choose another OpenAI model ID available in Accly. |
| Requests still use OpenAI directly | Confirm openai_base_url = "https://api.accly.net/v1" is in the user-level config. |
| No usage appears in Accly | Restart Codex after editing config.toml, then make a fresh request. |