SpyBara
Go Premium

Documentation 2026-09-29 22:59 UTC to 2026-09-30 23:01 UTC

11 files changed +903 −26. View all changes and history on the product overview
2026
Wed 30 23:01 Tue 29 22:59 Sun 27 23:59 Fri 25 23:02 Thu 24 23:02 Wed 23 23:58 Tue 22 23:00 Sat 19 23:02 Fri 18 22:59 Thu 17 10:05 Wed 16 20:58 Tue 15 21:01 Mon 14 20:57 Sun 13 21:58 Fri 11 20:00 Thu 10 16:58 Wed 9 21:01 Fri 4 19:59 Thu 3 23:00 Wed 2 22:59 Tue 1 07:57
Details

186 href: "/codex/amazon-bedrock",186 href: "/codex/amazon-bedrock",

187 icon: "storage",187 icon: "storage",

188 },188 },

189 {

190 title: "Connect to a gateway",

191 description:

192 "Configure one Codex client to use your organization's model gateway and verify the connection.",

193 href: "/codex/enterprise/connect-to-a-gateway",

194 icon: "connect",

195 },

196 {

197 title: "Deploy Codex through a gateway",

198 description:

199 "Configure model routes, issue credentials, and deploy Codex through your organization’s gateway.",

200 href: "/codex/enterprise/roll-out-a-gateway",

201 icon: "settings",

202 },

203 {

204 title: "Gateway compatibility",

205 description:

206 "Check the Responses API behavior required for model requests, streaming, and tool calls.",

207 href: "/codex/enterprise/gateway-compatibility",

208 icon: "code",

209 },

210 {

211 title: "Bedrock through LiteLLM",

212 description:

213 "Configure a LiteLLM gateway to route Codex model requests to Amazon Bedrock.",

214 href: "/codex/enterprise/bedrock-through-litellm",

215 icon: "storage",

216 },

189 ],217 ],

190 },218 },

191 {219 {

amazon-bedrock.md +60 −22

Details

6through Amazon Bedrock. In this setup, the local client sends model requests to6through Amazon Bedrock. In this setup, the local client sends model requests to

7Bedrock using AWS-managed authentication and access controls.7Bedrock using AWS-managed authentication and access controls.

8 8 

9This page covers direct access to Bedrock. If your organization already

10 provides a model gateway, follow [Connect to a

11 gateway](https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway). To configure a gateway

12 backed by Bedrock, see [Bedrock through

13 LiteLLM](https://learn.chatgpt.com/docs/enterprise/bedrock-through-litellm).

14 

9## How it works15## How it works

10 16 

11When you configure a local ChatGPT Work or Codex surface with Amazon Bedrock as17When you configure a local ChatGPT Work or Codex surface with Amazon Bedrock as


21 27 

22Make sure you have:28Make sure you have:

23 29 

24- Credentials for the AWS account you want to use30- Credentials for the AWS account you want to use.

25- Access to supported OpenAI models in Amazon Bedrock.31- Access to supported OpenAI models in Amazon Bedrock.

26- Access to an AWS Region where the selected model is available.32- Access to an AWS Region where the selected model is available.

33- AWS permission to invoke the selected model or inference profile.

34 

35Check the model-specific IAM requirements. For example, GPT-6 Sol through Runtime

36also requires `bedrock:InvokeModel` on the account's default project. See AWS's [GPT-6 Sol setup instructions](https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-openai-gpt-6-sol.html).

27 37 

28## Configure the provider38## Configure the provider

29 39 


32Choose the provider for the Amazon Bedrock endpoint you want to use: Bedrock42Choose the provider for the Amazon Bedrock endpoint you want to use: Bedrock

33Runtime for cross-Region inference (CRIS), or Bedrock Mantle for in-Region inference.43Runtime for cross-Region inference (CRIS), or Bedrock Mantle for in-Region inference.

34 44 

35For the Bedrock Runtime endpoint:45Use Bedrock Runtime for new configurations:

36 46 

37```toml47```toml

38model_provider = "amazon-bedrock-runtime"48model_provider = "amazon-bedrock-runtime"

49web_search = "disabled"

39```50```

40 51 

52Hosted web search isn't available on Bedrock Runtime. If you need it, use

53 [Bedrock Mantle](#use-mantle-for-hosted-web-search). The `amazon-bedrock`

54 provider selects Mantle; `amazon-bedrock-runtime` selects Runtime.

55 

56### Use Mantle for hosted web search

57 

41For the Bedrock Mantle endpoint:58For the Bedrock Mantle endpoint:

42 59 

43```toml60```toml

44model_provider = "amazon-bedrock"61model_provider = "amazon-bedrock"

62web_search = "cached"

45```63```

46 64 

47### Choose a model65### Choose a model


52`amazon-bedrock`.70`amazon-bedrock`.

53 71 

54You can optionally specify a [supported model](#supported-models) in the72You can optionally specify a [supported model](#supported-models) in the

55configuration file.73configuration file. The built-in provider supplies its own model catalog.

74When switching endpoints, change the provider and any explicit model ID together.

56 75 

57Model availability varies by AWS Region. Refer to AWS [Regional availability by models](https://docs.aws.amazon.com/bedrock/latest/userguide/models-region-compatibility.html#model-regions-openai). Local ChatGPT Work and Codex surfaces don't support Bedrock Mantle endpoints in AWS GovCloud Regions.76Model availability varies by AWS Region. Refer to AWS [Regional availability by models](https://docs.aws.amazon.com/bedrock/latest/userguide/models-region-compatibility.html#model-regions-openai).

58 77 

59## Authentication options78## Authentication options

60 79 


74export AWS_REGION=us-east-293export AWS_REGION=us-east-2

75```94```

76 95 

96On Windows PowerShell:

97 

98```powershell

99$env:AWS_BEARER_TOKEN_BEDROCK = "<your-bedrock-api-key>"

100$env:AWS_REGION = "us-east-2"

101```

102 

77### Option 2: AWS SDK credentials103### Option 2: AWS SDK credentials

78 104 

79Use this path when your organization manages Bedrock access through the AWS SDK105Use this path when your organization manages Bedrock access through the AWS SDK


126 152 

127Desktop apps and IDE extensions may not inherit environment variables from the153Desktop apps and IDE extensions may not inherit environment variables from the

128shell. Put required values in `~/.codex/.env`, then restart the app or154shell. Put required values in `~/.codex/.env`, then restart the app or

129extension.155extension. On Windows, the default path is `%USERPROFILE%\.codex\.env`.

130 156 

131```shell157```shell

132export AWS_BEARER_TOKEN_BEDROCK=<your-bedrock-api-key>158export AWS_BEARER_TOKEN_BEDROCK=<your-bedrock-api-key>


144- Confirm the selected model is available in the configured AWS Region and that170- Confirm the selected model is available in the configured AWS Region and that

145 the AWS identity has permission to access it.171 the AWS identity has permission to access it.

146 172 

173Then send a short prompt in a new task:

174 

175```text

176Reply with exactly: bedrock-ok

177```

178 

179Expect `bedrock-ok`. Confirm the provider and model in the client; the reply alone

180doesn't identify the route. For rollout qualification, use a disposable folder

181with read-only permissions and verify a harmless local tool task and a follow-up

182turn.

183 

147## Supported models184## Supported models

148 185 

149Use an inference profile ID for Bedrock Runtime provider or a model ID for Bedrock Mantle provider.186Use an inference profile ID for Bedrock Runtime provider or a model ID for Bedrock Mantle provider.


154 191 

155Global CRIS can route requests to supported192Global CRIS can route requests to supported

156commercial AWS Regions worldwide, whereas Geo CRIS routes requests within the profile's geography.193commercial AWS Regions worldwide, whereas Geo CRIS routes requests within the profile's geography.

194Choose a routing scope that meets your AWS permissions and data-residency requirements.

157 195 

158Use `model_provider = "amazon-bedrock-runtime"` with the optional `model` configuration set to an inference profile ID from the following lists. The provider uses196Use `model_provider = "amazon-bedrock-runtime"` with the optional `model` configuration set to an inference profile ID from the following lists. The provider uses

159`https://bedrock-runtime.{region}.amazonaws.com/openai/v1`, where `{region}` is197`https://bedrock-runtime.{region}.amazonaws.com/openai/v1`, where `{region}` is


166- GPT-6 Astra: `global.openai.gpt-6-astra`204- GPT-6 Astra: `global.openai.gpt-6-astra`

167- GPT-6 Sol: `global.openai.gpt-6-sol`205- GPT-6 Sol: `global.openai.gpt-6-sol`

168- GPT-6 Luna: `global.openai.gpt-6-luna`206- GPT-6 Luna: `global.openai.gpt-6-luna`

169- GPT-5.6 Sol: `global.openai.gpt-5.6-sol`

170- GPT-5.6 Terra: `global.openai.gpt-5.6-terra`

171- GPT-5.6 Luna: `global.openai.gpt-5.6-luna`

172 207 

173For example, configure Astra with Global CRIS in `~/.codex/config.toml`:208For example, configure Astra with Global CRIS in `~/.codex/config.toml`:

174 209 


184- GPT-6 Astra: `us.openai.gpt-6-astra`219- GPT-6 Astra: `us.openai.gpt-6-astra`

185- GPT-6 Sol: `us.openai.gpt-6-sol`220- GPT-6 Sol: `us.openai.gpt-6-sol`

186- GPT-6 Luna: `us.openai.gpt-6-luna`221- GPT-6 Luna: `us.openai.gpt-6-luna`

187- GPT-5.6 Sol: `us.openai.gpt-5.6-sol`

188- GPT-5.6 Terra: `us.openai.gpt-5.6-terra`

189- GPT-5.6 Luna: `us.openai.gpt-5.6-luna`

190 222 

191Codex's built-in Runtime model picker lists the United States Geo and Global223Codex's built-in Runtime model picker lists the United States Geo and Global

192variants. AWS also lists India geographic inference profile IDs `in.openai.gpt-5.6-terra` and224variants.

193`in.openai.gpt-5.6-luna` for `ap-south-1` (Mumbai) and `ap-south-2` (Hyderabad). Refer to Bedrock model cards for [GPT-5.6 Terra](https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-openai-gpt-56-terra.html) and [GPT-5.6 Luna](https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-openai-gpt-56-luna.html) for details.

194 225 

195Model and CRIS availability vary by source AWS Region. See AWS [Supported Regions and models for inference profiles](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html), which links to each model's exact inference profile IDs and regional226Model and CRIS availability vary by source AWS Region. See AWS [Supported Regions and models for inference profiles](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html), which links to each model's exact inference profile IDs and regional

196availability, and AWS [Regional availability by models](https://docs.aws.amazon.com/bedrock/latest/userguide/models-region-compatibility.html#model-regions-openai) before selecting a provider and a model.227availability, and AWS [Regional availability by models](https://docs.aws.amazon.com/bedrock/latest/userguide/models-region-compatibility.html#model-regions-openai) before selecting a provider and a model.


205- GPT-6 Astra: `openai.gpt-6-astra`236- GPT-6 Astra: `openai.gpt-6-astra`

206- GPT-6 Sol: `openai.gpt-6-sol`237- GPT-6 Sol: `openai.gpt-6-sol`

207- GPT-6 Luna: `openai.gpt-6-luna`238- GPT-6 Luna: `openai.gpt-6-luna`

208- GPT-5.6 Sol: `openai.gpt-5.6-sol`

209- GPT-5.6 Terra: `openai.gpt-5.6-terra`

210- GPT-5.6 Luna: `openai.gpt-5.6-luna`

211- GPT-5.5: `openai.gpt-5.5`

212- GPT-5.4: `openai.gpt-5.4`

213 239 

214GPT-6 Sol and Luna are available through Mantle in `us-east-1` (N. Virginia).240GPT-6 Sol and Luna are available through Mantle in `us-east-1` (N. Virginia).

215Model availability varies by AWS Region. See AWS [Regional availability by models](https://docs.aws.amazon.com/bedrock/latest/userguide/models-region-compatibility.html#model-regions-openai) before selecting a provider and a model. For GPT-6 Astra, refer to the [Bedrock model page for GPT-6 Astra](https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-openai-gpt-6-astra.html).241Model availability varies by AWS Region. See AWS [Regional availability by models](https://docs.aws.amazon.com/bedrock/latest/userguide/models-region-compatibility.html#model-regions-openai) before selecting a provider and a model. For GPT-6 Astra, refer to the [Bedrock model page for GPT-6 Astra](https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-openai-gpt-6-astra.html).


218 244 

219This configuration supports local ChatGPT Work and Codex workflows. Hosted245This configuration supports local ChatGPT Work and Codex workflows. Hosted

220ChatGPT Work on the web, Codex cloud, and features that depend on OpenAI-hosted246ChatGPT Work on the web, Codex cloud, and features that depend on OpenAI-hosted

221cloud services, hosted tools, or cloud-managed discovery aren't currently247cloud services or cloud-managed discovery aren't currently

222available.248available. Hosted web search is unavailable on Runtime; use

249[Mantle](#use-mantle-for-hosted-web-search) if you need it.

250 

251Codex Security CLI uses its own provider configuration. Follow its

252[Amazon Bedrock setup](https://learn.chatgpt.com/docs/security/cli/reference) rather than the native

253client settings above.

223 254 

224Fast Mode isn't available with Amazon Bedrock. Fast Mode uses priority255Fast Mode isn't available with Amazon Bedrock. Fast Mode uses priority

225 processing, and the initial Amazon Bedrock offering supports on-demand256 processing, and the initial Amazon Bedrock offering supports on-demand


326 },357 },

327 },358 },

328 {359 {

329 name: "Web search",360 name: "Hosted web search on Runtime",

330 href: "/codex/web-search?surface=app",361 href: "/codex/web-search?surface=app",

331 availability: {362 availability: {

332 bedrock: "unavailable",363 bedrock: "unavailable",


680 className="not-prose mt-3 text-sm text-secondary"711 className="not-prose mt-3 text-sm text-secondary"

681 >712 >

682 <sup>*</sup> Feature is currently limited to only specific regions. Check713 <sup>*</sup> Feature is currently limited to only specific regions. Check

683 the individual feature documentation to learn more about geo restrictions.714 the individual feature documentation to learn more about regional restrictions.

684 715

685 716 

686 <div717 <div


708- For desktop app or IDE extension usage, required environment variables are739- For desktop app or IDE extension usage, required environment variables are

709 present in `~/.codex/.env`.740 present in `~/.codex/.env`.

710 741 

742For AWS SDK profile authentication, run `aws sts get-caller-identity --profile codex-bedrock`

743to confirm the identity for your selected profile. Replace `codex-bedrock` with

744your profile name, or omit `--profile` when using the default credential chain.

745This checks AWS identity, not permission to invoke a Bedrock model. Check

746`AWS_BEARER_TOKEN_BEDROCK` separately so an unintended API key doesn't select a

747different authentication path.

748 

711## Support boundaries749## Support boundaries

712 750 

713OpenAI Support can help with ChatGPT Work and Codex client setup,751OpenAI Support can help with ChatGPT Work and Codex client setup,

auth.md +5 −0

Details

2 2 

3> For the complete documentation index, see [llms.txt](https://learn.chatgpt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.3> For the complete documentation index, see [llms.txt](https://learn.chatgpt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.

4 4 

5For a local client using an organization-provided model gateway, follow

6[Connect to a gateway](https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway) for the gateway

7credential and provider configuration. Direct Bedrock access uses the

8[Amazon Bedrock authentication options](https://learn.chatgpt.com/docs/amazon-bedrock#authentication-options).

9 

5## OpenAI authentication10## OpenAI authentication

6 11 

7<a id="sign-in-with-chatgpt"></a>12<a id="sign-in-with-chatgpt"></a>

Details

179 179 

180## Custom model providers180## Custom model providers

181 181 

182If your organization provides a model gateway, follow

183[Connect to a gateway](https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway) for client setup

184and verification. For organization-wide deployment, see

185[Deploy Codex through a gateway](https://learn.chatgpt.com/docs/enterprise/roll-out-a-gateway).

186 

182A model provider defines how Codex connects to a model (base URL, wire API, authentication, and optional HTTP headers). Custom providers can't reuse the reserved built-in provider IDs: `openai`, `ollama`, and `lmstudio`.187A model provider defines how Codex connects to a model (base URL, wire API, authentication, and optional HTTP headers). Custom providers can't reuse the reserved built-in provider IDs: `openai`, `ollama`, and `lmstudio`.

183 188 

184Define more providers and point `model_provider` at them:189Define more providers and point `model_provider` at them:

Details

179 179 

180## Custom model providers180## Custom model providers

181 181 

182If your organization provides a model gateway, follow

183[Connect to a gateway](https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway) for client setup

184and verification. For organization-wide deployment, see

185[Deploy Codex through a gateway](https://learn.chatgpt.com/docs/enterprise/roll-out-a-gateway).

186 

182A model provider defines how Codex connects to a model (base URL, wire API, authentication, and optional HTTP headers). Custom providers can't reuse the reserved built-in provider IDs: `openai`, `ollama`, and `lmstudio`.187A model provider defines how Codex connects to a model (base URL, wire API, authentication, and optional HTTP headers). Custom providers can't reuse the reserved built-in provider IDs: `openai`, `ollama`, and `lmstudio`.

183 188 

184Define more providers and point `model_provider` at them:189Define more providers and point `model_provider` at them:

Details

16Complete the steps in order for a new rollout, or use the linked pages to change16Complete the steps in order for a new rollout, or use the linked pages to change

17one boundary.17one boundary.

18 18 

19If you manage a model gateway for local Codex clients, use

20[Deploy Codex through a gateway](https://learn.chatgpt.com/docs/enterprise/roll-out-a-gateway) for gateway

21qualification, credential distribution, and the client handoff. Configure

22workspace access separately where your deployment uses workspace features.

23 

19In workspace settings, **Codex and Work Local** combines local Codex and Work24In workspace settings, **Codex and Work Local** combines local Codex and Work

20access under **Allow members to use Codex and Work Locally**. Some workspaces25access under **Allow members to use Codex and Work Locally**. Some workspaces

21instead provide independent **Codex Local** and **Work Local** sections. In26instead provide independent **Codex Local** and **Work Local** sections. In

Details

1# Bedrock through LiteLLM

2 

3> For the complete documentation index, see [llms.txt](https://learn.chatgpt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.

4 

5Use this page when your organization routes Codex to Amazon Bedrock through

6LiteLLM. If a LiteLLM gateway already exists, connect Codex first. Deploy LiteLLM

7only when your organization needs a new gateway.

8 

9To use an existing gateway, start with [Connect to an existing

10 gateway](#connect-to-an-existing-gateway). To deploy LiteLLM on AWS, start

11 with [Prepare a gateway](#prepare-a-gateway). For access without a gateway,

12 see [Amazon Bedrock](https://learn.chatgpt.com/docs/amazon-bedrock).

13 

14Other gateway products follow the same [gateway requirements](https://learn.chatgpt.com/docs/enterprise/gateway-compatibility)

15and [Codex connection flow](https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway).

16 

17## Connect to an existing gateway

18 

19Get these values from your gateway administrator:

20 

21- The HTTPS base URL, such as `https://gateway.example.com/v1`.

22- The model alias that LiteLLM routes to an approved Bedrock model.

23- The provider ID to use in Codex configuration.

24- A scoped gateway credential or an authentication helper that returns it.

25- Any model catalog distributed with your organization's configuration.

26 

27Then complete the connection in this order:

28 

291. Ask your gateway team to confirm that the gateway serves `POST /v1/responses`,

30 streams responses, preserves follow-up turns and tool calls, and routes the

31 approved alias. See [Gateway compatibility](https://learn.chatgpt.com/docs/enterprise/gateway-compatibility).

322. Follow [Connect to a gateway](https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway#configure-the-provider)

33 to configure the provider, model, and credential.

343. Verify the active provider and alias, send the short `gateway-ok` prompt from

35 the connection guide, and confirm that the LiteLLM record shows the expected

36 user and alias.

374. For organization-wide distribution, continue with [Deploy Codex through a gateway](https://learn.chatgpt.com/docs/enterprise/roll-out-a-gateway).

38 

39Your gateway credential authenticates you to LiteLLM. The gateway manages its own Bedrock credentials; you don't need to copy those credentials to your workstation.

40 

41## Prepare a gateway

42 

43Use this section only when you need to create a LiteLLM gateway before connecting

44Codex.

45 

46### Before you deploy

47 

48Confirm that you have:

49 

50- Permission to deploy the approved LiteLLM architecture in your AWS environment.

51- Bedrock access to the models or inference profiles you will route.

52- A reviewed LiteLLM image and deployment pattern.

53- A trusted HTTPS host name and certificate.

54- A restricted client network range.

55 

56For the Runtime example below, the gateway's AWS identity needs `bedrock:InvokeModel` for the selected inference profile and the account's default project. See AWS's [GPT-6 Sol setup instructions](https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-openai-gpt-6-sol.html) for the required permissions.

57 

58### Architecture

59 

60The deployment keeps LiteLLM between Codex and Bedrock, with HTTPS at the client

61boundary. The load balancer and LiteLLM are inside your organization's gateway

62boundary; the provider credential stays on the gateway.

63 

64![Codex sends Responses API requests with a scoped gateway credential through an HTTPS load balancer to LiteLLM. LiteLLM routes the approved alias to Amazon Bedrock while the provider credential stays server-side.](https://developers.openai.com/images/codex/gateways/litellm-bedrock-architecture.svg)

65 

66Restrict inbound access to approved clients, keep database and cache ports private, and grant the gateway only the Bedrock permissions it needs. Pin the deployed image by digest so that a restart doesn't silently change the implementation.

67 

68Prompts, source excerpts, and tool results pass through the gateway and may enter its logs. Decide retention, access, and redaction before enabling request logging. MCP servers and plugins have separate connections and authentication; this gateway configuration doesn't configure them.

69 

70### Deployment checkpoints

71 

72Complete these checkpoints in order before handing the gateway to developers:

73 

74| Checkpoint | Output |

75| -------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |

76| Deploy the proxy with private database and cache dependencies. | A stable HTTPS base URL ending in `/v1`, with gateway-managed Bedrock authentication. |

77| Configure a model route and its matching client catalog. | A stable Codex-facing alias mapped to the intended Bedrock target. |

78| Verify Responses support. | A streamed `POST /v1/responses` response ending with `response.completed`. |

79| Issue a test credential. | A per-user virtual key restricted to the alias, with expiration, budget, and rate limits. |

80| Connect one developer. | Codex provider configuration and a verified short prompt through the gateway. |

81 

82The sections below cover each checkpoint. For production rollout, also test

83follow-up turns, tools, and credential revocation.

84 

85### Choose the Bedrock route

86 

87The LiteLLM upstream route determines the Bedrock endpoint, model identifier, and authentication method. Keep these choices together when you deploy or change the gateway.

88 

89Use Bedrock Runtime for new configurations. The example below uses its OpenAI-compatible Responses endpoint.

90 

91Hosted web search isn't available on Bedrock Runtime. If you need it, use

92 Mantle and confirm that your gateway preserves the tool request and response.

93 

94See LiteLLM's [Bedrock Mantle integration](https://docs.litellm.ai/docs/providers/bedrock_mantle) for the alternative route.

95 

96For an AWS deployment example, use the pinned [LiteLLM on ECS reference](https://github.com/openai-on-aws/guidance-codex/blob/eb04fe0/docs/QUICKSTART_LLM_GATEWAY_LITELLM.md). That implementation uses Bedrock Runtime and refreshes authentication from the ECS task role. Follow its deployment and authentication steps together, and review its production requirements against your networking, TLS, logging, and resource-retention policies.

97 

98Whichever route you choose, verify the deployed combination of gateway version, upstream endpoint, and model against [Gateway compatibility](https://learn.chatgpt.com/docs/enterprise/gateway-compatibility). An upstream model appearing in the gateway's model list doesn't establish that its streaming, continuation, and tool behavior work with Codex.

99 

100### Configure a Runtime model route

101 

102Map a stable Codex-facing alias to the approved upstream model. Confirm access in your AWS account and Region before using this Runtime example.

103 

104```yaml

105model_list:

106 - model_name: company-coding-model

107 litellm_params:

108 model: openai/global.openai.gpt-6-sol

109 api_key: os.environ/AWS_BEARER_TOKEN_BEDROCK

110 api_base: https://bedrock-runtime.us-east-1.amazonaws.com/openai/v1

111```

112 

113Supply a valid Bedrock API key as `AWS_BEARER_TOKEN_BEDROCK` through your secret-management system. For a short-lived key, issue a replacement before it expires, update the gateway process environment, and restart or redeploy the workers that use it. The ECS reference instead refreshes credentials in-process from its task role; use its configuration and entrypoint together.

114 

115The `openai/` prefix selects LiteLLM's OpenAI-compatible adapter; the configured `api_base` sends requests to Bedrock Runtime. The Global inference profile can route requests outside the source Region. Choose a profile and Region that meet your AWS permissions and data-residency requirements, and replace both values as needed.

116 

117The client sends `company-coding-model`; LiteLLM uses the configured upstream route. This custom alias requires the matching client catalog described next. A generic gateway does not inherit the built-in Bedrock provider's metadata adjustments.

118 

119### Prepare the client catalog

120 

121For this GPT-6 Sol/Runtime example with Codex 0.158.0, start with the complete `gpt-6-sol` entry from that version's [model catalog](https://github.com/openai/codex/blob/rust-v0.158.0/codex-rs/models-manager/models.json). Apply all of these edits to that entry:

122 

123| Field | Required edit |

124| ---------------------------- | ----------------------------------------------------------------------- |

125| `slug` | Set to `"company-coding-model"`, matching the LiteLLM alias. |

126| `visibility` | Set to `"list"`. |

127| `availability_nux` | Set to `null`. |

128| `upgrade` | Set to `null`. |

129| `use_responses_lite` | Set to `false`. |

130| `tool_mode` | Set to `null`. |

131| `supported_reasoning_levels` | Remove the entry whose `effort` is `"ultra"`; retain the other entries. |

132| `additional_speed_tiers` | Set to `[]`. |

133| `service_tiers` | Set to `[]`. |

134| `default_service_tier` | Set to `null`. |

135| `web_search_tool_type` | Set to `"text"`. |

136| `multi_agent_version` | Set to `"v1"`. |

137| `supports_search_tool` | Set to `false` for Runtime. |

138 

139Preserve the remaining fields, including the model's instructions and context limits. Keep the edited entry in the catalog's top-level `models` array. These changes mirror the released [Bedrock metadata adjustments](https://github.com/openai/codex/blob/rust-v0.158.0/codex-rs/model-provider/src/amazon_bedrock/catalog.rs) and [Runtime search restriction](https://github.com/openai/codex/blob/rust-v0.158.0/codex-rs/model-provider/src/amazon_bedrock/runtime_catalog.rs). Recheck them against the matching source when changing the client version or upstream model.

140 

141Distribute the complete JSON file and configure `model_catalog_json` using [Deploy Codex through a gateway](https://learn.chatgpt.com/docs/enterprise/roll-out-a-gateway#supply-metadata-for-a-custom-alias). Keep `web_search = "disabled"` in the Runtime client configuration. Verify the edited catalog through the gateway before distributing it to more users.

142 

143### Verify Responses support

144 

145Expose `POST /v1/responses` at the client-facing HTTPS endpoint. Configure the load balancer and any reverse proxy to pass streaming events without buffering. Preserve follow-up turns and function-call results. A working Chat Completions endpoint alone isn't sufficient for this connection.

146 

147Complete the checks in [Gateway compatibility](https://learn.chatgpt.com/docs/enterprise/gateway-compatibility) before distributing client configuration. Test through the same host name, network controls, and authentication path your users will use.

148 

149### Issue a test credential

150 

151Create a scoped LiteLLM virtual key for one test user. Restrict it to the approved alias and configure expiration, rate limits, and a budget. See LiteLLM's [virtual-key documentation](https://docs.litellm.ai/docs/proxy/virtual_keys) for the applicable controls.

152 

153Distribute the key through your secret-management process or an authentication helper. Don't give users the LiteLLM administrative key or embed gateway credentials in `config.toml`.

154 

155### Verify the user connection

156 

157Complete these checks before expanding access:

158 

1591. Confirm that the HTTPS certificate matches the gateway host name and the service is healthy.

1602. Connect one user through [Connect to a gateway](https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway).

1613. Run a short prompt, a follow-up turn, and a read-only tool task.

1624. Confirm that gateway records show the expected identity, alias, and upstream route without exposing credentials or sensitive prompt content.

1635. Test credential expiration or revocation and confirm that unauthorized model aliases are rejected.

164 

165Keep the deployed image version, route configuration, and test results with your rollout record. Continue with [Deploy Codex through a gateway](https://learn.chatgpt.com/docs/enterprise/roll-out-a-gateway) for team distribution and ongoing operations.

166 

167## Troubleshoot the connection

168 

169Use the failing layer to narrow the problem:

170 

171| Symptom | What to check |

172| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

173| HTTPS fails before inference | DNS, certificate host name, load-balancer health, and allowed client networks. |

174| Gateway returns `401` or `403` | Distinguish a rejected user credential from an upstream Bedrock authentication or permission failure using gateway logs. |

175| Requested model isn't found | Confirm the exact client-facing alias and its upstream model or inference-profile mapping. |

176| Request is blocked before reaching LiteLLM | Check load-balancer and web application firewall logs, including request-body limits. Preserve your security controls while testing representative Codex requests. |

177| Text works, but a turn doesn't finish | Check streaming buffers, timeouts, terminal events, and the follow-up and tool-call checks in Gateway compatibility. |

178| Upstream request times out | Check model availability in the source Region, routing configuration, quotas, and gateway logs before changing timeouts. |

179 

180Retest the same user path after a fix. A successful gateway health check doesn't verify an authenticated inference request or a complete Codex turn.

Details

1# Connect to a gateway

2 

3> For the complete documentation index, see [llms.txt](https://learn.chatgpt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.

4 

5Connect Codex to an LLM gateway using the gateway URL, model alias, and credential

6or token resolver your organization provides.

7 

8To roll out a gateway for your organization, see [Deploy Codex through a

9 gateway](https://learn.chatgpt.com/docs/enterprise/roll-out-a-gateway). For the required API behavior,

10 see [Gateway compatibility](https://learn.chatgpt.com/docs/enterprise/gateway-compatibility). To

11 connect directly to Bedrock without a gateway, see [Amazon

12 Bedrock](https://learn.chatgpt.com/docs/amazon-bedrock).

13 

14## Check for an existing configuration

15 

16Before adding anything, check whether your administrator already configured Codex.

17 

18- For the CLI, inspect the selected profile and run `codex doctor`. After startup,

19 use `/status` to confirm the active model and provider.

20- For the macOS app, inspect `~/.codex/config.toml` or the managed configuration

21 your organization delivers.

22- For the Windows app, inspect `%USERPROFILE%\.codex\config.toml` or the system

23 configuration your organization delivers.

24 

25If the expected gateway provider and model are already active, continue to

26[Verify the connection](#verify-the-connection).

27 

28## Get your gateway connection details

29 

30Install the [Codex CLI](https://learn.chatgpt.com/docs/codex/cli) or the desktop app approved by your

31organization. To configure Codex yourself, get these values from your gateway team:

32 

33- The HTTPS gateway base URL, including its API path, such as `https://gateway.example.com/v1`.

34- The model name and provider ID to use.

35- Your scoped gateway credential and its environment variable, or an installed

36 token resolver and its configuration.

37- Any required model catalog file and its absolute local path.

38 

39## Configure the provider

40 

41Open `config.toml` at `~/.codex/config.toml` on macOS or Linux, or

42`%USERPROFILE%\.codex\config.toml` on Windows.

43 

44Merge this example into your existing configuration, replacing the URL and model

45with the values your administrator supplied. Don't add a second definition of an

46existing key or table. This example uses `gpt-6-sol`; use it without a custom

47catalog only if your administrator confirms that your Codex version recognizes

48the model and its bundled metadata matches the gateway.

49 

50Keep `model`, `model_provider`, `model_catalog_json`, and `web_search` before

51 the first TOML table. Keys placed after a table header belong to that table,

52 so Codex won't read them as top-level settings.

53 

54```toml

55model = "gpt-6-sol"

56model_provider = "enterprise-gateway"

57web_search = "disabled"

58 

59[model_providers.enterprise-gateway]

60name = "Organization Gateway"

61base_url = "https://gateway.example.com/v1"

62wire_api = "responses"

63env_key = "CODEX_GATEWAY_API_KEY"

64```

65 

66If your administrator supplies a model catalog, save it locally and add

67`model_catalog_json` before the first TOML table, using the file's absolute path.

68Custom aliases need matching catalog metadata. For example:

69 

70```toml

71model_catalog_json = "/etc/codex/gateway-models.json"

72```

73 

74Use the model name and catalog supplied together by your administrator. Don't

75add a catalog path unless the file exists at that location.

76 

77`enterprise-gateway` is an illustrative provider ID. Use the same ID in

78`model_provider`, `[model_providers.<id>]`, and `[model_providers.<id>.auth]`.

79This example disables web search

80for the initial connection test; your administrator should verify feature support

81before enabling it.

82 

83Make your gateway credential available as `CODEX_GATEWAY_API_KEY` in the

84environment of the process that launches Codex, using your organization's secret

85delivery mechanism. Don't put the credential in TOML or a repository. A variable

86set in a terminal may not be available to an app launched from the desktop.

87 

88### Use a custom authentication header

89 

90If your gateway requires a header such as `X-API-Key` instead of a bearer token,

91replace `env_key` in the provider table with:

92 

93```toml

94env_http_headers = { "X-API-Key" = "CODEX_GATEWAY_API_KEY" }

95```

96 

97Use the exact header name your administrator provides. Codex reads the value from

98the named environment variable; keep the credential out of the configuration file.

99See the [configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference) for

100`model_providers.<id>.env_http_headers`.

101 

102### Use an organization credential helper

103 

104If your administrator provides command-backed authentication, use their installed

105helper and configuration instead of `env_key`. Don't configure both mechanisms.

106The helper must exist on your machine; Codex doesn't install it. For example,

107replace the example `env_key` setting with this table, using the resolver path and

108arguments your administrator supplies:

109 

110```toml

111[model_providers.enterprise-gateway.auth]

112command = "/usr/local/bin/fetch-codex-gateway-token"

113args = ["print-token"]

114timeout_ms = 30000

115refresh_interval_ms = 300000

116```

117 

118The [custom provider authentication reference](https://learn.chatgpt.com/docs/config-file/config-advanced#custom-model-providers)

119defines the command, arguments, timeout, refresh interval, and token output

120contract. Ask your administrator how to renew your sign-in if the helper can no

121longer retrieve a token.

122 

123Use resolved absolute paths for helper executables and catalog files.

124 

125### Configure the CLI

126 

127The CLI reads `~/.codex/config.toml` by default on macOS or Linux. After saving

128the provider settings, run `codex`. Inside WSL, use the Linux configuration and

129paths unless `CODEX_HOME` points elsewhere.

130 

131### Configure the macOS app

132 

133The macOS app reads the same `~/.codex/config.toml`. After saving the provider

134settings, restart the app. If you use an environment variable for the credential,

135make sure it's available to the app process.

136 

137### Configure the Windows app

138 

139Place the provider settings in `%USERPROFILE%\.codex\config.toml`, then restart

140the app. For command-backed authentication, use the resolver installed by your

141administrator. For example, replace the Unix auth table with:

142 

143```toml

144[model_providers.enterprise-gateway.auth]

145command = 'C:\Program Files\OpenAI\Codex\fetch-codex-gateway-token.exe'

146args = ["print-token"]

147timeout_ms = 30000

148refresh_interval_ms = 300000

149```

150 

151In Windows TOML, single-quoted literal strings preserve backslashes. Replace

152Unix catalog paths too, for example with

153`'C:\ProgramData\OpenAI\Codex\models.json'`, using the actual path your

154administrator supplied.

155 

156Configure MCP servers and plugins separately. A model gateway credential doesn't

157authorize access to your tools or connected systems.

158 

159## Verify the connection

160 

161Restart the client after changing the configuration. In the CLI, start `codex`

162and use `/status` to inspect the active model and provider. In the desktop app,

163check the selected model and configuration.

164 

165Send this prompt in a new task:

166 

167```text

168Reply with exactly: gateway-ok

169```

170 

171Expect `gateway-ok`. A response alone doesn't prove which route handled it: ask

172your administrator to confirm that the gateway recorded your user, model alias,

173and intended upstream route. Don't identify the model by asking it its name.

174 

175This verifies an initial connection. Administrators should also complete the

176[rollout checks](https://learn.chatgpt.com/docs/enterprise/roll-out-a-gateway#test-the-client-and-gateway)

177for streaming, tools, and follow-up turns.

178 

179## Troubleshoot the connection

180 

181| Symptom | What to check |

182| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

183| The expected provider isn't active. | Check the selected profile and configuration precedence. Confirm that top-level keys aren't inside a provider table. |

184| Authentication fails. | Check that the credential variable reaches the client process, or that the installed helper can retrieve a current token. Ask the administrator to distinguish gateway authentication from upstream authentication. |

185| The model isn't found. | Confirm the supplied model name and ask the administrator to check its route. |

186| The model uses unexpected capabilities. | Ask the administrator to check that the catalog metadata matches the model behind the alias. |

187| Streaming stalls or follow-ups fail. | Ask the gateway owner to check proxy buffering, the terminal `response.completed` event, and [Gateway compatibility](https://learn.chatgpt.com/docs/enterprise/gateway-compatibility). |

188| A catalog or helper path fails. | Confirm that the file exists at the configured absolute path in the environment running Codex. |

189 

190When requesting help, include the error message with tokens and sensitive prompts removed.

191 

192## Use an existing gateway deployment

193 

194If your organization already uses a gateway with another coding tool, you may be

195able to reuse its network path, logging, and provider access. Work with your

196gateway team to configure and test a Codex connection:

197 

1981. Identify the existing gateway URL, credential mechanism, required headers,

199 model routes, and configuration delivery method.

2002. Ask your gateway team to confirm that the gateway supports the

201 [API behavior Codex requires](https://learn.chatgpt.com/docs/enterprise/gateway-compatibility) and to

202 configure a Codex model route.

2033. Obtain a scoped gateway credential or credential helper, the model name, and

204 any required model catalog from your gateway team.

2054. [Configure Codex](#configure-the-provider) with those values.

2065. [Verify the connection](#verify-the-connection) in the CLI or desktop app you

207 plan to use. Have your gateway team complete the

208 [streaming, tool, and follow-up checks](https://learn.chatgpt.com/docs/enterprise/roll-out-a-gateway#test-the-client-and-gateway).

2096. After the pilot passes, follow

210 [Deploy Codex through a gateway](https://learn.chatgpt.com/docs/enterprise/roll-out-a-gateway) to distribute the

211 configuration to other developers.

212 

213For the administrator migration checklist and configuration mapping, see

214[Reuse an existing gateway deployment](https://learn.chatgpt.com/docs/enterprise/roll-out-a-gateway#reuse-an-existing-gateway-deployment).

215 

216## Related docs

217 

218- [Codex CLI](https://learn.chatgpt.com/docs/codex/cli)

219- [MCP servers](https://learn.chatgpt.com/docs/extend/mcp)

220- [Plugins](https://learn.chatgpt.com/docs/plugins)

Details

1# Gateway compatibility requirements

2 

3> For the complete documentation index, see [llms.txt](https://learn.chatgpt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.

4 

5Codex gateways must preserve the Responses API behavior described here:

6endpoints, streaming, continuation, tool calls, authentication, routing, and

7useful errors.

8 

9To roll out a gateway, see [Deploy Codex through a

10 gateway](https://learn.chatgpt.com/docs/enterprise/roll-out-a-gateway). To configure a developer

11 machine, see [Connect to a gateway](https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway).

12 

13## Requests and endpoints

14 

15Configure a gateway provider with `wire_api = "responses"`. For a base URL such

16as `https://gateway.example.com/v1`, the gateway must accept

17`POST /v1/responses` and preserve the request and response fields the client uses.

18A working Chat Completions or Anthropic Messages endpoint doesn't establish

19Responses compatibility.

20 

21Health and model-list endpoints are optional operational aids. They don't exercise

22a Codex conversation or prove tool support.

23 

24## Streaming

25 

26Forward server-sent events (SSE) incrementally rather than buffering the entire

27answer. Preserve event types and payloads, including the successful terminal

28`response.completed` event. Forward error and failure events so the client can

29distinguish a failed response from a stalled connection.

30 

31Verify the full stream through load balancers and reverse proxies as well as the

32gateway. A text reply without a completed stream is insufficient.

33 

34## Conversation continuation

35 

36Preserve replayed conversation input across follow-up turns. The gateway must

37accept the prior messages, tool calls, and tool results needed for the next turn.

38 

39If you enable WebSocket or incremental transport, verify its

40`previous_response_id` behavior too. A stateless HTTP Responses path can use

41replayed input without requiring that continuation mechanism.

42 

43## Tools

44 

45Preserve function-call items and their matching `function_call_output` items,

46including the identifiers that associate calls with results. The full loop must

47work: Codex receives a call, executes the tool, submits its result, and receives a

48final answer.

49 

50A successful text request doesn't verify this loop. Test the actual models and

51client features you plan to enable. A gateway accepting a request field doesn't

52prove that its upstream model implements the corresponding capability.

53 

54## Authentication and headers

55 

56Support the client authentication mechanism selected for the deployment:

57`env_key` or command-backed bearer tokens, or `env_http_headers` for credentials

58sent in a custom header. Use environment variables for secret header values;

59don't hard-code them in configuration. See the

60[custom provider reference](https://learn.chatgpt.com/docs/config-file/config-advanced#custom-model-providers)

61for the configuration and credential-helper contract.

62 

63Authenticate developers separately from the gateway's upstream provider identity.

64Keep administrator keys and upstream credentials on the gateway. Preserve the

65headers your routing and attribution depend on, and test credential expiration,

66renewal, and revocation.

67 

68## Model routing and metadata

69 

70Each Codex-facing model name must route to the intended upstream model. Verify

71the route in gateway records rather than relying on the model's self-description.

72 

73Use a name recognized by the deployed Codex version, or

74[supply a matching catalog for a custom alias](https://learn.chatgpt.com/docs/enterprise/roll-out-a-gateway#supply-metadata-for-a-custom-alias).

75Review model availability and migration metadata too: any replacement model must

76route through the gateway. For an organization-owned alias without a migration,

77set its catalog entry's `upgrade` to `null`. Catalog metadata informs client behavior;

78it doesn't add capabilities to a model

79or create gateway routes. Verify context limits, reasoning options, and tools

80against the actual upstream model and provider. A generic gateway connection

81doesn't automatically receive the metadata adjustments made by Codex's built-in

82provider integrations.

83 

84### Recognized model names

85 

86Use the exact model name recognized by your deployed Codex version as the gateway

87alias and Codex `model`. Confirm that the upstream provider supports the model

88and your organization approves it.

89 

90Check `codex --version` and select the matching `rust-v<version>` tag in the [Codex model catalog](https://github.com/openai/codex/blob/main/codex-rs/models-manager/models.json).

91For a custom build, use its source commit; for desktop deployments, match the

92bundled CLI version. Check the entries' `slug` values to find the names that

93version recognizes. If the gateway changes the model's capabilities, supply

94catalog metadata that reflects those differences even when the name is recognized.

95 

96## Errors

97 

98Preserve useful distinctions between client authentication errors, unknown model

99routes, rate limits, and upstream failures. Don't collapse all failures into a

100generic `500` response. Return enough information to diagnose the failing layer

101without exposing tokens, provider credentials, or sensitive request content.

102 

103## Data and tool boundaries

104 

105Model traffic follows this path:

106 

107```text

108Codex client -> LLM gateway -> model provider

109```

110 

111The client authenticates to the gateway with a developer credential. The gateway

112uses its upstream provider credential to access the model. Prompts, source

113excerpts, tool arguments, and tool results included in model requests can pass

114through the gateway. Set logging, retention, redaction, access, and export controls

115accordingly.

116 

117The model gateway does not route every connection made by Codex. Local commands

118run in the client execution environment. MCP servers, plugin services, browser

119and app interactions, and other enabled services can have separate network paths

120and credentials. Model-provider configuration doesn't grant those permissions or

121replace their network controls. See [Agent approvals and security](https://learn.chatgpt.com/docs/agent-approvals-security)

122and [MCP](https://learn.chatgpt.com/docs/extend/mcp) for those boundaries.

123 

124## Qualification checklist

125 

126Record evidence for each deployed combination of client, gateway, and model:

127 

128- Responses request and response fields.

129- Incremental SSE delivery and successful terminal completion.

130- Follow-up turns with replayed input.

131- `previous_response_id` when the selected transport uses it.

132- Function calls, matching results, and a final answer.

133- Correct model routing and matching metadata.

134- Per-user attribution, renewal, and revocation.

135- Useful authentication, routing, rate-limit, and upstream errors.

136- Redacted diagnostics and the intended logging policy.

137 

138Use the [rollout test procedure](https://learn.chatgpt.com/docs/enterprise/roll-out-a-gateway#test-the-client-and-gateway)

139to collect this evidence before distributing the configuration.

Details

1# Deploy Codex through a gateway

2 

3> For the complete documentation index, see [llms.txt](https://learn.chatgpt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.

4 

5Deploy Codex through your organization’s LLM gateway. Configure model routes, issue developer credentials, and distribute a verified Codex configuration.

6 

7To configure Codex on your own machine with values you were given, see

8 [Connect to a gateway](https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway). Before

9 choosing or rolling out a gateway, review the [gateway compatibility

10 requirements](https://learn.chatgpt.com/docs/enterprise/gateway-compatibility).

11 

12## Prerequisites

13 

14Before deploying Codex to developers, confirm that you have:

15 

16- A gateway serving HTTPS at the exact base URL you will distribute.

17- An upstream provider credential held by the gateway.

18- Approved Codex-facing model aliases mapped to intended upstream models.

19- A scoped test gateway credential.

20- A secret delivery mechanism or a tested credential helper.

21- A way to distribute configuration, helper executables, and any catalog files.

22 

23## Gateway requirements

24 

25Before connecting Codex, verify that the gateway product preserves these required behaviors:

26 

27- Accept Codex Responses API requests at `POST /v1/responses`.

28- Stream SSE events without buffering and end with `response.completed`.

29- Preserve follow-up continuation with replayed input.

30- Preserve `previous_response_id` only when WebSocket or incremental transport is enabled.

31- Preserve function calls and matching `function_call_output` items.

32- Route each Codex-facing model alias to the intended upstream model.

33- Authenticate users separately and return useful errors without hiding the cause.

34 

35A health endpoint, `/v1/models`, Chat Completions response, or one plain-text reply does not qualify the gateway. See [Gateway compatibility requirements](https://learn.chatgpt.com/docs/enterprise/gateway-compatibility) for the detailed contract.

36 

37Need an implementation starting point? The [Codex deployment guidance repository](https://github.com/openai-on-aws/guidance-codex/tree/adbc00f353effbf0252e667ba41eb89c99324c8f) includes worked setups for different LLM gateway products. Use it as a reference after confirming your gateway meets the requirements above.

38 

39## Roll out the gateway

40 

41To move from a deployed gateway to a verified developer experience, complete these five checkpoints in order:

42 

431. [Choose model names and verify routes](#choose-model-names-and-routes).

442. [Issue developer credentials](#issue-developer-credentials).

453. [Test Codex through the gateway](#test-the-client-and-gateway).

464. [Distribute the configuration](#distribute-the-configuration).

475. [Verify from a developer machine](#verify-and-operate-the-rollout).

48 

49## Choose model names and routes

50 

51Set Codex's `model` to the gateway's model name. Configure the gateway to route that name to the approved upstream model.

52 

53| Gateway model name | Codex configuration |

54| ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |

55| A [built-in model name](https://learn.chatgpt.com/docs/enterprise/gateway-compatibility#recognized-model-names) included in your Codex version | Set `model` in `config.toml` to this exact name. |

56| A custom alias, such as `company-coding-model` | Set `model_catalog_json` to a catalog containing the alias and the corresponding model's metadata. |

57 

58<a id="supply-metadata-for-a-custom-alias"></a>

59 

60### Use a model catalog for custom names

61 

62Use [`model_catalog_json`](https://learn.chatgpt.com/docs/config-file/config-reference) when your gateway uses a model name Codex does not recognize. The catalog supplies the instructions, reasoning options, context limits, and tool capabilities Codex uses for that name. Without a matching entry, a request can reach the intended upstream model while Codex uses generic settings.

63 

64For example, to use `company-coding-model` as an alias for `gpt-6-luna`:

65 

661. Create the `company-coding-model` alias on the gateway and route it to the approved upstream `gpt-6-luna` model.

672. Download the [Codex model catalog](https://github.com/openai/codex/blob/main/codex-rs/models-manager/models.json) for your Codex version and save a copy as `gateway-models.json`. Use this file as your starting point.

683. Edit the `gpt-6-luna` entry in your copy: set `slug` to `company-coding-model` and check that the remaining metadata matches the upstream model and gateway capabilities. For an alias without a model migration, set `upgrade` to `null`.

694. Keep the entries in the top-level `models` array and distribute the file to each client. A custom catalog replaces the bundled catalog, so include every model users need to select.

70 

71To use a catalog for a specific Codex version, check `codex --version` and select the matching `rust-v<version>` tag. For a custom build, use its exact source commit. For a desktop deployment, match the bundled CLI version.

72 

73For Bedrock through LiteLLM, apply the [required catalog edits](https://learn.chatgpt.com/docs/enterprise/bedrock-through-litellm#prepare-the-client-catalog).

74 

75Set the gateway alias, catalog `slug`, and Codex `model` to `company-coding-model`. Add these settings before the first TOML table in the Codex configuration you distribute, using the file's actual absolute path:

76 

77```toml

78model = "company-coding-model"

79model_catalog_json = "/absolute/path/to/gateway-models.json"

80```

81 

82Restart the CLI or desktop app after changing the catalog because Codex loads it at startup.

83 

84### Verify model routes

85 

86For each model, verify the route with a real Responses request and gateway

87records. A `/v1/models` response can help discover names but doesn't prove that a

88model supports the required request and tool behavior.

89 

90Model routing and tool authorization are separate parts of the rollout. Configure

91MCP connections, plugin distribution, and their policies separately.

92 

93## Issue developer credentials

94 

951. Issue one scoped gateway credential per developer so you can attribute usage

96 and revoke access individually.

972. Set the approved models, rate limits, budget, expiration, and renewal period

98 for each credential.

993. Deliver credentials through your secret manager or an installed credential

100 helper. Keep upstream provider and gateway administrator credentials off

101 developer machines.

1024. If you use a helper, follow the

103 [command-backed authentication contract](https://learn.chatgpt.com/docs/config-file/config-advanced#custom-model-providers)

104 and test token retrieval and refresh before distribution.

1055. Tell developers how to renew their credentials and whom to contact for help.

106 

107<a id="test-the-client-and-gateway"></a>

108 

109## Test Codex through the gateway

110 

111Before distributing anything, follow [Connect to a gateway](https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway) to configure one isolated test user with the provider block and credential mechanism you plan to distribute.

112 

113Run the checks below from the same CLI or desktop surface developers will use:

114 

115| Check | Action | Passing evidence |

116| ---------------------- | ------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |

117| Connection | Follow [Verify the connection](https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway#verify-the-connection). | The expected provider and alias are active, the test prompt succeeds, and gateway logs identify the test user. |

118| Streaming | Ask for a short multi-paragraph answer. | The gateway forwards SSE events without buffering, text arrives incrementally, and the stream ends with `response.completed`. |

119| Local tool loop | In a disposable folder with read-only permissions, ask Codex to list the top-level files and summarize them. | Codex issues a local tool call, returns the result, and produces a final answer without edits. |

120| Follow-up | Ask a follow-up in the same thread. | The answer uses the prior turn; the gateway accepts replayed input. If WebSocket or incremental transport is enabled, it also preserves `previous_response_id`. |

121| Errors and attribution | Repeat with an intentionally invalid test alias or expired test credential. | The client receives a useful routing or authentication error, and valid requests remain attributed to the test user. |

122 

123After these checks succeed, direct developers to [Connect to a gateway](https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway) to configure and verify their own machine.

124 

125## Distribute the configuration

126 

127To give every machine the same connection path, distribute the gateway base URL,

128provider ID, approved model alias, and credential mechanism.

129 

130### What to distribute

131 

132To set provider defaults, distribute this `config.toml` block through the configuration layer you chose. Use a model recognized by your Codex version, or supply the matching catalog described above. Install your token resolver at the configured command path:

133 

134Put `model` and `model_provider` before the first TOML table. If you set

135 `model_catalog_json`, keep it there too. TOML treats keys after

136 `[model_providers...]` as part of that table, not as top-level Codex

137 configuration.

138 

139```toml

140model = "gpt-6-sol"

141model_provider = "enterprise-gateway"

142web_search = "disabled"

143 

144[model_providers.enterprise-gateway]

145name = "Organization Gateway"

146base_url = "https://gateway.example.com/v1"

147wire_api = "responses"

148 

149[model_providers.enterprise-gateway.auth]

150command = "/usr/local/bin/fetch-codex-gateway-token"

151args = ["print-token"]

152timeout_ms = 30000

153refresh_interval_ms = 300000

154```

155 

156For a short-lived static test key, remove the auth block and put `env_key = "CODEX_GATEWAY_API_KEY"` inside `[model_providers.enterprise-gateway]` and set that variable outside TOML. Do not combine `env_key` with command-backed auth.

157 

158### Distribute defaults and requirements

159 

160Use [Configuration precedence](https://learn.chatgpt.com/docs/config-file/config-basic#configuration-precedence)

161to choose where to distribute defaults. For enforced settings and macOS MDM

162payloads, see [Managed configuration](https://learn.chatgpt.com/docs/enterprise/managed-configuration#admin-enforced-requirements-requirementstoml).

163 

164For host-wide defaults on macOS or Linux, use `/etc/codex/config.toml`. On

165Windows, place `config.toml` in `%ProgramData%\OpenAI\Codex\`. Users and

166profiles can override these defaults. The linked references describe supported

167requirements and their file locations.

168 

169Distribute any referenced helper executables and catalog files separately.

170 

171`model_catalog_json` points to a local JSON file. If you enforce it through

172`requirements.toml`, the requirement pins the path; it doesn't distribute the

173file. Put the catalog at that absolute path before Codex starts.

174 

175Write resolved absolute Windows paths in TOML. Codex doesn't expand

176`%ProgramData%` inside `model_catalog_json` or provider auth `command` values. For

177example, use these paths only if your deployment placed the files there:

178 

179```toml

180model_catalog_json = 'C:\ProgramData\OpenAI\Codex\models.json'

181 

182[model_providers.enterprise-gateway.auth]

183command = 'C:\ProgramData\OpenAI\Codex\fetch-gateway-token.cmd'

184args = ["print-token"]

185```

186 

187A CLI inside WSL reads Linux paths and Linux `CODEX_HOME`; it doesn't automatically

188inherit native Windows configuration.

189 

190### Hand developers the configuration values

191 

192If you do not have managed distribution, give each developer the gateway URL, provider ID, model alias, credential variable or resolver, and any catalog path. Send them to [Connect to a gateway](https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway) to configure and verify their own machine.

193 

194Manual setup is not an enforcement channel. Project-local `.codex/config.toml` cannot override sensitive provider or authentication routing keys.

195 

196<a id="verify-and-operate-the-rollout"></a>

197 

198## Verify from a developer machine

199 

200To confirm that the distributed settings reached a developer machine:

201 

2021. Restart Codex and confirm the expected provider and model.

2032. Run the short test in [Connect to a gateway](https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway#verify-the-connection).

2043. Ask one follow-up to confirm continuation, then check the gateway logs for that

205 developer's request.

206 

207### Troubleshoot rollout failures

208 

209Use the issue to find the configuration, credential, or gateway layer that needs attention:

210 

211| Issue | Remediation |

212| ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

213| Expected provider is missing after restart. | Inspect the winning configuration layer. User or profile configuration can override system defaults. |

214| Authentication fails for every user. | Check gateway authentication and the upstream provider credential; identify which service rejected the request. |

215| Authentication fails for one user. | Check that user's gateway credential or token resolver. |

216| Streaming stalls. | Inspect gateway buffering and terminal `response.completed` forwarding. |

217| A model is missing or uses generic capabilities. | For a custom alias, confirm the gateway alias, Codex `model`, and catalog `slug` match. Check the [catalog](#use-a-model-catalog-for-custom-names) path and compatibility with the installed Codex version, then restart Codex. |

218| A Windows path fails. | Use resolved absolute paths. In TOML, use single-quoted strings for Windows paths with single backslashes. |

219 

220## Reuse an existing gateway deployment

221 

222If your organization already uses Claude Code through a gateway, you may be able

223to reuse the gateway product, network path, logging, and Bedrock access. Add a

224Codex-facing Responses route, credential, model aliases, and `config.toml` while

225retaining the existing working setup. Claude client settings and the

226`/v1/messages` contract don't configure Codex.

227 

228| Existing Claude deployment | Codex migration |

229| ------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

230| Gateway product, DNS, TLS, private networking, logging, redaction, and monitoring | Keep these services in place. Add a Codex-facing route that satisfies the [Gateway compatibility requirements](https://learn.chatgpt.com/docs/enterprise/gateway-compatibility). |

231| Bedrock account, provider credential, IAM boundary, inference profiles, and credential rotation | Keep them only when they authorize the upstream models behind the new Codex aliases. The provider credential remains on the gateway. |

232| Claude `/v1/messages` route, Bedrock InvokeModel shape, Anthropic headers, and Claude-specific retries or errors | Do not reuse these as proof of compatibility. Codex needs `POST /v1/responses`, Responses streaming, continuation, tool calls, and useful errors. |

233| `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_API_KEY`, or `apiKeyHelper` | Codex does not support `apiKeyHelper`. Issue a scoped Codex gateway credential and configure it with `env_key` or a Codex command-backed token resolver. |

234| Claude model names, `ANTHROPIC_MODEL`, `ANTHROPIC_DEFAULT_*_MODEL`, `modelOverrides`, and Bedrock profile mappings | Have your gateway team [choose model names and configure any custom aliases](#choose-model-names-and-routes). Use the model name and any [model catalog JSON](https://learn.chatgpt.com/docs/config-file/config-reference) they provide. |

235| Claude `settings.json`, `managed-settings.json`, JSON `env` blocks, `plist`, or registry payloads | Keep the same MDM or configuration-management channel, but distribute Codex `config.toml` and supported `requirements.toml` values instead. |

236 

237To migrate safely, complete these steps in order:

238 

2391. Inventory the current Claude path: gateway URL, credential source, required headers, model aliases, Bedrock profile mappings, and managed delivery channel.

2402. Add a parallel Codex-facing Responses route and Codex model aliases.

2413. Issue one scoped Codex credential. If Codex will use a static credential, expose that new credential through `env_key`; if Claude uses a credential helper, implement and test the Codex command-backed resolver contract.

2424. Configure that developer with the [provider block](#what-to-distribute). For a managed rollout, translate the payload into the Codex paths and precedence described in [Deploy Codex through a gateway](#distribute-the-configuration).

2435. Run the short connection check on the developer's actual CLI or desktop surface, then run the full streaming, continuation, tool-call, error, logging, and alias-routing checks in [Test Codex through the gateway](#test-the-client-and-gateway).

2446. After the pilot passes, [distribute the configuration](#distribute-the-configuration) to the remaining developers.

245 

246## Related docs

247 

248- [Connect to a gateway](https://learn.chatgpt.com/docs/enterprise/connect-to-a-gateway)

249- [MCP](https://learn.chatgpt.com/docs/extend/mcp)

250- [Plugins](https://learn.chatgpt.com/docs/plugins)

251- [Managed configuration](https://learn.chatgpt.com/docs/enterprise/managed-configuration)

models.md +5 −4

Details

438 438 

439</ToggleSection>439</ToggleSection>

440 440 

441You can also point Codex at any model and provider that supports either the [Chat Completions](https://platform.openai.com/docs/api-reference/chat) or [Responses APIs](https://platform.openai.com/docs/api-reference/responses) to fit your specific use case.441For a custom model provider or gateway, use a compatible Responses API endpoint.

442 442See [Custom model providers](https://learn.chatgpt.com/docs/config-file/config-advanced#custom-model-providers)

443Support for the Chat Completions API is deprecated and will be removed in443for configuration and [Gateway compatibility](https://learn.chatgpt.com/docs/enterprise/gateway-compatibility)

444 future releases of Codex.444for streaming, tool, and conversation requirements. Current Codex releases don't

445support `wire_api = "chat"` or a Chat Completions-only endpoint.

445 446 

446## Deprecated Codex models447## Deprecated Codex models

447 448