stream disconnected before completion in Codex means the request to the model didn’t finish: the connection closed, no data came for too long, or the server sent an error inside the stream. The reason is written after the colon, so start there. Codex retries on its own (up to 5 times by default), so you can simply wait out a rare disconnect. If it keeps happening, check your network and proxy. And if Codex can’t connect to OpenAI’s servers from your address, you can connect it with an API key to RuAPI, an independent API gateway that works from Russia — then you need neither a ChatGPT login nor a VPN.
What the text after the colon means
Apart from
error sending request, the wording comes from the Codex source code (error.rs, responses.rs, responses_websocket.rs), checked on 25 November 2026.
What to try
1
Let Codex retry
While you see “Reconnecting…”, Codex is trying again by itself. According to the configuration reference, it retries an interrupted stream up to 5 times (
stream_max_retries) and a failed request up to 4 times (request_max_retries).2
Update Codex and run the check
codex update installs the latest version (if Codex was installed by the RuAPI command, update it as described here). codex doctor checks the installation, configuration and login.3
Check your proxy
Leftover
HTTP_PROXY, HTTPS_PROXY or ALL_PROXY variables are sometimes the cause: the proxy is off or has moved to another port, but Codex still goes through it. That’s what happened to users in this GitHub thread. Look in ~/.codex/.env as well.4
Try another network
A different Wi-Fi or a phone hotspot shows at once whether the network is the problem. Turn off HTTPS inspection in your antivirus for a while.
5
Pick up where you left off
codex resume --last opens the most recent session.If Codex can’t reach OpenAI’s servers
With a ChatGPT login, Codex sends requests tochatgpt.com — you can see the address in the error: error sending request for url (https://chatgpt.com/backend-api/codex/responses). If it isn’t reachable from your network, retrying won’t help.
With a RuAPI key, Codex sends requests to https://www.ruapi.ai/v1 and no ChatGPT account is involved. RuAPI works from Russia without a VPN.
1
Account and key
Sign up at www.ruapi.ai with email, Google or Yandex. Key: Console → API Keys → Create API key.
2
Balance
Console → Wallet: USDT or USDC, from 5 USDT. No USDT yet? Buy it with rubles via SBP. Cards from foreign banks (Visa / Mastercard) are accepted too.
3
Codex
With one command or manually in
config.toml — see Codex CLI./model menu has GPT models as well as Claude, DeepSeek, Gemini and others.
FAQ
Is it because I hit my limit?
Is it because I hit my limit?
Usually not: Codex reports a subscription limit in different words. But if the text after the colon mentions a limit or a balance, that is the reason.
How is this different from “Selected model is at capacity”?
How is this different from “Selected model is at capacity”?
“At capacity” means OpenAI’s server reported an overload — see Codex: Selected model is at capacity. Here the request simply didn’t finish.
I get disconnects with a RuAPI key too. What should I do?
I get disconnects with a RuAPI key too. What should I do?
Update Codex and check your proxy and antivirus using the steps above. If that doesn’t help, send support the full error text, the model name and the time of the request.
Can I keep the ChatGPT login as well?
Can I keep the ChatGPT login as well?
Yes. The provider is set by the
model_provider line in config.toml; CC Switch makes switching easier.Next
Codex CLI setup
With one command or config.toml.
Codex: Token exchange failed
Can’t sign in to Codex.