Skip to content

Connecting Codex CLI

Difficulty ⌨️ Intermediate (requires the command line / terminal) | API format OpenAI / Responses | base_url https://byesu.com/v1

Setup · fill these in
API addresshttps://byesu.com/v1
API keysk-xxxxxxxxCreate in console →
Modelgpt-5.5
API format OpenAI compatible · model names follow the console

Codex is OpenAI's official command-line coding assistant. By default it connects to OpenAI; all we need to do is point its custom base_url at byesu — an AI API gateway with OpenAI-compatible and Anthropic-native endpoints — and fill in your Key. One key covers Claude, GPT-5.6, Grok, Gemini and more, billed pay-as-you-go with no subscription.

Before you start

First go to Console → Tokens and create an API Key (see Quickstart for details). Replace every sk-xxxx below with your own Key.

Step 1: Install Codex

If you haven't installed it yet, pick either option:

bash
npm install -g @openai/codex
bash
brew install codex

Once installed, verify it:

bash
codex --version

Step 2: Configure (choose one)

We've already written the API address into the script — after running it, just paste your API Key (sk-xxxx) and it will automatically set up ~/.codex/config.toml and auth.json (including required fields like wire_api=responses and disable_response_storage, so you don't have to worry about them). Once configured, skip straight to Step 3.

powershell
iex (irm 'https://docs.byesu.com/setup/codex.ps1')
bash
curl -fsSL https://docs.byesu.com/setup/codex.sh | bash

Option 2: Manual configuration

Codex's configuration lives in the ~/.codex/ directory and needs two files.

~/.codex/config.toml — specifies the model and the endpoint:

toml
model = "gpt-5.5"                  # newest & strongest; or any model name from the console
model_provider = "byesu"
model_reasoning_effort = "high"    # thinking effort: minimal / low / medium / high
disable_response_storage = true    # ★ required for third-party gateways, otherwise it may error

[model_providers.byesu]
name = "byesu"
base_url = "https://byesu.com/v1"
wire_api = "responses"             # ★ must be responses — Codex uses /v1/responses

~/.codex/auth.json — stores your Key:

json
{
  "OPENAI_API_KEY": "sk-your-token"
}
🤔 Not sure how to create these two files? (click to expand)

Windows: In C:\Users\YourUsername\.codex\, use "Notepad" to create config.toml and auth.json separately (when using "Save As", set the file type to "All Files"; if there's no .codex folder, create one manually from the address bar).

macOS / Linux: In the terminal, run mkdir -p ~/.codex && open -e ~/.codex/config.toml (on Linux, replace open -e with nano); do the same for auth.json.

The four easiest things to get wrong

  1. wire_api must be responses (not chat), otherwise you'll get a 404 / wrong endpoint error.
  2. base_url ends with /v1 — don't add /responses on top of it.
  3. Don't forget disable_response_storage = true, otherwise connecting through the gateway may error.
  4. The field name in auth.json is exactly OPENAI_API_KEY (even though you're entering a byesu token).

Step 3: Run it and verify

Go into any project directory and start it:

bash
codex

Then ask it to do something small, like typing "list the files in the current directory". If it answers normally, you're connected ✅

Codex running normally

Tips

Adjusting the thinking effort

model_reasoning_effort controls how long the model "thinks":

  • minimal / low: fast and economical, good for simple changes
  • medium: the balanced default
  • high: complex refactors and hard problems — highest quality, but slower and more expensive

Switching models

Just edit the model line in config.toml and change it to any available model name from the console. If you want the version specially optimized for Codex, you can use gpt-5.3-codex-spark.

Stuck?

Check against Common Errors & Solutions to troubleshoot. The most common ones are:

  • 401 / invalid token → the Key in auth.json is wrong or in the wrong place (details)
  • Insufficient balance → top up in the console with USDT or Alipay (details)
  • No available channel → this model isn't in your group; switch to another model (details)

Got a problem? Contact support or join our group.