Move Codex to a custom provider without confusing protocol and subscription
A practical custom-provider handover starts with the Responses contract, a matching model catalog and the right account boundary.
A custom provider can give a development team a consistent model endpoint, organizational credentials and a controlled network route. It can also introduce a difficult failure mode: the client opens, the model appears in a picker, and the first real coding task fails because the gateway implements a different conversation protocol. Successful setup requires agreement about the wire API, model metadata, authentication and the permissions of the client process.
This is a practical connection and handover method, not a claim that any particular third-party model works in Codex. The examples are illustrative configuration for a fictional organization. No account was connected, key supplied or request executed while preparing this article.
Start with the Responses contract
OpenAI's current Codex configuration reference lists `responses` as the supported `wire_api` value. A generic OpenAI-compatible Chat Completions endpoint is consequently not enough evidence of Codex compatibility. The gateway must support the client contract actually in use, including the response and tool events needed by the workflow. [The configuration reference](https://developers.openai.com/codex/config-reference/) is the authority for those fields, checked on 16 October 2026.
Ask the gateway operator for its supported Codex client versions, base URL including the API path, provider ID, model identifier and authentication mechanism. If a custom model alias needs a catalog, obtain the matching catalog and its documented location. A familiar-looking name is not permission to invent reasoning capabilities, context metadata or tool support for an unrelated model.
Keep product access and API access distinct
Codex documents ChatGPT sign-in and API-key sign-in as separate access paths. API-key usage follows the API account, whereas ChatGPT-authenticated usage follows the relevant workspace and plan controls. An external provider's credential belongs to that provider's contract. Buying a ChatGPT subscription does not automatically fund requests authenticated with an arbitrary provider key. [Codex authentication](https://developers.openai.com/codex/auth/) explains these boundaries.
There are now documented, authorized ChatGPT-plan integration flows for eligible participating applications. Their existence is not permission to extract a cached login token and send it to any proxy. Those integrations require their own supported scopes and request contract. Keep this distinction visible in an onboarding note: “Sign in with ChatGPT” can be an identity flow, an authorized plan-usage flow, or part of a managed Codex route; it is not a universal API credit transfer. [The official sign-in quickstart](https://developers.openai.com/siwc/quickstart) describes that separation.
Merge a minimal provider definition
1. Identify the actual client: terminal, IDE extension or desktop app. Record its version and whether management policy already supplies configuration. For a CLI pilot, the official guide recommends `codex doctor` and checking `/status` after startup. 2. Locate the applicable configuration. The official gateway guide names `~/.codex/config.toml` on macOS/Linux and `%USERPROFILE%\.codex\config.toml` on Windows. 3. Preserve existing settings securely and merge the supplied provider definition. Do not create duplicate TOML keys or tables. 4. Keep top-level model settings before the first table. A key placed after a table header belongs to that table, which can change its meaning. 5. Make the scoped credential available through the approved environment or credential helper. Do not store its value in the repository. 6. Restart the client process and inspect the selected provider and model before sending source files.
A configuration sketch might use `model_provider = "review-gateway"`, then `[model_providers.review-gateway]` with an approved `base_url`, `wire_api = "responses"` and `env_key = "TEAM_CODEX_KEY"`. The model value must be supplied by the operator; the variable name is an example, not a key. [Use API/provider credentials through a gateway](https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway) provides the full current procedure, including desktop process-environment differences.
Why a desktop restart matters
An environment variable assigned in one terminal is not automatically visible to an application already running from the desktop. Repeatedly editing the URL will not repair that process boundary. The official instructions distinguish Windows and macOS app setup from the CLI and explain command-backed authentication. Use one documented mechanism and verify which process receives it.
For a team rollout, ask the gateway owner to supply a safe support reference rather than asking developers to reveal their tokens. Separate “credential unavailable to this process” from “provider refused this model” and “Responses streaming failed.” Those diagnoses imply different fixes. Increasing retries or switching to an unrelated account can obscure the original problem and create a different data route.
Use a repository task that proves more than fluent text
Consider a fictional library that converts invoice dates to an internal format. Put a tiny, noncustomer fixture and its expected output in an owned repository copy. Ask Codex to identify the date parser and explain its behavior without editing anything. Verify the referenced lines yourself.
Then authorize a focused test for an ambiguous date, leaving the production parser unchanged. Review the tool request and the diff. Finally, permit the repository's existing narrow test command and compare the command's exit state with the assistant's explanation. The acceptance record should separate transport success, correct file selection, permitted tool execution and a valid test result.
This makes a concrete compatibility check without inventing a benchmark. The model might misunderstand the date convention even when the gateway works perfectly. Conversely, a correct plan followed by a missing tool-result event points to an integration problem rather than a weak prompt. A single task cannot establish every tool, image input, compaction or long-running behavior, so record those as untested capabilities.
Test interruption before expanding access
Ask the operator how to handle a dropped response after an edit or command. The safe operational response is to inspect the resulting repository and running task before repeating a consequential request. A missing final message does not prove that nothing happened. Your acceptance procedure should make this uncertainty visible rather than report every connection loss as a clean failure.
Codex permissions and sandbox controls remain relevant when inference moves elsewhere. A different endpoint should not silently grant broader shell or network access. Review the [official security documentation](https://developers.openai.com/codex/security) with the organization's repository and data policy, and use the smallest workspace needed for the pilot.
Finish with a reproducible connection record
Record the installed client version, approved configuration source, provider ID, model/catalog pairing, credential owner and small-task observations. Retain no secret value. Note which client surfaces were actually exercised: terminal proof is not desktop proof, and local client proof is not cloud-task support.
Before general use, review current provider terms and the official pricing pages rather than copying a rate into a durable guide. Open-source client code, an available model picker and a commercial API entitlement are three different things. The useful outcome is a documented route that the team can explain and recover, with a testable boundary between client, gateway, model and repository authority.
Explanatory diagram and accessible reading guide

*Original explanatory infographic for “Move Codex to a custom provider without confusing protocol and subscription”. Documentation checked 16 October 2026. Fictional exercise; no connected account, completed request or observed result.*
[Open the full-size explanatory diagram](/assets/practical-ai-codex-responses-20261016.svg)
This original diagram explains documented boundaries and a fictional exercise that has not been run. It is not an authentic product screenshot, a connected account or a successful request.
Bind the provider; scope the tools
Codex needs a matching Responses contract, identity and model record.
Provider + model
Keep provider ID and model catalog consistent.
Credential owner
Choose an authorized access route; keep values private.
Codex process
Confirm version, active provider and process environment.
Responses gateway
Support the actual response and tool-event contract.
Owned repository
Local file and command permissions remain scoped.
A Chat Completions URL or model-picker label does not establish Responses compatibility or API funding.
Fictional invoice-date parser: inspect source, authorize one ambiguous-date test, then review the command and diff. Not run.
Solid arrows: documented route or stated task relationship. Dashed arrows: separately scoped permissions or proposed records. All paths are explanatory; no request or test ran.
Sources: O_REF, O_GATE, O_AUTH, O_SIGNIN, O_SECURITY. Full links and reading guide accompany this figure.
Provider + model → Codex process: The configured provider ID and model/catalog inform the client.
Credential owner → Codex process: The approved authentication mechanism is available to this process.
Codex process → Responses gateway: The client sends the documented Responses protocol to the selected gateway.
Codex process → Owned repository: A separate permission boundary governs local repository tools. This is not a gateway-to-files link.
The provider/model input and credential input converge on one client process. The solid downward edge is the inference route; the dashed side route is local tool authority. Neither edge asserts a completed request. ChatGPT sign-in, provider API credentials and eligible authorized plan-use integrations have distinct contracts; a subscription is not universal funding for arbitrary keys.
Use an owned repository copy and invented invoice-date fixtures. Keep the production parser unchanged during the first test-only task. Separate transport, correct file selection, permitted tool execution and the actual test result. Inspect repository state before retrying an interrupted edit.
Diagram source references
- [O_REF: Codex configuration reference](https://developers.openai.com/codex/config-reference/) — OpenAI.
- [O_GATE: Use API/provider credentials through a gateway](https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway) — OpenAI.
- [O_AUTH: Codex authentication](https://developers.openai.com/codex/auth/) — OpenAI.
- [O_SIGNIN: Sign in with ChatGPT quickstart](https://developers.openai.com/siwc/quickstart) — OpenAI.
- [O_SECURITY: Codex security](https://developers.openai.com/codex/security) — OpenAI.