Run Codex CLI with a Pay-As-You-Go Endpoint
Start with a small task and a spending limit
Codex CLI can help you explore a project, explain unfamiliar code, and prepare changes from your terminal. Connecting it to a pay-as-you-go endpoint makes usage visible, but it does not automatically make every session inexpensive. Your task size, model choice, and repeated requests still determine what you spend.
Before connecting anything, choose a modest first task, such as explaining one function or reviewing a small change. Decide how much you are comfortable spending on that test. A narrow task gives you a useful baseline before you let an agent investigate a larger repository.
Prepare your MyRelay key and check compatibility
Create a MyRelay account, then obtain your personal API key and review the available balance and spending controls. MyRelay gives one person one key and one budget across supported models, which can simplify tracking when you use several developer tools.
Before proceeding, check the current MyRelay instructions for Codex compatibility. Codex needs more than a service described as OpenAI-compatible: the endpoint must support the API behavior your installed Codex version expects, including the Responses API where required. General chat compatibility alone is not enough.
Also confirm the exact model identifier and any endpoint suffix required by the integration. The MyRelay API base is https://api.myapirelay.com, but you should follow its current Codex guidance rather than guessing whether an additional version segment is needed.
Point Codex at a separate custom provider
Install or update Codex CLI using its official installation instructions. Then consult the configuration reference for your installed version and define a custom provider for MyRelay. Keep this separate from your existing provider setup so you can switch back without rebuilding your usual configuration.
The essential choices are the provider endpoint, the supported API transport, the credential source, and the model identifier. Select that custom provider as the active provider for your test. Do not assume that changing the model alone redirects requests to MyRelay.
If you normally sign in to Codex with a ChatGPT account, distinguish that session from API-key authentication. Follow the documented custom-provider authentication flow so your test uses the intended relay key rather than your previous account setup.
Store your credential without exposing it
Provide your MyRelay key through the credential mechanism supported by your Codex configuration, such as an environment-based secret. Avoid placing the key in project content, prompts, screenshots, or shared terminal transcripts.
If your setup references an environment variable, make sure it is available to the terminal session that launches Codex. A key saved elsewhere on your computer may not be visible to that process. If authentication fails, check the credential source before repeatedly retrying requests.
Select one model and verify one request
For the first run, choose a supported coding model available through the relay, such as GPT-6.1 Sol, if the current Codex integration supports it. Copy its exact API identifier from MyRelay rather than treating the display name as a guaranteed identifier.
Open a small project and ask Codex to explain a limited section without editing files or running commands. Review the response, then inspect MyRelay's request records. Confirm that the expected model appears and check the reported tokens and cost.
A successful answer is only half the check. Matching request records help establish that traffic reached the intended endpoint and budget. If something looks wrong, stop and inspect the configuration before attempting a longer session.
Expand the task while keeping approvals deliberate
Once the connection is verified, try one small edit with clear acceptance criteria. Keep command execution and sensitive actions subject to appropriate approvals. Endpoint configuration does not replace Codex's local safety settings.
Review spending after each early session. Large inputs, long conversations, retries, and tool results can all increase usage. Start a fresh, focused session when earlier context no longer helps, and avoid asking for broad repository analysis when a specific file will do.
Build your routine around a simple loop: define a bounded task, review the proposed work, and check the cost. That makes pay-as-you-go coding easier to evaluate before it becomes a daily habit.