Skip to Content
Agents SetupCodex

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 openai key 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

macOS/Linux
curl -fsSL https://chatgpt.com/codex/install.sh | sh

For unattended installs:

macOS/Linux unattended
curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 sh

Windows standalone

Windows PowerShell
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"

npm

npm
npm install -g @openai/codex

Homebrew

Homebrew
brew install --cask codex

2. Create an OpenAI-type Accly key

In the Accly app:

  1. Open chat.accly.net .
  2. Open settings.
  3. Go to API Keys.
  4. Create a new key.
  5. Choose openai.
  6. 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:

Terminal
codex

On 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

macOS
open ~/.codex/config.toml

Linux

Linux
xdg-open ~/.codex/config.toml

If your desktop environment does not handle xdg-open, use a terminal editor:

Linux terminal editor
nano ~/.codex/config.toml

Windows

Windows PowerShell
notepad $env:USERPROFILE\.codex\config.toml

Codex 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:

~/.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:

Terminal
codex

Codex now uses your Accly key, the OpenAI-compatible provider format, the Accly Gateway base URL, and the configured model.

Verify the setup

  1. Key type is correctThe key you pasted into Codex was created in Accly with the openai key type.
  2. Provider format is OpenAIConfirm model_provider = "openai" is in ~/.codex/config.toml.
  3. Base URL is AcclyConfirm openai_base_url = "https://api.accly.net/v1" is in ~/.codex/config.toml.
  4. Usage appearsAfter a successful run, review API usage and limits in the Accly app.

Troubleshooting

SymptomCheck
config.toml is missingRun codex once, choose API key sign-in, and complete the first-run setup.
invalid_api_keyConfirm the key was copied correctly, is not revoked, and was created with the openai key type in Accly.
model_not_allowedChoose a model ID available to your plan, or switch to a plan with that model tier.
missing_modelAdd model = "gpt-5.5" to ~/.codex/config.toml, or choose another OpenAI model ID available in Accly.
Requests still use OpenAI directlyConfirm openai_base_url = "https://api.accly.net/v1" is in the user-level config.
No usage appears in AcclyRestart Codex after editing config.toml, then make a fresh request.