Skip to content

[Feature] Explicit per-thread external-provider routing during Codex Desktop Luna Reserve #4869

Description

@oocheol

Area

Proxy and routing / Codex Desktop compatibility

What are you trying to accomplish?

Continue working in Codex Desktop with an independently configured provider when the native ChatGPT/Codex quota is exhausted and Luna Reserve locks the model picker.

I am encountering the picker lockout described in #2813 and #4076. The desired outcome is to retain the Desktop workflow and, where technically compatible, the current conversation, while selecting the actual execution provider through OpenCodex.

This is not a request to reset, falsify, or bypass OpenAI usage limits. The alternative provider must use its own authorized credentials, billing, and quota.

What prevents this today?

The investigation recorded in #2813 identifies a Desktop-side restriction: Reserve can force the outgoing model to gpt-reserve before the request reaches OpenCodex. Changing catalog visibility or only setting model in config.toml therefore does not address that native-auth Desktop state.

There is already a promising configuration-level alternative: an effective codexDesktopAuthless setup uses a dedicated provider with requires_openai_auth = false. However, changing the global provider/auth presentation is a different workflow from keeping the existing Desktop setup. Related reports cover settings that are not yet applied or ineffective (#4809), Reserve catalog projection (#4811), and provider/history restoration (#4812).

This proposal is specifically about an explicit, per-thread execution-provider override, not another request to fix the native picker or re-report those existing bugs.

What should OpenCodex do?

Please evaluate an opt-in routing mode with the following behavior:

  1. The user explicitly selects an independently credentialed provider/model for one conversation in OpenCodex. Nothing changes globally or automatically when native quota is exhausted.
  2. If that conversation sends an inference request with the exact model gpt-reserve, OpenCodex dispatches it through the selected provider's normal adapter and authorization path.
  3. Other conversations, genuine Reserve requests without an override, and account-qualified Reserve routes remain unchanged.
  4. The dashboard clearly displays both the Desktop-requested model and the actual execution provider/model. It must warn that the Desktop may still display “Luna Reserve”; this proposal does not restore its native picker.
  5. Disabling the override restores ordinary routing for subsequent requests without modifying account credentials or rewriting conversation history merely to toggle the option.

Feasibility gate: first verify that an affected Desktop build actually sends a request to OpenCodex and supplies a stable, correctly scoped conversation identity. If Desktop blocks submission entirely, or the identity is missing/ambiguous, this mode cannot solve that case and must report it rather than apply a global substitute.

Example usage or interface

Proposed UI workflow, not an existing feature or command:

OpenCodex dashboard
  -> Select a conversation
  -> External execution override
  -> Select an already configured independent provider/model
  -> Review the data-sharing, billing, and Desktop-label warning
  -> Enable for this conversation

Desktop request:  model = gpt-reserve
OpenCodex route:  the explicitly selected provider/model
Other threads:   unchanged

Disable override -> ordinary routing resumes on subsequent requests

The warning should explicitly state that conversation content will be sent to the chosen provider and charged under that provider's terms. An active override must remain visible until disabled; quota recovery should not silently switch providers mid-conversation.

Additional context

Source-level basis, not an implementation claim

The following pinned sources informed this proposal:

  • OpenCodex src/router.ts at 44de45d: routeModelInternal already resolves policy/combo choices into concrete provider/model destinations. This is a possible integration point, not evidence that Reserve overrides currently work.
  • OpenCodex combo validation and native model definitions: nativeAlias is restricted to supported native slugs, while gpt-reserve is separately defined and absent from that supported set. Simply configuring a native alias is therefore not the proposed solution. Please keep those general validation boundaries intact.
  • OpenCodex auth-context handling: conversation identity and request/account ownership already have dedicated handling. Any override should reuse the appropriate identity boundaries rather than keying a global rule by a raw model name or assuming parent and child threads are interchangeable.
  • OpenCodex provider injection and Codex ConfiguredModelProvider::account_state: the existing authless alternative changes the native account presentation. This is preferable if it already satisfies the workflow.
  • Recorded Desktop investigation: the repository records source-level evidence for authless avoiding a particular Desktop Reserve gate, while explicitly distinguishing that from a live Reserve-session test. That distinction should be preserved.

Required safeguards and validation

  • Keep normal proxy admission checks. Use only the selected provider's credentials; never forward native ChatGPT bearer tokens or account-identifying headers to an unrelated provider.
  • Preserve all upstream authorization/quota checks. Do not modify WHAM responses, recovery flags, or Reserve eligibility. Do not fall back to the exhausted native account if the chosen provider fails.
  • Validate target capability compatibility, tool calls/results, images, reasoning settings, streaming/cancellation, context limits, and compaction. Rewriting the model string alone is not a complete implementation. Reject unsupported continuation explicitly instead of silently dropping context.
  • Keep response IDs, cached/reasoning state, and provider-specific continuation artifacts isolated across providers. A route change must not reuse an upstream response ID that belongs to another provider.
  • Ensure per-thread isolation, including concurrent threads, forks, and subagents; do not inherit overrides into child conversations implicitly.
  • Record requested versus resolved provider/model and the override reason without logging secrets or conversation content merely for diagnostics.
  • Test the no-override path, exact-match behavior, missing identity, disabled/unauthorized targets, disable/reenable behavior, and an actual affected Desktop version before describing this as a working workaround.

Alternatives or workarounds

If maintainers consider the authless workflow sufficient and intentionally do not support this kind of override, a clear statement of that supported boundary would also help. Otherwise, the first deliverable should be a small feasibility test and design review before a production PR.

Verification status

This is an AI-assisted, source-informed feature proposal, not a tested patch. No live successful Reserve-to-external-provider session, complete end-to-end authentication trace, or compatibility test is claimed. The cited commits identify the analysis baseline; they do not imply that my installed binaries exactly match those revisions. No Desktop bundle has been patched.

Checks

  • I searched existing issues and documentation.
  • This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
  • I removed secrets and personal data.

Activity

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions