Feature 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.
Feature hasn't been suggested before.
Describe the enhancement you want to request
I would like OpenCode to support
codexas a first-class provider for Codex-compatible Responses API endpoints. OpenCode already supports many providers throughmodels.devand generic SDK adapters. In this case, amodels.deventry alone is not enough because Codex-compatible gateways expect Codex CLI-style request construction, not only a model list:POST <baseURL>/responsesinstructionsand Responses APIinputstore: falseby defaultx-client-request-id,x-codex-window-id, and installation metadataapply_patchas a Responses API custom grammar toolThe goal is to let users configure a Codex-compatible API base and use models like:
without relying on provider-specific proxy hacks or MITM rewriting.
Proposed scope:
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.