Before you start
Install Codex CLI using the current official OpenAI instructions. This recipe configures a custom provider for the terminal client; it is separate from signing in with a ChatGPT subscription. You need an active MandAPI key and an exact model ID available to your account that works with the Responses API and your coding workflow.
MandAPI Connect already manages its bundled Codex configuration for Windows. If you use Connect, follow the Connect guide instead of editing the app's private configuration files.
Add the provider configuration
For a standalone installation, Codex normally reads ~/.codex/config.toml. On Windows, that is %USERPROFILE%\.codex\config.toml. Back up an existing file, merge the following settings, and preserve its unrelated sections. The root settings must precede the provider table. Replace MODEL_ID with the exact model you selected.
model_provider = "mandapi"
model = "MODEL_ID"
[model_providers.mandapi]
name = "MandAPI"
base_url = "https://api.mandapi.com/v1"
env_key = "MANDAPI_API_KEY"
wire_api = "responses"env_key names an environment variable; it is not the key itself. Use this one authentication method for this provider. Do not combine it with a command-backed authentication block or copy Connect's separate credential files into your normal Codex installation.
Supply the key privately
In Bash, set it for the current terminal without putting the value in the command history:
read -rsp "MandAPI key: " MANDAPI_API_KEY
printf '\n'
export MANDAPI_API_KEY
codexIn PowerShell:
$env:MANDAPI_API_KEY = [Net.NetworkCredential]::new('', (Read-Host 'MandAPI key' -AsSecureString)).Password
codexStart Codex from the same terminal. A different terminal or desktop process may not inherit these session variables. Keep your existing approval and sandbox preferences.
Check the result
Open a small project and request a read-only summary of its README. Confirm that the session uses the configured provider and chosen model, that a complete response arrives, and that the corresponding usage is visible in MandAPI. One successful text request does not verify every Responses feature or tool action.
Troubleshooting and rollback
An authentication error usually calls for checking the variable's presence and the key's status, without printing its value. A missing model calls for checking its exact ID and access. Unsupported parameters require checking the selected model and installed client version; do not fix them by inventing model limits. To restore your old setup, restore the backed-up provider settings and remove the session variable. Your saved ChatGPT login and this custom provider are distinct credentials.