Feature 02 / Codex CLI

Codex CLI with MonkeyAI: validate the API first, then apply the supported configuration.

Codex CLI setup usually fails for one of two reasons.

Professional wording: validate the API first, then use the config style your current Codex version actually supports.

Verify these three items before editing config

  1. The key and Base URL have already passed a direct API test.
  2. Your current Codex CLI version supports the provider / Base URL path you plan to use.
  3. You know whether you are using env vars or a config file.

Option A: environment variables

Use this for short-term validation in the current shell or project.

export OPENAI_API_KEY=sk-你的Key
export OPENAI_BASE_URL=https://monkeytheme.com/v1
export OPENAI_MODEL=gpt-4.1-mini

Option B: config-file workflow

This is better for longer-lived use.

Common Codex mistakes

  1. Mixing official OpenAI flow with a custom provider flow.
  2. Assuming another person’s CLI version supports the same fields as yours.
  3. Supplying only half of the Base URL a specific flow expects.
  4. Using a nickname instead of the real model name.