APIMaster.ai

OpenAI Codex CLI — API Key Setup & Configuration

How to configure OpenAI Codex CLI (and Codex Desktop) with an API key from APIMaster.ai. Set model_provider, base_url, and OPENAI_API_KEY on Windows and macOS to use GPT-5.4 at up to 70% off.

Codex setup

Prerequisites: Environment check, API key.

Codex uses https://apimaster.ai/v1 (OpenAI-compatible).

These files also configure Codex Desktop — same ~/.codex directory.


Before you edit — back up, then replace

If Codex is already installed, ~/.codex/ may already contain config.toml and auth.json (official subscription login or another provider).

  1. Quit Codex Desktop if it is running.
  2. Back up the originals before changing anything:
    • Windows (in %userprofile%\.codex):
      copy config.toml config.toml.bak
      copy auth.json auth.json.bak
    • macOS / Linux (in ~/.codex):
      cp config.toml config.toml.bak
      cp auth.json auth.json.bak
  3. Overwrite each file with the full contents below — save and replace the entire file. Do not append APIMaster settings to your existing config.toml or merge blocks by hand; leftover model_provider / [model_providers.*] entries often cause 401, 404, or requests going to the wrong endpoint.

If a file does not exist yet, create it and paste the snippet as-is.


Windows

Win + R%userprofile%\.codex

Create the folder if missing. If config.toml or auth.json already exist, back them up first (see above), then replace the entire file with:

config.toml

disable_response_storage = true
model = "gpt-5.4"
model_provider = "apimaster"
model_reasoning_effort = "high"
model_verbosity = "high"

[features]
web_search_request = true

[model_providers.apimaster]
base_url = "https://apimaster.ai/v1"
name = "apimaster"
requires_openai_auth = true
wire_api = "responses"

auth.json

{
  "OPENAI_API_KEY": "YOUR_API_KEY"
}

Test: codex


macOS

~/.codex — back up existing files if present, then replace the entire file with the macOS config.toml example below:

model_provider = "apimaster"
model = "gpt-5.4"
model_reasoning_effort = "high"
network_access = "enabled"
disable_response_storage = true
model_verbosity = "high"

[model_providers.apimaster]
name = "apimaster"
base_url = "https://apimaster.ai/v1"
wire_api = "responses"
requires_openai_auth = true

auth.json as above. Test: codex


Notes

  • Set model to gpt-5.5 etc. per Supported models.
  • If wire_api = "responses" fails on your Codex version, try wire_api = "chat" or remove the line.
Issue Fix
401 auth.json key
404 Model id + account access
Timeout base_url must be exactly https://apimaster.ai/v1