Before you begin
- Install Codex CLI using the instructions on the official Codex CLI page.
- Create your codexinfo.top account and generate an API key. Existing users can use the Sign in button in the navigation.
- Choose an exact model name from the current model and pricing list.
Step 1: Set the API key environment variable
macOS or Linux
export CODEXINFO_API_KEY="sk-your-api-key"For a persistent Zsh setting:
echo 'export CODEXINFO_API_KEY="sk-your-api-key"' >> ~/.zshrc
source ~/.zshrcUse ~/.bashrc instead when your shell is Bash.
Windows PowerShell
$env:CODEXINFO_API_KEY="sk-your-api-key"To save it for the current Windows user:
[Environment]::SetEnvironmentVariable(
"CODEXINFO_API_KEY",
"sk-your-api-key",
"User"
)Close and reopen PowerShell after saving a user environment variable.
Step 2: Edit the user-level config.toml
| Operating system | Config path |
|---|---|
| macOS / Linux | ~/.codex/config.toml |
| Windows | C:\Users\your-name\.codex\config.toml |
.codex/config.toml files ignore model_provider and model_providers.model = "gpt-5.5"
model_provider = "codexinfo"
[model_providers.codexinfo]
name = "codexinfo.top"
base_url = "https://api.codexinfo.top/v1"
env_key = "CODEXINFO_API_KEY"
wire_api = "responses"gpt-5.5 is an example visible in the codexinfo.top model list when this guide was published. Replace it with the exact current model name when the list changes.
| Field | Purpose |
|---|---|
model | The model Codex selects by default. |
model_provider | Selects the custom provider defined below. |
base_url | The compatible API endpoint. Keep the trailing /v1. |
env_key | The name of the environment variable containing the key. |
wire_api | The custom-provider protocol. The official reference currently supports responses. |
Step 3: Verify the connection
codex --versionmkdir codex-api-test
cd codex-api-test
codexYou can also make a non-interactive test request:
codex exec "Reply with exactly: connection successful"After a successful request, check the codexinfo.top dashboard for the corresponding usage record.
Troubleshooting
401 Unauthorized or Invalid token
- Confirm that
env_keyexactly matchesCODEXINFO_API_KEY. - Run
echo $CODEXINFO_API_KEYon macOS/Linux or$env:CODEXINFO_API_KEYin PowerShell. - Reopen the terminal after saving a persistent variable.
- Copy the key again without spaces or line breaks.
404 Responses endpoint not found
- Use
https://api.codexinfo.top/v1as the base URL. - Do not use the dashboard URL as the API endpoint.
- Make sure the provider supports the Responses API.
Model not found
- Model names must match the dashboard exactly.
- Do not copy an outdated model name from an old tutorial.
- Review the current model list.
429 Too many requests or insufficient quota
- Check account balance and API-key quota.
- Review model, IP, and request restrictions on the key.
- Reduce concurrency and retry later.
Codex ignores the provider configuration
- Confirm that you edited the user-level
~/.codex/config.toml. - Check TOML quotes, spelling, and table names.
- Restart the Codex session and terminal.
- Do not place the provider definition only in a project-level config file.
API key safety
- Never commit a key to Git.
- Do not expose a complete key in screenshots or support logs.
- Create separate keys for different devices or projects.
- Revoke and replace a key immediately if it leaks.
- Use quota, model, and IP restrictions when appropriate.
Frequently asked questions
Can I only set OPENAI_BASE_URL and OPENAI_API_KEY?
Some tools support those variables, but Codex CLI has an explicit custom-provider configuration. Using model_providers, base_url, and env_key makes the configuration clearer and easier to troubleshoot.
Why use CODEXINFO_API_KEY instead of pasting the key into config.toml?
env_key stores the environment-variable name, not the secret. This reduces the risk of committing or sharing the actual API key.
Can different projects use different models?
Yes. Keep the reusable provider definition in user-level configuration, and use Codex configuration layers or launch options for project-specific model choices.
Official references
The fields in this guide were checked against the OpenAI Codex Configuration Reference and Codex Basic Configuration. Available models and service pricing come from the live codexinfo.top dashboard.
Ready to configure Codex CLI?
Create an account and API key, then paste the configuration from this guide.
Create an account