Skip to content

Support custom model providers in app #10867

Open

Description

@iwinux

What version of the Codex App are you using (From “About Codex” dialog)?

260205.1301 (554)

What subscription do you have?

None

What issue are you seeing?

I'm using custom model provider for Codex CLI and App. In CLI, /model is available and switching models works as expected. However, in Codex App, this happens (notice the absence of model switcher):

Image

What steps can reproduce the bug?

  1. set up custom model provider & profile
    profile = "internal"
    
    [features]
    # remote_models = false
    
    [profiles.internal]
    # model = "gpt-5.2"
    model_provider = "internal"
    model_reasoning_effort = "medium"
    
    [model_providers.internal]
    name = "Interal LLM Gateway"
    base_url = "http://llms.example.com/v1"
    wire_api = "responses"
  2. launch Codex App

What is the expected behavior?

It should provider the same model switcher as in ChatGPT subscription mode:

Image

Additional information

No response

Activity

  1. added
    app
    on Feb 6, 2026
  2. added
    bug
    custom-model
    on Feb 6, 2026
  3. changed the title [-]Cannot switch model in API mode[/-] [+]Support custom model providers in app[/+] on Feb 6, 2026
  4. added
    enhancement
    and removed
    bug
    on Feb 6, 2026
  5. harshit97 commented on Feb 21, 2026

    @harshit97

    Ran into the same thing

    I'm using a custom model provider behind an internal gateway and hit exactly this: CLI works great (/model lets me switch), but the Desktop app (v26.217.1959, build 669, as of Feb 19 2026) just... doesn't show the model picker at all.

    Spent some time tracing through the Electron bundle to figure out what's going on. For anyone unfamiliar, the Codex Desktop app is an Electron app, and you can extract its bundled source from the asar archive at Codex.app/Contents/Resources/app.asar using npx asar extract.

    Root cause: In the frontend JS (index-X7Ur8m0p.js inside the extracted asar), the composer footer component conditionally renders both the model picker and the reasoning effort picker only when requiresAuth is truthy:

    const c = o.requiresAuth;
    c && f.jsxs(f.Fragment, {children: [
        !S && f.jsx(Lpn, {conversationId: e}),  // model picker
        !M && f.jsx(Fpn, {conversationId: e})    // reasoning effort picker
    ]})

    When you use a custom model provider without a ChatGPT or OpenAI API key login, the frontend sees requiresAuth = false and the entire picker block gets skipped. The backend side is actually fine — models pass filtering correctly and the frontend allowlist (mft) includes models like gpt-5.2-codex and gpt-5.2 for non-ChatGPT auth. It's purely a UI gating issue.

    Also worth noting: the source on main as of Feb 21 2026 has a model_catalog_json config key (in codex-rs/config/src/lib.rs) that looks like it was meant to help with this — letting you point to a local model catalog file. But it doesn't exist in the current shipped binary (v26.217.1959, build 669). Setting it in config.toml is silently ignored.

    What I think the fix would look like:

    The conditional should render the model picker regardless of auth mode when there are models available. Something like showing the picker when requiresAuth || hasCustomProvider — the model filtering logic already handles scoping the list correctly per auth type.

    Would love to see this fixed since the Desktop app is otherwise really nice with custom providers.

  6. adrixgc commented on Mar 18, 2026

    @adrixgc

    Ran into the same/similar problem

    We are using LiteLLM as a proxy to expose custom models via /v1/models. The endpoint correctly returns our custom model IDs, for example:

    {
      "data": [
        {
          "id": "desarrollo-v4-gpt-5.3-codex",
          "object": "model",
          "created": 1677610602,
          "owned_by": "openai"
        },
        {
          "id": "desarrollo-v4-gpt-5.2-codex",
          "object": "model",
          "created": 1677610602,
          "owned_by": "openai"
        },
        {
          "id": "desarrollo-v4-gpt-5.1-codex-mini",
          "object": "model",
          "created": 1677610602,
          "owned_by": "openai"
        }
      ],
      "object": "list"
    }

    Problem:

    The issue is not with LiteLLM or the endpoint itself.

    The problem is that Codex CLI and Codex Desktop UI do not properly support or expose these custom models:

    • Users cannot easily discover available models
    • They must manually input exact model IDs in config.toml
    • The CLI/UI do not present these models as selectable options

    Expected Behavior:

    • Codex CLI and Desktop UI should:

      • Fetch models from gateway's /v1/models
      • Display them as selectable options
      • Allow users to choose custom LiteLLM models without manual configuration

    Why this matters:

    Without this, using LiteLLM as a model gateway breaks the UX:

    • No model discoverability
    • High friction for users
    • Not viable for non-technical users
  7. adrixgc commented on Mar 18, 2026

    @adrixgc

    Quick question @iwinux @harshit97

    Have any of you managed to get the gateway's /v1/models endpoint to properly populate the model list in the Codex CLI?

    In our case, the endpoint returns the custom models correctly, but the CLI doesn’t seem to expose them as selectable options (we still need to manually set the model ID).

    Just trying to understand if this is a general limitation or if someone has found a workaround.

    Thanks!

  8. evannotfound commented on Mar 20, 2026

    @evannotfound

    Just add

    requires_openai_auth = true
    

    under your provider.

    then, restart the app. if the app asks you to login, choose api key, and enter any character then press enter

    this is a workaround

  9. tranleo148 commented on Apr 1, 2026

    @tranleo148

    Just add

    requires_openai_auth = true
    

    under your provider.

    then, restart the app. if the app asks you to login, choose api key, and enter any character then press enter

    this is a workaround

    it worked for me. thanks

  10. iwinux commented on Apr 9, 2026

    @iwinux
    Author

    Latest version on macOS (Version 26.406.31014 (1395)) seems to have fixed the issue. Is there any changelog entry confirming this?

  11. fjfricke commented on Apr 9, 2026

    @fjfricke

    It only allows one profile though...

  12. chrismartinez-sb commented on Apr 24, 2026

    @chrismartinez-sb

    Ran into the same thing

    I'm using a custom model provider behind an internal gateway and hit exactly this: CLI works great (/model lets me switch), but the Desktop app (v26.217.1959, build 669, as of Feb 19 2026) just... doesn't show the model picker at all.

    Spent some time tracing through the Electron bundle to figure out what's going on. For anyone unfamiliar, the Codex Desktop app is an Electron app, and you can extract its bundled source from the asar archive at Codex.app/Contents/Resources/app.asar using npx asar extract.

    Root cause: In the frontend JS (index-X7Ur8m0p.js inside the extracted asar), the composer footer component conditionally renders both the model picker and the reasoning effort picker only when requiresAuth is truthy:

    const c = o.requiresAuth;
    c && f.jsxs(f.Fragment, {children: [
    !S && f.jsx(Lpn, {conversationId: e}), // model picker
    !M && f.jsx(Fpn, {conversationId: e}) // reasoning effort picker
    ]})
    When you use a custom model provider without a ChatGPT or OpenAI API key login, the frontend sees requiresAuth = false and the entire picker block gets skipped. The backend side is actually fine — models pass filtering correctly and the frontend allowlist (mft) includes models like gpt-5.2-codex and gpt-5.2 for non-ChatGPT auth. It's purely a UI gating issue.

    Also worth noting: the source on main as of Feb 21 2026 has a model_catalog_json config key (in codex-rs/config/src/lib.rs) that looks like it was meant to help with this — letting you point to a local model catalog file. But it doesn't exist in the current shipped binary (v26.217.1959, build 669). Setting it in config.toml is silently ignored.

    What I think the fix would look like:

    The conditional should render the model picker regardless of auth mode when there are models available. Something like showing the picker when requiresAuth || hasCustomProvider — the model filtering logic already handles scoping the list correctly per auth type.

    Would love to see this fixed since the Desktop app is otherwise really nice with custom providers.

    Do you know if the model_catalog_json is working correctly? As of now I tried using it for a custom picker of models in our org, but it ignored all of them except the 5.3 codex slug, I assume because thats an existing openai model?

  13. 1 remaining item

  14. janis-ax commented on May 6, 2026

    @janis-ax

    Does anyone have an example with a workaround?

  15. bakaburg1 commented on May 19, 2026

    @bakaburg1

    Any news on this?

  16. d11196175 commented on May 23, 2026

    @d11196175

    any news on this issue?

  17. steveepreston commented on Jun 12, 2026

    @steveepreston

    +1
    Please add a custom model selector
    Codex is a good app and we dont want to migrate to other tools like Cline/Roo/Windsurf/Continue/etc

  18. steveepreston commented on Jun 12, 2026

    @steveepreston

    Currently for changing model from .toml file, should restart VSCode/Extension!!!

  19. bakaburg1 commented on Jun 12, 2026

    @bakaburg1

    even more annoying is that threads are segregated by provider. So if I change provider and restart I lose all previous threads...

  20. HerShin5 commented on Jun 12, 2026

    @HerShin5

    Adding another gateway-user data point here: the picker really shouldn’t be tied to the ChatGPT/OpenAI auth path.

    A lot of teams are running Codex behind an OpenAI-compatible /v1 gateway for routing, fallback, usage limits, or centralized billing. In that setup the important thing is: if a custom provider has base_url + wire_api = "responses" and /v1/models returns usable IDs, the app should expose those models just like the CLI does.

    For anyone testing external gateways, I’d treat this the same way as LiteLLM/OpenRouter-style providers: keep the model IDs exactly as the gateway returns them and point Codex at a Responses-compatible base URL. For example, https://kiroforge.cloud/v1 is OpenAI-compatible, so it falls into the same class of custom-provider UX issues being discussed here.

    The workaround with requires_openai_auth = true is useful, but long-term it would be much nicer if the Desktop app rendered the model picker whenever a custom provider has a discoverable model list, regardless of auth mode.

  21. steveepreston commented on Jun 12, 2026

    @steveepreston

    @bakaburg1 Exactly

  22. StellarWarp commented on Jul 10, 2026

    @StellarWarp

    Blocking ab.chatgpt.com and removing leveldb can be temporary solution for not changing your provider, as it relates to service policies obtained online.

    On Windows you can add 127.0.0.1 ab.chatgpt.com to C:\Windows\System32\drivers\etc\hosts and delete ~\AppData\Local\Packages\OpenAI.Codex_<some hash>\LocalCache\Roaming\Codex\web\Codex\Default\Local Storage\leveldb

    However this would cause some other issue e.g. missing Approve for me

    Pretty sure that OpenAI has no plan to improve this, cause they want to ensure that their closed app can use their close models only.

  23. zierocode commented on Jul 17, 2026

    @zierocode

    I rechecked this against Codex CLI 0.144.5. The current source now has most of
    the transport needed for a custom provider to own its remote model catalog, but
    not yet the provider-scoped authoritative semantics a gateway needs.

    Current 0.144.5 behavior:

    • ModelProviderInfo supports command-backed bearer auth through auth, and
      command-auth providers are eligible for remote model refresh.
    • Codex requests {base_url}/models?client_version=... with the provider's auth,
      expects the Codex { "models": [ModelInfo...] } schema, captures the response
      ETag, and applies a five-second request deadline.
    • OnlineIfUncached uses models_cache.json with a five-minute TTL; an ETag
      change can trigger an online refresh.
    • Remote catalogs replace bundled models only for ChatGPT account auth. For a
      custom command-auth provider, remote entries are merged into the bundled
      OpenAI catalog.
    • The cache is not keyed by provider identity. The source contains a TODO noting
      that switching providers can reuse another provider's fresh cache entry.
    • model_catalog_json is global and startup-only. It is not a catalog contract
      attached to one model_providers.<id> entry.

    Pinned source evidence:

    Could custom providers opt into an explicit provider-scoped mode, for example:

    [model_providers.gateway]
    name = "Internal gateway"
    base_url = "https://gateway.example/v1"
    wire_api = "responses"
    model_catalog_mode = "authoritative_remote"
    
    [model_providers.gateway.auth]
    command = "gateway-token"
    refresh_interval_ms = 300000
    

    Suggested semantics for authoritative_remote:

    1. It applies only to the selected custom provider. A successful schema-valid
      remote catalog replaces bundled models for that provider instead of merging
      unrelated OpenAI presets.
    2. Cache identity includes the provider config key, normalized base URL, catalog
      mode, and Codex client version. It never includes or persists bearer tokens.
    3. Startup with OnlineIfUncached may use only a fresh matching provider cache.
      On a cache miss, run command auth and fetch within the existing deadline. A
      failure must not fall back to another provider's cache or bundled catalog;
      retain the explicit configured model and surface the catalog error instead.
    4. Persist the provider-scoped ETag with the snapshot. A same-ETag notification
      renews that cache's TTL; a changed ETag forces an online refresh.
    5. Send If-None-Match during refresh. 304 retains the scoped snapshot and
      renews its TTL; a valid 200 atomically replaces models and ETag.
    6. Reject an ambiguous combination with global model_catalog_json, or document
      one deterministic precedence rule.

    Useful acceptance tests:

    • two command-auth providers sharing one CODEX_HOME never reuse each other's
      models or ETag;
    • a restart with a fresh matching cache does not invoke the auth command;
    • a stale/missing cache invokes the command once and refreshes the selected
      provider;
    • 304 preserves the snapshot, while 200 replaces rather than merges it;
    • a network/auth/schema failure never exposes unrelated bundled models;
    • switching back to the first provider restores only its scoped snapshot.

    This complements, but does not by itself close, #10867. Provider-scoped catalog
    truth is the backend requirement; Desktop still needs to render and select the
    models returned for a custom provider. If #10867 should remain focused on the
    picker, this catalog-mode work could be tracked as a linked model-provider issue.

  24. steveepreston commented on Jul 17, 2026

    @steveepreston

    @zierocode do you say that there is good news on this feature request?

  25. ropepop commented on Aug 10, 2026

    @ropepop

    Adding a remote-parity ask to this umbrella: with a custom provider on the macOS Codex desktop app, the full middle section renders locally — expandable reasoning summary + tool call activity, "Worked for Xs" chip. The same thread opened from ChatGPT mobile remote (iOS or Android) does not show that middle section: only a flattened thinking cell, no expandable reasoning, no tool-call steps — even though desktop has them. For custom-provider users the remote surface behaves differently from native OpenAI sessions and from the desktop rendering of the same thread.

    Related cluster already filed: #37598 (CLI fine / remote renders only first prompt + thinking cell), #31370 (mobile-created custom-provider threads fall back to model_provider=openai), #32185 (iOS remote thinking rendering), #23250 (mobile reasoning expansion), #36640 (model/reasoning config not exposed to mobile), #26907 / #32553 (remote threads get reduced tool manifests), #30190 (phase fidelity dropped in exec/SDK path). A consolidated remote-parity fix for custom-provider threads (same tool manifest, same reasoning/tool rendering, same session metadata as desktop) would resolve the whole cluster.

  26. liulianggui520-ops commented on Sep 19, 2026

    @liulianggui520-ops

    Additional current reproduction (Windows)

    I am seeing the same product gap with Codex Desktop and a custom Responses-compatible provider (OpenCode Go). The provider can be configured and used when the model and provider are set in ~/.codex/config.toml, but the Desktop model selector lists only OpenAI-hosted models; the custom provider's models are not discoverable or selectable there.

    Environment:

    • Windows 11
    • codex-cli 0.154.0-alpha.6.2
    • OpenCode Go Responses endpoint: https://opencode.ai/zen/go/v1
    • wire_api = "responses" for compatible models such as gpt-5.6-luna
    • API credentials are supplied through an environment variable; no credential is included here

    Expected behavior:

    • A provider-aware model picker with provider/model pairs; or
    • A clearly documented, supported catalog configuration that makes custom models selectable while preserving native OpenAI models.

    Documentation gap:

    • OpenAI documentation mentions model_catalog_json as a startup model-catalog override, but does not document the complete catalog schema or how a catalog entry is associated with a custom model_provider.
    • deepseek-v4.1-flash is another relevant use case: OpenCode Go exposes it through Chat Completions, so the documentation and UI should clarify protocol compatibility and whether such a model can appear in the Desktop picker.

    This is a usability and discoverability issue even when the backend can use a custom provider directly. Please either document the supported boundary clearly or expose custom providers as first-class model-picker entries.

  27. Matthew-Laplace commented on Nov 7, 2026

    @Matthew-Laplace

    Additional use case: multiple providers mounted at once (per-model routing)

    The request as written covers "custom provider + model switcher". A common setup goes one step further and needs several providers configured simultaneously, with each model slug bound to the upstream that serves it.

    • ~/.codex/config.toml can already declare multiple [model_providers.*] blocks, and model_catalog_json can list models that come from different upstreams.
    • What is missing is the App maintaining that binding: today the App follows the single model_provider / openai_base_url selected in config, so switching provider means rewriting the file on disk and restarting the app-server.
    • Expected: (a) keep N providers configured at the same time, (b) bind each model slug to its provider, (c) resolve the provider per request from that binding, with an optional fallback when one upstream reports a quota/rate-limit error.

    Shape of what users currently have to work around:

    model = "model-a"                      # default model
    openai_base_url = "http://127.0.0.1:PORT/v1"
    
    [model_providers.provider-a]
    base_url = "http://127.0.0.1:PORT_A/v1"
    
    [model_providers.provider-b]
    base_url = "http://127.0.0.1:PORT_B/v1"
    # model_catalog_json lists model-a, model-b, ... from different upstreams

    Tools outside Codex currently rewrite this file and restart the app-server to switch; a native "Providers" list plus a per-model binding in the App would remove that layer.

    Related defect: when a provider returns a quota/limit error, the App currently hard-blocks the composer for the whole account (#48816, #59175). With a per-model provider binding the App could fall back to a provider that is still usable instead of blocking the composer.


    补充使用场景:同时挂载多个 provider(按模型路由)

    现在这条请求描述的是"自定义 provider + 模型切换器"。实际使用中还要再进一步:同时配置多个 provider,让每个模型绑定到服务它的上游。

    • ~/.codex/config.toml 已经能声明多个 [model_providers.*],model_catalog_json 也能列出属于不同上游的模型。
    • 缺的是 App 维护这层绑定:目前 App 只跟随配置里单个 model_provider / openai_base_url,切换 provider 意味着改写磁盘上的配置文件并重启 app-server。
    • 期望:(a) 同时保留 N 个 provider 配置;(b) 每个模型 slug 绑定到对应 provider;(c) 按该绑定逐请求选择 provider,并可选地在某个上游返回额度/限流错误时回退到另一个。

    当前用户不得不依赖 Codex 之外的配置改写工具来维护这份配置并重启 app-server;如果 App 里有原生的 "Providers" 列表和每模型绑定,这一层工具就可以省掉。

    相关缺陷:当 provider 返回额度/限流错误时,App 目前会整体锁住 composer(#48816、#59175)。有了按模型绑定 provider 的能力,App 可以回退到仍然可用的 provider,而不是把整个输入框锁死。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appcustom-modelenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions