Turn Reconnecting into ● connected
From install and login to editing config.toml — and the bug everyone hits, the endless reconnect loop. Every newcomer trap, explained, with commands you can copy.
Find your answer by problem
The 8 things newcomers search for most — each walks from "why this happens" to "how to fix it, step by step."
Install Codex CLI
npm / official script / Homebrew, Node version requirements, and the wrong-package mistake everyone makes.
Read guide → ▸02 · USAGELogin & first run
ChatGPT login vs API key, your first prompt, approval and sandbox modes, and AGENTS.md memory.
Read guide → ⚙03 · CONFIGConfigure config.toml
Model, provider, third-party API endpoints, context window — every core key with a full example.
Read guide → ↻04 · TOP ISSUEStuck on Reconnecting
Work through the reconnect loop: proxy, socks5, auth conflicts, the VS Code extension, WSL2 and bugs.
Troubleshoot → ⚑05 · PROXYProxy & restricted networks
Why a proxy is required behind firewalls, how to set it in the terminal vs VS Code, and faster npm mirrors.
See setup → ⚠06 · ERRORSCommon errors
401 auth failures, 429 rate limits, port 1455 in use, headless login — a quick lookup table.
Look it up → ⌘07 · COMMANDSCommands & slash commands
codex / exec flags, /model, /approvals, /init and the permission & sandbox modes explained.
Read guide → ⚖08 · COMPAREvs Claude Code
2026 pricing, context windows, SWE-bench scores and which tool fits which job — and how to run both.
See comparison →What is Codex CLI?
Core features, how it differs from ChatGPT, and real-world use cases.
Pricing & Costs
Free tier, API billing details, and money-saving tips explained.
Codex vs Cursor
Deep comparison of both AI coding tools — find your best fit.
Search your exact error
Paste the raw terminal error + "codex" into a search engine, then come back to the errors table.
Why does Codex keep Reconnecting?
Eight times out of ten Codex isn't broken — it simply can't reach OpenAI. Reconnect failures usually come from one of these, in priority order:
- No / wrong proxy: behind a firewall you must set
HTTPS_PROXY. - socks5 proxy: Codex doesn't read socks5 — convert it to http.
- OAuth vs API key conflict: both present at once is unstable.
- VS Code extension / WSL2: separate proxy; WSL doesn't inherit Windows proxy.
- Version bug: known issues on some builds — update to latest.
# 1) set for the current shell (most common)
export HTTPS_PROXY="http://127.0.0.1:7890"
export HTTP_PROXY="http://127.0.0.1:7890"
export ALL_PROXY="http://127.0.0.1:7890"
# 2) verify the proxy works
$ curl -I https://api.openai.com/v1
# 3) reconnect
$ codex
Shortest path: install → log in → go
Install
$ npm i -g @openai/codexNeeds Node ≥ 18. Note the @openai/ scope.
Log in
$ codex
# sign in with ChatGPTOr codex login --with-api-key.
Run it
› fix the error on the login pageJust describe the task in plain language.
The questions newcomers ask first
How do I install the Codex CLI?
Install Node.js 18+ then run npm install -g @openai/codex; on macOS/Linux you can also use curl -fsSL https://chatgpt.com/codex/install.sh | sh. Verify with codex --version. It must be @openai/codex — plain codex is an unrelated 2012 package.
Why does it keep showing Reconnecting?
Almost always a network/proxy issue. Behind a firewall Codex can't reach OpenAI, so set HTTPS_PROXY to a local proxy — and not socks5 (convert to http). See the Reconnecting checklist.
Do I have to pay?
The CLI is free and open source, but the model needs a ChatGPT subscription (Plus and up) or an OpenAI API key. ChatGPT login reuses your plan; an API key bills per token.
Where is config.toml and how do I change the model?
At ~/.codex/config.toml (Windows: %USERPROFILE%\.codex\config.toml). Set model = "gpt-5.3-codex" for the default, or switch in-session with /model. See the config guide.
Codex or Claude Code — which should I pick?
In short: Codex is cheaper, edges ahead on benchmarks, and suits high-volume automation; Claude Code is rated higher for quality, context-heavy and security-sensitive work. Many teams run both. See the comparison.
Still stuck reconnecting? Fix the network first
90% of newcomer issues are just three things: the wrong package, no proxy, or an auth conflict. Walk the guide once and it usually runs.