You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This doesn't seem to work right now even if you set up the baseurl and model names correctly since the agent loop requests the chat completions using the new openai /v1/responses api instead of the older /v1/chat/completions api which other providers already support.
This however seems to be a deliberate way to discourage using your own models to run codex and some work on this front would be very helpful for all.
Reacted by kmehtarbx, Shaun Pedicini, Yukai Huang, Diego Spinola, num13ru, Juiyang Kuan, 见微, Shane Sewell, Huge, Stone and 5 more
Reacted by Glenn 'devalias' Grant, Yichang Jian, Gregory Petrosyan, Asif Mulla, Alexander Puga, hedeng, Muhammed İKİNCİ, ericshao, Rammiah, xuyangyuio and 8 more
Found the solution, looks like the way to use other models has been changed, one needs to refer to this doc to use other models(by using config.toml): https://github.com/openai/codex/blob/main/docs/config.md
This is a working config.toml to use openrouter if anyone need
Activity
geogod42 commentedon Apr 16, 2025
give me a hour
DiegoSpinola commentedon Apr 16, 2025
you can use the env var OPENAI_BASE_URL
KorigamiK commentedon Apr 16, 2025
This doesn't seem to work right now even if you set up the baseurl and model names correctly since the agent loop requests the chat completions using the new openai /v1/responses api instead of the older /v1/chat/completions api which other providers already support.
This however seems to be a deliberate way to discourage using your own models to run codex and some work on this front would be very helpful for all.
DiegoSpinola commentedon Apr 16, 2025
So maybe adding something like this proxy to the mix:
https://github.com/open-responses/open-responses
codefromthecrypt commentedon Apr 16, 2025
Should we keep this titled as OpenRouter API support, or /chat/completions instead? If the latter, it basically opens up a floodgate of options.
DD1302 commentedon Apr 17, 2025
Is anyone still working on this? Would love to use openrouter on codex
Soren8 commentedon Apr 18, 2025
Looks like there's a fork here https://github.com/ymichael/open-codex, but most discussion about this feature is in #26
codex-maintainers commentedon Aug 7, 2025
Thank you for the feedback! Please try again on the latest version of Codex CLI. If the issue persists, let us know.
timqian commentedon Sep 8, 2025
@codex-maintainers
This feature does not work on the latest version of codex.
timqian commentedon Sep 8, 2025
Found the solution, looks like the way to use other models has been changed, one needs to refer to this doc to use other models(by using
config.toml): https://github.com/openai/codex/blob/main/docs/config.mdThis is a working
config.tomlto use openrouter if anyone needfix(tui/input): normalize KeyEvent kind on non-enhanced terminals to …
chongdashu commentedon Sep 10, 2025
This still doesn't work for me. After setting above, you you run
codex -model openrouter?timqian commentedon Sep 10, 2025
after updating the config, just run
codexworks for meBTW, you will also need the OPENROUTER_API_KEY env in your .bashrc/ .zshrc
[Claude Code] After prompt openai#14
Galileo01 commentedon Jun 3, 2026
this config.toml ,It doesn't work for me,still need login
docs: retarget fork patch manifest at 0.147.0-alpha.4
docs: record upstream watch list and verification checklist
docs: retarget fork patch manifest at 0.147.0-alpha.4
docs: record upstream watch list and verification checklist
docs: retarget fork patch manifest at 0.147.0-alpha.4
docs: record upstream watch list and verification checklist
feat(storybook): mark connection recovery simulation controls as DEV (o…
Advance Codex to 0.151.0-alpha.7.2 (#14)
fix(bridges): first batch of confirmed review findings (P0 + 6 P1/P2)