MandAPI
English ▾
Coding tools

Use Codex CLI with MandAPI

Add a custom Responses provider with an environment-based key, while keeping existing project settings.

Use this recipe with your coding assistant

Read the prompt
Configure my existing standalone Codex CLI to use MandAPI. Read the installed client's current configuration format and preserve my existing project, approval and sandbox settings. Back up the config before merging a custom provider named mandapi with base_url=https://api.mandapi.com/v1, wire_api=responses and env_key=MANDAPI_API_KEY. Keep the actual key outside config.toml and never display it. Use the exact account-visible model ID I provide; ask for it if missing. Do not infer a model's context limit, tool support or Responses features from its name. Check that the intended process can see the environment variable and, when credentials are available, run one short read-only README summary. Report the files changed, result and restoration steps. Do not alter MandAPI Connect's private configuration or purchase credits.
TXT

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.

toml
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:

bash
read -rsp "MandAPI key: " MANDAPI_API_KEY
printf '\n'
export MANDAPI_API_KEY
codex

In PowerShell:

powershell
$env:MANDAPI_API_KEY = [Net.NetworkCredential]::new('', (Read-Host 'MandAPI key' -AsSecureString)).Password
codex

Start 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.

References

Topics inspired by public documentation; instructions and examples adapted for MandAPI.