Skip to content

[FEATURE]: Add an explicit config option to force Codex-compatible request formatting #18203

Closed as not planned

Description

@Blues-star

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Description

Currently, whether LLM.stream() uses Codex-compatible formatting is determined implicitly by this logic:

const isCodex = provider.id === "openai" && auth?.type === "oauth"

This works for the common case, but it becomes problematic in some deployment scenarios.

Use case

A user may be connecting OpenCode to a Codex forwarding endpoint.
In this case, the client needs to send requests in Codex-compatible format, for example:

  • omit the regular system prompt
  • pass prompt content through the instructions field
  • adjust other request fields as needed

At the moment, the only workaround is to place an additional HTTP proxy between OpenCode and the forwarding endpoint, so that the proxy can rewrite the request into the expected format.
This is workable, but not ideal and adds unnecessary complexity.

Current limitation

The current behavior depends entirely on provider/auth inference, which means:

  • some forwarding endpoints may receive the wrong request format
  • users cannot explicitly control whether Codex formatting is used
  • using plugins/hooks is not a clean solution here, especially because there is no easy hook to remove max_output_tokens

Proposal

Introduce a new CFG configuration option that allows users to explicitly control whether Codex-compatible formatting should be used.

Suggested behavior

  • null / unset: keep the current automatic detection behavior
  • true: force Codex-compatible formatting
  • false: force standard formatting

Default

The default should remain null or false to minimize impact on existing users and preserve current behavior unless explicitly configured.

Expected benefits

  • supports Codex forwarding/proxy setups
  • supports custom user-owned gateways
  • gives users explicit control with minimal breaking changes

I believe this is a fairly common built-in scenario that many users may need. Any feedback, suggestions, or concerns are very welcome — please feel free to reply anytime.

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Mar 19, 2026
  2. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 19, 2026
  3. Blues-star commented on Mar 21, 2026

    @Blues-star
    Author

    I noticed a TODO comment in packages/opencode/src/session/llm.ts:

    // TODO: move this to a proper hook
    const isOpenaiOauth = provider.id === "openai" && auth?.type === "oauth"

    Does this imply that the implementation should be handled by a hook, or should it be controlled via the model configuration? This feature would be very useful for my use case, and I’m happy to help implement it if needed.

  4. PadishahIII commented on Apr 24, 2026

    @PadishahIII

    Hey guys, I implemented a first-class codex provider in my fork (https://github.com/PadishahIII/opencode) and I'm using my codex forwarding subscription in opencode pretty good. I've tested OmO and superpowers which works normally. I would like to turn my fork into a PR if maintainers are interested.

    My fork: https://github.com/PadishahIII/opencode
    About my private build: https://github.com/PadishahIII/opencode/blob/dev/docs/codex-private-build-guide.md

  5. removed
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  6. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions