Codex one-line setup with a custom API provider
TL;DR: run curl -fsSL https://sh.flashapi.top/codex.sh | bash on macOS / Linux, or irm https://sh.flashapi.top/codex.ps1 | iex in Windows PowerShell, then pick 3.
One command installs the Codex CLI and points both the Codex CLI and the Codex desktop app at Flash API as a custom provider, with base_url, API key and model written for you. The default model is gpt-6.1-sol with medium reasoning effort.
1. Run the setup command
curl -fsSL https://sh.flashapi.top/codex.sh | bashirm https://sh.flashapi.top/codex.ps1 | iexThe script opens with a menu:
1Install the Codex CLI2Configure the Codex CLI / desktop app to use Flash API3Install everything (first time? pick this)
While configuring, it asks which client you use: CLI, desktop app, or press Enter for both. Then it asks you to pick an endpoint and paste an API key from a GPT pricing group, such as Codex-Enterprise (Codex-Enterprise) or Codex-GPT (Codex-GPT).
The prompts are in Chinese
The script's prompts are currently in Chinese. Pick 3 for a full install, press Enter at the client question to configure both, choose an endpoint (ai.flashapi.top for the lowest latency across Asia, cdn.flashapi.top for the global CDN), then paste your key.
2. Prerequisite: Node.js 22+
The Codex CLI is installed via npm (@openai/codex) and needs Node.js 22 or newer: Install Node.js. If the default npm registry fails, the script falls back to the npmmirror registry automatically. Only using the desktop app? You can skip the CLI and pick 2 to configure.
3. Files the script writes
Config directory: ~/.codex/ (%USERPROFILE%\.codex\ on Windows; if CODEX_HOME is set, that wins)
config.toml:
model_provider = "flashapi"
model = "gpt-6.1-sol"
review_model = "gpt-6.1-sol"
model_reasoning_effort = "medium"
# ...other base settings
[model_providers.flashapi]
name = "flashapi"
base_url = "https://ai.flashapi.top/v1"
wire_api = "responses"
requires_openai_auth = trueauth.json: gets your OPENAI_API_KEY.
- Anything else you've put in
config.toml(MCP servers, profiles and so on) is kept. - If
auth.jsonholds official ChatGPT login credentials, Codex prefers them and requests to Flash API fail with 401. So the script removes them (the original file is backed up). To switch back to the official login, rename the backup toauth.jsonor runcodex loginagain.
4. Verify
codex exec --skip-git-repo-check "Reply with exactly: OK"If you get OK back, you're live. Fully quit and reopen the desktop app.
5. FAQ
- 401 Unauthorized: make sure the key belongs to a GPT group, then rerun the script and pick
2to write the right key. - Change reasoning effort: use
/modelinside Codex, or editmodel_reasoning_effortinconfig.toml(low / medium / high / xhigh). - Roll back: rename
config.toml.bak.<timestamp>andauth.json.bak.<timestamp>back to their original names.