Skip to content

[FEATURE]: support codex as a first-class provider (codex subscription rather than OpenAI api provider) #24134

Closed as not planned

Description

@PadishahIII

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

I would like OpenCode to support codex as a first-class provider for Codex-compatible Responses API endpoints. OpenCode already supports many providers through models.dev and generic SDK adapters. In this case, a models.dev entry alone is not enough because Codex-compatible gateways expect Codex CLI-style request construction, not only a model list:

  • POST <baseURL>/responses
  • top-level instructions and Responses API input
  • store: false by default
  • Codex compatibility headers such as x-client-request-id, x-codex-window-id, and installation metadata
  • Codex tool formats, especially apply_patch as a Responses API custom grammar tool

The goal is to let users configure a Codex-compatible API base and use models like:

opencode -m codex/gpt-5.4

without relying on provider-specific proxy hacks or MITM rewriting.

Proposed scope:

  • Add codex as a provider id available in auth/config flows.
  • Route codex/* models through a native Responses API transport.
  • Preserve configurable baseURL and API-key auth for user-specified Codex-compatible providers.
  • Translate OpenCode messages and tool calls to the Codex-compatible Responses protocol.
  • Add focused tests for provider loading, request construction, stream parsing, and tool-call handling.

I have a local proof of concept (here) that keeps the change focused on provider integration and includes tests, and I'm using my private build on codex subscription which works pretty good. If maintainers agree with this direction, I can open a PR linked to this issue.

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Apr 24, 2026
  2. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 24, 2026
  3. github-actions commented on Apr 24, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Please review the above issues and consider whether this request can be addressed there or linked, to avoid fragmentation of the discussion.

  4. changed the title [-][FEATURE]: support codex provider (codex subscription rather than OpenAI api provider)[/-] [+][FEATURE]: support codex as a first-class provider (codex subscription rather than OpenAI api provider)[/+] on Apr 24, 2026
  5. PadishahIII commented on Apr 24, 2026

    @PadishahIII
    Author

    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

  6. 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
  7. github-actions commented on Jul 4, 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