Skip to content

ocx start auto-injects openai_base_url and overwrites provider config, breaking Codex Desktop on networks that cannot reach chatgpt.com #1054

Closed as not planned

Description

@majia3592

Title

ocx start auto-injects openai_base_url and overwrites provider config, breaking Codex Desktop on networks that cannot reach chatgpt.com

Environment

  • OS: Windows 11 x64
  • Node.js: v24.16.0
  • Codex CLI: v0.146.0
  • opencodex: v2.10.0
  • Codex config: model_provider = "deepseek" (API Key auth, preferred_auth_method = "apikey")

Use case

I work on a corporate network that blocks chatgpt.com / gpt.com. Codex Desktop requires ChatGPT OAuth login when model_provider = "openai", which is impossible on this network.

My goal was to use opencodex as a local proxy to route Codex CLI requests to third-party providers (MIMO, OpenCode GO) while keeping model_provider = "deepseek" for Codex Desktop (API Key auth, no OAuth needed).

What we tried

Attempt 1: ocx sync (recommended approach)

Following the opencodex quickstart, we ran ocx sync which:

  1. Changed model_provider from "deepseek" to "openai"
  2. Injected openai_base_url = "http://127.0.0.1:10100/v1"
  3. Synced model catalog

After restarting Codex Desktop:

  • The app detected model_provider = "openai" and required ChatGPT OAuth login
  • Corporate network cannot reach chatgpt.com → login impossible → locked out completely
  • Had to manually restore config from backup

Attempt 2: Manual provider config (Design B)

We skipped ocx sync and manually added the provider to config.toml:

[model_providers.opencodex]
name = "opencodex"
base_url = "http://127.0.0.1:10100/v1"
wire_api = "responses"
env_key = "CODEX_DEEPSEEK_API_KEY"

This worked perfectly for CLI:

  • codex → DeepSeek direct (default)
  • codex -p opencodex → MIMO through proxy
  • No GPT login required

Attempt 3: Make Desktop also use opencodex

We then tried setting model_provider = "opencodex" in config.toml so Codex Desktop would also route through the proxy.

Problem A: ocx start detected model_provider = "opencodex" and auto-injected openai_base_url. This caused Codex Desktop to show the ChatGPT login page again — even though the actual provider is opencodex, not openai.

We manually removed openai_base_url from config.toml before starting the Desktop, but the login page still appeared. It seems Codex Desktop checks the built-in openai provider's auth state regardless of the configured model_provider.

Problem B: During the ocx start injection process, the model and model_provider lines were removed from config.toml. After we manually deleted openai_base_url, the config was missing:

model = "deepseek-v4-flash"
model_provider = "deepseek"

This required manual restoration from backup.

Current working setup (workaround)

We now use a split approach:

  • Codex Desktop: model_provider = "deepseek" (API Key, no OAuth)
  • Codex CLI: codex -p opencodex (overrides to opencodex proxy per-session)

This works but has limitations:

  • /model picker doesn't show opencodex models (had to manually sync models.json)
  • Reasoning effort levels had to be manually added to models.json
  • Desktop cannot use third-party models at all

Issues to address

1. ocx start should respect existing provider configuration

When model_provider is already set to a custom provider (not "openai"), ocx start should not inject openai_base_url. The injection forces Codex to treat the openai provider as the primary route, which conflicts with the user's explicit provider choice.

Suggested fix: Add a --no-inject flag, or detect that model_provider != "openai" and skip injection automatically.

2. ocx start should not remove existing config lines

During the injection process, model and model_provider lines were removed from config.toml. This is destructive and unexpected. The injection should only add/modify its own lines (openai_base_url, model_catalog_json) without touching other configuration.

3. Windows sandbox elevated mode fails

With [windows] sandbox = "elevated" in config.toml, Codex CLI (both DeepSeek and opencodex) fails with:

SetTokenInformation(TokenDefaultDacl) failed: 1344

Changing to sandbox = "unelevated" fixes this. This may be a Codex issue rather than opencodex, but worth noting since it affects the onboarding experience.

4. npm install timeout on slow networks

npm install -g @bitkyc08/opencodex times out on slow networks due to the bundled Bun runtime download. Using --registry=https://registry.npmmirror.com (Chinese npm mirror) resolves this. Could be mentioned in the installation docs.

Questions

  1. Is there a way to use opencodex as a provider in Codex Desktop without triggering the ChatGPT login check? Or is this a hard limitation of the Codex Desktop app?
  2. Is there a way to sync opencodex models into models.json without running ocx sync (which forces model_provider = "openai")?

Activity

  1. github-actions commented on Aug 5, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: unknown.

  2. added
    cli
    on Aug 5, 2026
  3. github-actions commented on Aug 5, 2026

    @github-actions
    Contributor

    Issue closed: use an issue template

    Thanks for taking the time to submit this issue. It was closed automatically because it was not opened with a recognized issue template (Bug report, Feature request, Documentation, or Provider compatibility). Freeform and API-opened issues cannot skip this check.

    • This issue does not use a recognized issue template.

    Please edit the issue to add:

    • Open a new issue with the Bug report, Feature request, Documentation, or Provider compatibility template.
    • Or edit this issue so the body uses the template section headings for the kind of report you are filing.

    See the Contributing guide for details.

    Once the report passes the automated checks, it will be reopened automatically unless a maintainer has changed its state.

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

    cli

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions