Codex executable returns a list of available models

Resolved 💬 4 comments Opened Jan 7, 2026 by momiforgotthesemicolon Closed Jan 8, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What feature would you like to see?

I am writing a neovim plugin where codex is executed in place rather then in interactive mode. Can codex return the list of available models so user can pass it via codex exec --model <model_name> ?

I know that there is an api for it that I can curl, but trying to get to someone's $OPENAI_API_KEY is very sketchy. Is this something that you guys can do somehow? Thank you in advance and I appreciatge any response here :)

Additional information

_No response_

View original on GitHub ↗

4 Comments

github-actions[bot] contributor · 7 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #8392
  • #8319

Powered by Codex Action

etraut-openai contributor · 7 months ago

The --model command-line mechanism is useful if you want to override the model you've configured as default. Is there a need here to provide such an override, or do you think it's OK to use the model that the user has already configured (or the default model if they haven't explicitly configured one)?

etraut-openai contributor · 7 months ago

Another option is to use the Codex "app server", which is a set of APIs exposed by the Codex binary. This is the API that's used to implement the Codex IDE Extension. There's an API called "model/list" that supplies the list of supported models. The app server APIs are not currently well documented, but you can clone the Codex sources and then ask Codex to explain it to you.

momiforgotthesemicolon · 7 months ago
Is there a need here to provide such an override

the way my plugin works is that I am invoking the command:

local command = { "codex", "exec", "--cd", jobCwd, "-" }

on stdout I am getting a full file buffer and I am replacing the actuall buffer with codex changes. I would love to have a feature where people can use different models for reasons that I cannot predict :D but I want to utilize codex exec as much as I can.

The only workaround for this that I come up with is to ask client to type the model that it want to use manually, but this is not really good user experience imo. Ideally I would love to be able to show a full list of available models for specific user ( I don;t have a direct access to $OPENAI_API_KEY) and then choosing one, which is going to affect my command:

local command = { "codex", "exec", "--cd", jobCwd, "--model", <insert_model_chosen_from_list>, "-" }

AppServer just to get list of models sounds a bit like an overkill for my needs :(, but thanks for your time and response here!