Unable to use codex at all – neither via API keys nor via web login

Resolved 💬 7 comments Opened Sep 10, 2025 by rr- Closed Sep 10, 2025

What version of Codex is running?

codex-cli 0.31.0

Which model were you using?

codex-mini-latest

What platform is your computer?

Linux 6.15.9-arch1-1 x86_64 unknown

What steps can reproduce the bug?

WEB LOGIN

  1. Run codex
  2. Sign in with ChatGPT
  3. (See the link opened in the browser, OR click it manually, both lead to the same outcome)
  4. Log in with Google
  5. Redirects go brrr
  6. Token exchange failed: error sending request for url (https://auth.openai.com/oauth/token). The CLI continues to wait for a confirmation which never arrives.

<img width="1433" height="270" alt="Image" src="https://github.com/user-attachments/assets/eddef43c-f6dc-480d-b35e-a163a44c48fe" />

API LOGIN

  1. Set OPENAI_API_KEY either to OPENAI_API_KEY=sk-proj-… or OPENAI_API_KEY=sk-mym…
  2. Launch codex
  3. Use preferred_auth_method="apikey" in config.toml OR confirm that yes I want to use pay as I go payment method associated with API keys
  4. Prompt "test"
  5. Wait around 30 s
  6. ⚠️ stream error: error sending request for url (https://api.openai.com/v1/responses); retrying 1/5 in 188ms…

What is the expected behavior?

I can use Codex

What do you see instead?

Currently I'm not able to use Codex in any way

Additional information

_No response_

View original on GitHub ↗

7 Comments

rr- · 10 months ago

ISP issue on my part. Changing my DNS to 8.8.8.8 fixed the issue. Found this out with the help of tcpdump.

Harry-maximum · 9 months ago

lol the same, has nothing to do with this OAuth shit

kevit-ashish-chandpa · 9 months ago
ISP issue on my part. Changing my DNS to 8.8.8.8 fixed the issue. Found this out with the help of tcpdump.

Thanks @rr- ,
It’s working as expected for me. If you’re facing issues, please ensure that port 443 is open on your system.

steveepreston · 7 months ago

Issue still exists and not resolved by setting DNS or opening 443 port

Update: Resolved by turning off the WSL mode

pickmao · 4 months ago

maybe your system env is wrong.

Harry-maximum · 4 months ago
maybe your system env is wrong.

I solved the problem, because of some reasons in China, we cannot use the full Internet, after I open the TUN mode of my clash Verge, codex login succeeded and works fine, thanks for that

andreykaone · 1 month ago

Also have this issue. I use Happ app, and selecting TUN mode in a client helps me resolve this one

<img width="1034" height="668" alt="Image" src="https://github.com/user-attachments/assets/f34b9848-bfdf-4d46-973c-80421a352acf" />