Problem with logic when it comes to change providers
Resolved 💬 9 comments Opened May 17, 2025 by notlikejuice Closed Aug 7, 2025
@notlikejuice can you try again with the latest version of codex? You can update withnpm install -g @openai/codex0.1.2505161800 anthropic/claude-3.5-haiku-20241022:betalinux|x64|5.15.167.4-microsoft-standard-WSL2``-`test -0 reasoning|0 tool- test -0 reasoning|0 tool- test -0 reasoning|0 tool`When I enter the default “codex” command and enable it with openai, the models from the original provider work naturally, but when I change it via /models -> tab -> model as above, there is no message. Problems start to occur when I enable codex with the command “codex --provider openrouter”. 0.1.2505161800 openai/chatgpt-4o-latestlinux|x64|5.15.167.4-microsoft-standard-WSL2`codex --provider openrouter ╭──────────────────────────────────────────────────────────────╮ │ ● OpenAI Codex (research preview) v0.1.2505161800 │ ╰──────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────╮ │ localhost session: 9263d86ccf8f4b68b6e35907b8f17812 │ │ ↳ workdir: /mnt/c/Users/karol/codexxx │ │ ↳ model: anthropic/claude-3.5-haiku-20241022:beta │ │ ↳ provider: openrouter │ │ ↳ approval: suggest │ ╰──────────────────────────────────────────────────────────────╯ user test system ⚠️ OpenAI rejected the request. Error details: Status: 401, Code: 401, Type: unknown, Message: 401 ╯ No auth credentials found. Please verify your settings and try again. system Switched model to agentica-org/deepcoder-14b-preview:free user haha system ⚠️ OpenAI rejected the request. Error details: Status: 401, Code: 401, Type: unknown, Message: 401 ╯ No auth credentials found. Please verify your settings and try again. system Switched model to openai/chatgpt-4o-latest user test system ⚠️ OpenAI rejected the request. Error details: Status: 401, Code: 401, Type: unknown, Message: 401 ╯ No auth credentials found. Please verify your settings and try again. system 🔗 Bug report URL: https://github.com/openai/codex/issues/new?template=2-bug-report.yml&labels=bug&v ersion=0.1.2505161800&model=openai%2Fchatgpt-4o-latest&platform=%60linux%60+%7C+%60x64%60+%7C+%605.1 5.167.4-microsoft-standard-WSL2%60&steps=-+%60%60%60%0A++test%0A++%60%60%60%0A++-+%600+reasoning%60+ %7C+%600+tool%60%0A-+%60%60%60%0A++haha%0A++%60%60%60%0A++-+%600+reasoning%60+%7C+%600+tool%60%0A-+% 60%60%60%0A++test%0A++%60%60%60%0A++-+%600+reasoning%60+%7C+%600+tool%60 system 🔗 Bug report URL: https://github.com/openai/codex/issues/new?template=2-bug-report.yml&labels=bug&v ersion=0.1.2505161800&model=openai%2Fchatgpt-4o-latest&platform=%60linux%60+%7C+%60x64%60+%7C+%605.1 5.167.4-microsoft-standard-WSL2%60&steps=-+%60%60%60%0A++test%0A++%60%60%60%0A++-+%600+reasoning%60+ %7C+%600+tool%60%0A-+%60%60%60%0A++haha%0A++%60%60%60%0A++-+%600+reasoning%60+%7C+%600+tool%60%0A-+% 60%60%60%0A++test%0A++%60%60%60%0A++-+%600+reasoning%60+%7C+%600+tool%60 system Invalid command "/m". Use /help to retrieve the list of commands. system Switched provider to OpenAI with model openai/chatgpt-4o-latest system Switched model to codex-mini-latest user test system ⚠️ OpenAI rejected the request (request ID: req_1c5177da82e4c145b832300658a50976). Error details: ╯ Status: 404, Code: unknown, Type: invalid_request_error, Message: 404 This model is only supported in v1/responses and not in v1/chat/completions.. Please verify your settings and try again. ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ctrl+c to exit | "/" to see commands | enter to send — 100% context left`` Models on codex --provider openrouter like an openai/models doesn't working, either clicking with /models -> tab -> change for openai doesn't helps.
_Originally posted by @notlikejuice in #165_
It has been observed that when individuals utilize both bash and fish, for instance, there is a possibility of encountering challenges with env_keys. Additionally, the introduction of logging might be slightly misleading, as there appears to be a slight issue with the logic of provider selection. If I were to attempt to merge the .env and .json files, for instance, would it be possible to do so without including the CLA at the beginning?
9 Comments
using openrouter, same issue.
did it get fixed?
Same issue.
I'm working on it, maybe someone else will be able to figure it out faster because it seems to work, but I can't get it to go through and am tweaking it for now according to the contribution rules.
need to change var BASEURL from openai to openrouter example
Is this solved? I'm confused, https://github.com/openai/codex/pull/1093 is closed but I still run into the same error with openrouter.
This is the latest version right? OpenAI Codex (research preview) v0.1.2505172129
got the same issue with openrouter
system
⚠️ OpenAI rejected the request. Error details: Status: 401, Code: 401, Type: unknown, Message: 401 No auth credentials found. Please verify your settings and try again.
ive traced the issue and found that the api key being sent in the request is that of chatgpt from the login,
adding this code to line 399 in cli.tsx fixes it
just a basic fix
Deleting the auth.json file resolved the issue for me.
Thank you for the detailed report! We're currently focused on the native/Rust implementation of Codex CLI. Please try using the latest version of Codex CLI, and if the issue persists, let us know. Your feedback is valuable, and we're here to help!