Repository navigation
Description
Client or integration
Codex CLI / OpenAI-compatible client
Provider or upstream service
ChatGPT/Codex OAuth upstream
OpenCodex version
2.10.0
Endpoint or capability
ChatGPT OAuth provider, /v1/responses, custom upstream routing, and account pooling
Current behaviour
The built-in ChatGPT OAuth provider appears to require the canonical upstream URL:
https://chatgpt.com/backend-api/codex
When a custom baseUrl is configured, the provider loses its canonical openai status and codexAccountMode: "pool" is rejected by configuration validation.
This prevents ChatGPT OAuth traffic from being routed through a local OpenAI-compatible gateway or reverse proxy, such as Headroom.
The openai-responses adapter already forwards the relevant OAuth headers, including Authorization, ChatGPT-Account-Id, and Codex-related headers.
Expected behaviour
The built-in ChatGPT OAuth provider should allow a custom HTTP(S) baseUrl while retaining its OAuth credential and account-pool behaviour.
For example:
{
"adapter": "openai-responses",
"baseUrl": "http://127.0.0.1:8787/v1",
"authMode": "forward",
"codexAccountMode": "pool"
}The OAuth credentials and headers could remain restricted to the built-in provider, while the upstream URL is configurable.
Minimal redacted request or reproduction
{
"providers": {
"openai": {
"adapter": "openai-responses",
"baseUrl": "http://127.0.0.1:8787/v1",
"authMode": "forward",
"codexAccountMode": "pool"
}
}
}No credentials are included. This configuration is rejected because the provider is no longer considered the canonical built-in openai provider.
Actual response or error
codexAccountMode is valid only on the canonical built-in openai provider
Upstream documentation
The relevant protocol behaviour is the ChatGPT/Codex OAuth Responses API. No public specification was found for requiring the canonical upstream URL when using OAuth headers.
Related Hermes Agent issue:
NousResearch/hermes-agent#40913
Suggested mapping or implementation notes
Consider decoupling the OAuth provider identity and credential handling from the upstream URL validation. The built-in provider could retain the special OAuth/account-pool logic while allowing an explicitly configured HTTP(S) upstream.
A similar GPT OAuth upstream-routing issue was reported in Hermes Agent, where the credential-pool path hardcoded the ChatGPT Codex upstream. Hermes has started addressing that issue by separating OAuth credential handling from upstream URL resolution.
Additional context and attachments
This does not appear to be documented or tracked in the current public OpenCodex issues. The goal is to route the existing OAuth request through an OpenAI-compatible local gateway, not to alter or expose OAuth credentials.
Checks
- I searched existing provider and compatibility issues.
- The request and response were redacted.
- The expected behaviour is based on a concrete client and gateway integration requirement.
Activity
github-actions commentedon Aug 6, 2026
Automated translation bookkeeping — detected language: unknown.
github-actions commentedon Aug 6, 2026
Issue reopened
The report now contains the information required by the automated check. Thanks for updating it.
lidge-jun commentedon Aug 6, 2026
This is a legitimate request and we want to support it; flagging why it is not a quick change. The pool-eligibility gate that rejects non-default base URLs (
src/config.tsprovider validation) is deliberate: OAuth tokens for chatgpt.com must not be sendable to an arbitrary URL by a config edit, so lifting the restriction needs an explicit trust design (allowlist semantics, SSRF/private-network policy, and tests for header and account-selection behavior against a custom upstream). Keeping this open as a design-needed enhancement.chris6621 commentedon Aug 6, 2026
Thank you for looking into this and for explaining the security concern.
I agree that OAuth credentials should not be sent to an arbitrary endpoint through an accidental configuration change. My use case is an explicitly configured, trusted local gateway (Headroom), not unrestricted forwarding to arbitrary URLs.
An allowlist or an explicit opt-in setting for custom OAuth upstreams would work well for this use case. I also agree that the OAuth headers, account-pool selection, and private-network/SSRF behavior should be covered by tests.
Thanks for keeping this open as a design-needed enhancement.
lidge-jun commentedon Aug 18, 2026
Closing on the security boundary discussed above. Pointing the ChatGPT OAuth provider at a custom upstream means sending OAuth credentials to a non-canonical endpoint, and a configuration-file field that can redirect credentials is exactly the shape of quiet exfiltration we hard-block elsewhere (the web-search sidecar keyed-backend design in #1616 fails closed on the same principle). An explicit allowlist/opt-in design was suggested, but the risk-to-benefit for a trusted-local-gateway use case does not justify opening that surface now — a local gateway can already sit in front of the proxy at the network layer without touching credential destinations. If a concrete design with a capability-gated, non-config-editable consent path materializes, reopen with that design.