VS Code extension does not work with custom model provider
Resolved 💬 12 comments Opened Oct 1, 2025 by nmartorell Closed Jan 31, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of the VS Code extension are you using?
0.4.15
Which IDE are you using?
VS Code Server
What platform is your computer?
Linux 6.1.141-165.249.amzn2023.x86_64 x86_64 x86_64
What steps can reproduce the bug?
I setup Codex to work with a custom model provider. The config.toml file is essentially:
profile = "o4-custom"
sandbox_mode = "danger-full-access"
[model_providers.custom-provider]
name = "LLM Gateway"
base_url = "<openAI-compliant gateway URL>"
wire_api = "chat"
[profiles."o4-custom"]
model = "azureopenai:azure-openai:o4-mini"
model_provider = "custom-provider"
model_context_window = 20000
model_max_output_tokens = 5000
When I run codex from the CLI, this works as expected; however, when I use the VS Code extension, it only works if I continue a conversation that I started from the CLI.
If I start a new conversation using the VS Code extension, then the extension seems to send the LLM API calls with the "custom-provider", but ignored the "model" name, and instead defaults to GPT-5. The error message I receive in the VS Code extension UI is:
unexpected status 400 Bad Request: data: {"object":"chat.completion","error":{"message":"Invalid LLM id: gpt-5-codex"}}
12 Comments
codex is not working for azure ai foundry
@nmartorell I’m also encountering this issue. The CLI can use the Azure custom provider, but the VS Code extension does not use my custom model, which the CLI can access. Have you resolved this issue?
I’m also encountering this issue.
have the same problem
@pai4451 I have not been able to resolve this, no. I'm currently not using the VS Code extension because of this issue.
Also experiencing this issue. My use case is to have a different
OPENAI_BASE_URL.However, the extension seems to be isolated from environment variables, as indicated by: ``
Missing environment variable:OPENAI_API_KEY.`` when I use a custom model provider.Can we either support custom model providers (by exposing
OPENAI_API_KEY), or somehow be able to modifyOPENAI_BASE_URLwithin the extension?Is there any update here? Using custom models is not working for me in the vs code extension either
Any updates? Still not working
@MTDickens, can you provide more details about what's not working for you? Provide the relevant section of your config.toml file.
Same question to everyone else in this thread who are still running into problems using custom model providers with the VS Code extension. Many Codex users are using this combination, so if it's not working for you, we'd like to understand why not.
This is my codex config from
~/.codex/config.tomland codex is completely unable to do anythingCodex runs for a couple of minutes and then says
Codex also can't seem to change a file, not even add an
h1to a simple html file.@flopana, to clarify, are you saying that when you use the Codex IDE extension, it's not using the openrouter model provider? Or are you saying that it's using the openrouter model provider but you don't like the behavior of the model it's routing you to? Does the behavior improve if you comment out
model_provider="openrouter"and access the OpenAI model using the default openai model provider? Does it work if you use the CLI (as reported by the OP)?There are a bunch of different issues reported in this thread. Some have been fixed, others are configuration issues, others are OSS model issues. This is making it difficult to understand which problems (if any) still exist. In an effort to move this forward, I'm going to close and lock this thread. If you're seeing a problem related to this thread, please open a new bug report and provide details and repro steps.