Skip to content

OpenAI Codex Setup

OpenAI Codex CLI is OpenAI’s command-line coding agent. Because KeyMaker is OpenAI-compatible, you can point Codex at KeyMaker and run it against campusGenAI’s models — billed to your sponsor’s funding — instead of a personal OpenAI account.

  • Terminal access (macOS, Linux, or Windows PowerShell)
  • A valid KeyMaker API key from your sponsor — see Getting Started

You can check whether Codex is already installed:

Terminal window
codex --version

If you see a version number, skip to Save your API key.

macOS or Linux:

Terminal window
curl -fsSL https://chatgpt.com/codex/install.sh | sh

When prompted Start Codex now?, press y.

Windows (PowerShell):

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

Then verify the installation on either platform:

Terminal window
codex --version

If you see a version number, the installation was successful.

Store your KeyMaker key as an environment variable rather than putting it directly in a config file.

macOS / Linux:

Terminal window
echo 'export KEYMAKER_API_KEY="YOUR_KEY_HERE"' >> ~/.zshrc && source ~/.zshrc

Confirm it was saved:

Terminal window
echo $KEYMAKER_API_KEY

Windows (PowerShell):

Terminal window
[Environment]::SetEnvironmentVariable("KEYMAKER_API_KEY", "YOUR_KEY_HERE", "User")

Restart PowerShell, then verify:

Terminal window
echo $env:KEYMAKER_API_KEY

List the models your KeyMaker account can use:

Terminal window
curl https://thekeymaker.umass.edu/v1/models \
-H "Authorization: Bearer $KEYMAKER_API_KEY"

Make note of the model name you want to use (for example, gpt5).

  1. Create the Codex configuration directory:

    Terminal window
    mkdir -p ~/.codex
  2. Open (or create) the configuration file:

    Terminal window
    nano ~/.codex/config.toml
  3. Add the following configuration, then save. Replace gpt5 with any model from your available list if your team uses a different one:

    model_provider = "keymaker"
    model = "gpt5"
    model_reasoning_effort = "high"
    [model_providers.keymaker]
    name = "Keymaker"
    base_url = "https://thekeymaker.umass.edu/v1"
    env_key = "KEYMAKER_API_KEY"
    wire_api = "responses"

    In nano, save with Ctrl + O then Enter, and exit with Ctrl + X. (The same shortcuts work on macOS, Linux, and Windows via WSL/Git Bash.)

  4. Confirm the file was saved:

    Terminal window
    cat ~/.codex/config.toml

Start Codex:

Terminal window
codex

Then enter a prompt to confirm it’s routing through KeyMaker:

Say hello and tell me which model provider I am using.

If Codex responds successfully, your configuration is working — all Codex requests now route through KeyMaker, using the models, permissions, and usage controls of the KeyMaker platform.

If you’ve previously logged into Codex with a ChatGPT or OpenAI account, log out so Codex uses the KeyMaker provider:

Terminal window
codex logout

If Codex still uses your old configuration after that, remove the config directory and reinstall:

Terminal window
rm -rf ~/.codex

Then reinstall Codex and repeat the setup from Install Codex CLI.

Authentication errors Confirm your key is available with echo $KEYMAKER_API_KEY, then test it directly:

Terminal window
curl https://thekeymaker.umass.edu/v1/models \
-H "Authorization: Bearer $KEYMAKER_API_KEY"

If that fails, verify the key is correct, hasn’t expired or been revoked, and re-copy it from the KeyMaker portal if needed.

Model not found List the models available to your account (the curl command above) and update the model value in ~/.codex/config.toml to match.

Codex still uses OpenAI Run codex logout, restart your terminal, and try again. If it persists, rm -rf ~/.codex, reinstall Codex, and repeat the setup.

Configuration file not found Create the directory and file manually: mkdir -p ~/.codex then nano ~/.codex/config.toml.


Your interface may look slightly different depending on your institution’s deployment.