~/.codex/config.toml. Keep the API key in an environment variable, not in the config file or a Git repository. The codexinfo.top Base URL is https://api.codexinfo.top/v1.1. Decide whether an API workflow fits your use case
A custom API is useful when you want Codex CLI, Cursor, an SDK, or automation to call models through a programmable endpoint. ChatGPT accounts or subscriptions and API usage are separate billing surfaces; this workflow uses independent API credit and an API key.
- You need a custom Base URL instead of a browser-only chat experience
- You want to review balance, request history, and API key usage
- You are comfortable with usage-based API credit
2. Create an account directly
Create an account with email. Existing users can sign in separately; a new user should not need to land on the sign-in page before finding registration.
Open registrationIf email verification is enabled, complete the code prompt. After signing in, the dashboard provides access to balance, billing history, API keys, and usage.
3. Review credit and payment before checkout
The live dashboard shows available packages, credited balance, and the payment amount. Models and pricing can change, so use the current page instead of an old screenshot.
View current models and pricing →Continue only after payment succeeds. If checkout does not open or an order fails, check billing history before creating another order.
4. Create and securely store an API key
Use a recognizable name for each machine or project. Save the key in a password manager or environment variable, and never commit it to Git.
export CODEXINFO_API_KEY="sk-your-api-key"For the current Windows PowerShell session:
$env:CODEXINFO_API_KEY="sk-your-api-key"5. Configure the user-level config.toml
Open ~/.codex/config.toml and add the provider below. Replace the model placeholder with an exact identifier from the live model list.
model = "COPY_AN_EXACT_MODEL_ID"
model_provider = "codexinfo"
[model_providers.codexinfo]
name = "codexinfo.top API"
base_url = "https://api.codexinfo.top/v1"
env_key = "CODEXINFO_API_KEY"
wire_api = "responses"Current Codex configuration rules keep provider, Base URL, and authentication settings at the user level. Project-level .codex/config.toml files should not be used to redirect provider credentials, which also helps prevent machine-level secrets from entering a repository.
6. Run the first request
codex exec "Reply with exactly: connection successful"A valid response confirms the Base URL, API key, model identifier, and Responses API path. Test outside a complex repository first so setup errors are not confused with project-specific behavior.
7. Fix the four most common failures
401: the API key is not accepted
Confirm that the environment variable name exactly matches env_key. If you opened a new terminal, verify that the variable still exists.
404: the Base URL or API path is wrong
Use https://api.codexinfo.top/v1. Do not use a dashboard URL or manually append an incorrect Responses path.
The model does not exist
Copy the complete model identifier from the current dashboard. Model availability changes, so names in older tutorials may expire.
429 or insufficient balance
Check balance, rate limits, and request history. Avoid unlimited client retries because they amplify the failure.
For deeper troubleshooting, continue with the Codex CLI Custom API Setup guide.
8. What to compare before buying API credit
- The API endpoint is reachable from the region where your tools run
- The provider supports the Responses API used by Codex
- Current model identifiers, pricing, balance, and usage are visible
- API keys can be created, revoked, and monitored separately
- There is a clear support path for checkout or request failures
Official configuration sources
The user-level configuration, custom model provider, base_url, env_key, and Responses API details in this guide were checked against the official OpenAI Codex documentation:
Ready to start with step one?
Create an account, add credit, generate an API key, and then use the configuration in this guide.
Create a codexinfo.top account