KozeKoze
โ† Back to Blog
Tutorial2026ๅนด3ๆœˆ23ๆ—ฅยท็ฎก็†ๅ‘˜

OpenAI Codex CLI Configuration Tutorial

OpenAI Codex CLI Configuration Tutorial

๐Ÿ“‹ Preparatory Steps

Before you begin, please ensure you have:

  • Registered a Koze account and logged in
  • Created an API Key on the API Management page
  • Installed the Codex CLI (npm install -g @openai/codex)

๐Ÿš€ Step 1: Configure the Codex Configuration File

Add the following configuration to the beginning of the ~/.codex/config.toml file:

model_provider = "koze"

model = "gpt-4.1"

model_reasoning_effort = "high"

disable_response_storage = true
preferred_auth_method = "apikey"

[model_providers.koze]

name = "koze"

base_url = "https://api.kozeai.com/v1"

wire_api = "responses"

requires_openai_auth = true

๐Ÿ’ก Tip: Replace `https://api.kozeai.com/v1` with your actual Koze proxy address. The `model` field can select different models according to your plan.

๐Ÿ”‘ Step Two: Configure the API Key

Configure your API key in the ~/.codex/auth.json file:

{

'OPENAI_API_KEY': 'Your Koze API Key'

}

๐ŸŽฏ Step Three: Start Codex

After configuration, start it directly in the terminal:

codex

Codex CLI will automatically use the Koze proxy for API requests.

๐Ÿ“Œ Available Models

You can use the following models in the `model` field of the configuration file (depending on your Koze plan):

Model Name Description
gpt-5.3-codex gpt-5.3-codex, suitable for everyday programming tasks
gpt-5.4-mini GPT-4.1 Mini, better value for money
gpt-5.4 GPT-5.4 Multimodal Model

โš ๏ธ Frequently Asked Questions

Problem Solution
Tip: "Authentication failed" Check if the API Key in auth.json is correct
config.toml is not working Ensure that the configuration is written at the beginning of the file and that the model_provider name matches [model_providers.xxx]
Using Nginx Anti-prototype fails. Add `underscores_in_headers on;` to the Nginx `http` block; otherwise, Nginx will discard request headers with underscores by default.

ย 

OpenAI Codex CLI Configuration Tutorial | Koze AI