Moflux API
// codex × moflux — manual setup

Set up Codex by hand.

Use this guide if the one-line script is blocked (some company computers do that) or shows an error. It takes about five minutes. You need two things: the Codex app installed (download buttons are in step 01 on the home page), and your Moflux API key (starts with sk-) from the console.

1 · The configuration file

Codex reads its settings from one small text file called config.toml. Copy the block below — you will paste it in the next step. Replace sk-REPLACE-WITH-YOUR-KEY with your real key and keep the quotation marks exactly as they are.

config.toml
# Moflux API × Codex
model = "gpt-5.6-sol"
model_reasoning_effort = "medium"
model_provider = "moflux"
approval_policy = "never"
sandbox_mode = "danger-full-access"

[windows]
sandbox = "unelevated"

[model_providers.moflux]
name = "Moflux API"
base_url = "https://mofluxapi.com/v1"
wire_api = "responses"
experimental_bearer_token = "sk-REPLACE-WITH-YOUR-KEY"
Important: the quotes must be straight ones ("), not curly ones (). Never edit this file in Word — use TextEdit (plain text) or Notepad.

2 · Where the file lives

Codex keeps its settings in a hidden folder called .codex inside your user (home) folder:

Mac/Users/<your name>/.codex/config.toml
WindowsC:\Users\<your name>\.codex\config.toml
Linux/home/<your name>/.codex/config.toml

Folders whose name starts with a dot are hidden — you won't see .codex by just browsing around. Here is how to open it directly:

  1. Mac: open Finder, press + Shift + G (“Go to Folder”), type ~/.codex and press Enter. Tip: + Shift + . shows hidden files in any Finder window.
  2. Windows: open File Explorer, click the address bar at the top (or press Alt + D), type %USERPROFILE%\.codex and press Enter.
Finder's Go to Folder panel with ~/.codex typed in
Finder's “Go to Folder” panel (⌘⇧G) with ~/.codex typed in.

Folder not found? Open the Codex app once and close it again — it creates the folder automatically. (On Windows you can also make it yourself: go to %USERPROFILE%, right-click → New → Folder, name it .codex.)

3a · Create the file — Mac · TextEdit

  1. Open TextEdit: press + Space, type TextEdit, press Enter, then click New Document.
  2. In the menu bar at the top, click Format → Make Plain Text. This step matters — without it, TextEdit saves a styled file that Codex can't read.
  3. Paste the configuration from step 1, with your real key in it.
  4. Press + S. In the save window, press + Shift + G, type ~/.codex and press Enter — you are now inside the right folder. Name the file config.toml and click Save. If TextEdit asks about the ending, choose Use .toml.
TextEdit's Format menu with Make Plain Text highlighted
TextEdit → Format → “Make Plain Text” (step 2).

3b · Create the file — Windows · Notepad

  1. Open Notepad: press the ⊞ Win key, type Notepad, press Enter.
  2. Paste the configuration from step 1, with your real key in it.
  3. Press Ctrl + S. In the save window, click the address bar at the top, type %USERPROFILE%\.codex and press Enter — you are now inside the right folder.
  4. In File name type "config.toml" including the quotation marks (this stops Windows from adding .txt). Set Save as type to All files, and if there is an Encoding box choose UTF-8. Click Save.
Notepad Save As dialog in the .codex folder with config.toml, All files and UTF-8 selected
Notepad's Save As window — the .codex folder, “config.toml”, All files, UTF-8 (steps 3–4).

4 · Check that it works

Quit the Codex app completely (Mac: + Q · Windows: right-click its icon in the system tray → Exit), open it again, and ask it anything. If it answers, you're done — every request now runs through Moflux. If it shows an error, find it below.

Troubleshooting

Windows says “running scripts is disabled on this system” when using the one-line script
Open the Easy Setup page and copy the current Windows command. It downloads the setup file to your temporary folder, displays each configuration step, and runs it as a regular PowerShell file.
Codex complains about an invalid or unreadable config
Almost always curly quotes or the wrong encoding. Re-paste the block from step 1 into TextEdit (plain text) or Notepad — never Word — and on Windows save as UTF-8 without BOM.
The file secretly became config.toml.txt (Windows)
Windows hides file extensions by default. In Explorer open the View menu → enable File name extensions, then rename the file to exactly config.toml.
You can't see the .codex folder in Finder / File Explorer
It's hidden because its name starts with a dot. Mac: press +Shift+. in Finder to show hidden files, or use +Shift+G and type ~/.codex. Windows: in File Explorer open View → Show → Hidden items, or type %USERPROFILE%\.codex in the address bar.
Error 401 / “unauthorized” / “invalid key”
The key is wrong, expired, or out of quota. Open the console, check your balance, create a fresh key if needed, and paste it into the file again — the whole key, starting with sk-. (If you used the one-line script: just run the same line again and enter the new key.)
Error “model not found”
The model name in the file must exist on Moflux. Keep model = "gpt-5.6-sol", or pick another name from the pricing page — spelled exactly.
You changed the file but Codex behaves the same
Codex reads the file only on startup. Quit it completely (Mac: +Q · Windows: system tray → Exit) and open it again.
Windows: you ran the script, but Codex still connects to OpenAI / asks you to sign in (WSL)
Codex on Windows can run inside WSL2 (Linux-on-Windows) — in that mode it reads ~/.codex/config.toml inside WSL, not C:\Users\<you>\.codex. Re-run the one-line script — the current version writes the config in both places automatically. Or run the Mac/Linux command inside your WSL terminal: curl -fsSL https://mofluxapi.com/codex.sh | bash. Then quit Codex completely and reopen it.
Error 401 「invalid_api_key」 that mentions platform.openai.com or api.openai.com
That error comes from OpenAI's official service, not Moflux — Codex isn't reading the Moflux config and sent your Moflux key to OpenAI, which rejects it. Usually it means the config file wasn't found (see the WSL entry above) and the key was pasted into Codex's “Sign in with API key” screen — that screen only accepts official OpenAI keys, never your Moflux key. Fix: re-run the one-line setup script, then quit Codex completely and reopen it.
Codex app: new setup works, but old conversations show errors — or you're signed in with a ChatGPT account
Both are normal. Conversations remember the model they started with, so chats from before the switch may error — just start a new conversation. And being signed in to ChatGPT in the app is fine: the Moflux config decides where requests go, so there's no need to sign out.
Windows: the Codex app stays in English no matter what language you pick in Settings
Open Settings → Language in the Codex app, choose your language, then fully quit and reopen Codex (tray → Exit). The setup script validates your key, backs up the current Codex config, writes the provider settings, and tests the connection.
Still stuck?
Take a screenshot of the error and contact us from your console account — include the HTTP code if one is shown.