Codex
Set up OpenAI’s Codex CLI to use Modelway. You don’t need a ChatGPT account.
Get your Modelway key
Sign in, open API keys and click Create key. Copy it right away: it’s shown once. New to Modelway? Start with getting access.
Install Codex
Open a terminal and run OpenAI’s installer:
curl -fsSL https://chatgpt.com/codex/install.sh | sh
With npm, if you already have Node.js:
npm install -g @openai/codex
Open a new terminal and check it with codex --version.
Point it at Modelway
Codex reads ~/.codex/config.toml. Create the folder if it doesn’t exist yet, then open the file in an editor:
1mkdir -p ~/.codex2nano ~/.codex/config.toml
Paste this in, with your key in place of the placeholder:
1model = "claude-sonnet-5"2model_provider = "modelway"3model_reasoning_effort = "medium"4model_context_window = 100000056[model_providers.modelway]7name = "Modelway"8base_url = "https://modelway.vip/v1"9experimental_bearer_token = "<your Modelway API key>"10wire_api = "responses"
Already have a config? Keep model and model_provider above the first [section]. In TOML, anything below a section header belongs to that section.
Start Codex
Open a terminal in a project folder and run:
codex
Switch models with /model.
FAQ
Codex asks me to sign in with ChatGPT.
It isn’t using the Modelway provider. Check that model_provider = "query" is at the top of ~/.codex/config.toml, above any section.
How do I update?
Run the install command again. With Homebrew, use brew upgrade --cask codex; with npm, npm install -g @openai/codex@latest.
How do I go back to my ChatGPT account?
Remove model_provider and the [model_providers.modelway] section from ~/.codex/config.toml, then run codex and sign in.