You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Add an explicit config option to force Codex-compatible request formatting #18203
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.
I noticed a TODO comment in packages/opencode/src/session/llm.ts:
// TODO: move this to a proper hookconstisOpenaiOauth=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.
Activity
Blues-star commentedon Mar 21, 2026
I noticed a TODO comment in
packages/opencode/src/session/llm.ts: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.
PadishahIII commentedon Apr 24, 2026
Hey guys, I implemented a first-class
codexprovider 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
@ai-sdk/openaiprovider with Codex/Responses-compatible baseURL fails with `Instructions are required #27314 as a duplicate of this issuegithub-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.