快速重點
The Base URL, model name and key below are examples. Replace them with the exact values delivered with your order.
What you need
Before starting, make sure you have Codex CLI or the Codex app installed, the production Gateway Base URL, your redeemed API key and a supported model ID.
Codex supports custom model providers through its user-level configuration file. See the official Codex custom provider documentation for the underlying configuration format.
Add the Gateway provider
Open your user configuration file at ~/.codex/config.toml and add the following configuration:
model = "YOUR_MODEL_ID"
model_provider = "jaideepass"
[model_providers.jaideepass]
name = "Jaideepass Gateway"
base_url = "https://api.example-gateway.com/v1"
wire_api = "responses"
env_key = "JAIDEEPASS_API_KEY"
Keep this provider configuration in your user-level file. Provider and authentication settings should not be placed in a shared project .codex/config.toml.
Configure Codex CLI on macOS or Linux
Open Terminal and set the Gateway key:
export JAIDEEPASS_API_KEY="YOUR_GATEWAY_KEY"
Then start Codex with codex and send a simple request such as Reply with: Gateway connected..
Check the Gateway dashboard after the response. A recorded request and balance deduction confirm that Codex is using the configured provider.
To reuse the key in future terminal sessions, store it through your preferred shell-secret or environment-management method rather than placing it directly in a repository.
Configure Codex CLI on Windows
Open PowerShell and enter:
$env:JAIDEEPASS_API_KEY = "YOUR_GATEWAY_KEY"
codex
Send a test request and confirm that it appears in the Gateway dashboard.
To make the key available in future Windows sessions, save it as a user environment variable:
[Environment]::SetEnvironmentVariable(
"JAIDEEPASS_API_KEY",
"YOUR_GATEWAY_KEY",
"User"
)
Open a new PowerShell window before starting Codex again.
Configure the Codex app
Open the Codex app and go to Settings → Configuration → Open config.toml. Add the same model_provider configuration shown above.
The app must also be able to read the JAIDEEPASS_API_KEY environment variable.
On macOS, make the variable available to the current user app session with launchctl setenv JAIDEEPASS_API_KEY "YOUR_GATEWAY_KEY".
On Windows, use the user environment-variable command shown in the previous section.
Fully quit and reopen the Codex app, open a local project and send a test message. Confirm the request in the Gateway dashboard.
Select a supported model
Replace YOUR_MODEL_ID with a model currently available through the Gateway.
Use the exact ID shown on the live model pricing page. Model names and availability may change as routes are updated.
To switch models later, update the model value in ~/.codex/config.toml, save the file and restart the Codex session.
Keep the API key private
The configuration should reference the environment-variable name rather than contain the key itself.
- Do not place the key in a repository file
- Do not add the key to
AGENTS.md - Do not add the key to a shared
.codex/config.toml - Do not post the key in a public issue or support message
- Do not commit the key to source control
常見問題
Can Codex CLI and the Codex app use the same configuration? +
Yes. Both can read the provider settings from your user-level ~/.codex/config.toml.
Where should I add the Gateway provider? +
Add it to ~/.codex/config.toml. Do not place provider credentials in a shared project configuration file.
Do I need to sign in with ChatGPT? +
No. The custom provider uses the Gateway key referenced by env_key rather than billing through a personal ChatGPT subscription.
What does wire_api = "responses" mean? +
It tells Codex to send model requests using the Responses API format supported by the Gateway.
How do I know the configuration is working? +
Send a test message from Codex and check the Gateway dashboard. The request and corresponding usage deduction should appear there.
Where can I find supported model IDs? +
Check the live model pricing page for current model IDs and token prices.
準備好比較目前可用的方案了嗎?