
Use TokenRex with OpenAI Codex CLI
Configure a custom provider in Codex CLI; a compatible Responses endpoint is required.
Setup checked against the linked documentation. Screenshots are reference examples from the tool's publisher, not proof of a TokenRex connection. Live execution inside this third-party app has not been tested; verify a short request before running larger tasks. TokenRex native /responses compatibility has not been established; do not treat this configuration as confirmed Codex support.
Before you start
- A private TokenRex API key
- An enabled model ID from Models & Pricing
- A supported version of the tool; review the method's protocol requirements
Setup methods
Named custom provider
- 1
Install Codex CLI using OpenAI's instructions and save TOKENREX_API_KEY in your private environment.
- 2
Merge the example into your user-level ~/.codex/config.toml. Project-local configuration cannot override provider or authentication routing.
- 3
Keep wire_api set to responses. Codex requires a compatible /responses endpoint; Chat Completions compatibility alone is insufficient.
- 4
Start codex, check the active provider and model, then send a short test before allowing repository actions.

OpenAI's Codex CLI example; this shows the interface, not TokenRex settings. Official source - 1Check the active provider and model before sending a task.
# ~/.codex/config.toml
model = "gpt-6-astra"
model_provider = "tokenrex"
[model_providers.tokenrex]
name = "TokenRex"
base_url = "https://tokenrex.ai/api/public/v1"
env_key = "TOKENREX_API_KEY"
wire_api = "responses"Override the built-in OpenAI endpoint
- 1
Use the documented openai_base_url setting in your user configuration to redirect the built-in OpenAI provider.
- 2
Supply the API key using that provider's documented API-key authentication flow. Do not mix an OpenAI subscription session with an unrelated gateway credential.
- 3
For token helpers or custom headers, use a named provider instead. Command-backed auth cannot be combined with env_key or requires_openai_auth.
# ~/.codex/config.toml
model = "gpt-6-astra"
openai_base_url = "https://tokenrex.ai/api/public/v1"Troubleshooting
- Authentication fails
- Check that the saved TokenRex key is active and belongs in the tool's API-key field, not its subscription sign-in. Remove accidental spaces, check your wallet balance, and never share the key in screenshots or exported settings.
- The model is missing or the request URL returns 404
- Copy an exact enabled model ID from Models & Pricing. Follow this method's URL field: some tools expect the versioned base, others the root or full completion address. Check the documented API protocol before changing the path.
- Chat works but streaming or tools fail
- Test a short plain-text conversation first. Confirm the selected model and installed tool version support the required protocol and capabilities. Enable agent actions only after separately checking streaming and tool calls.
Verify the connection
Send a short message with the selected model, read its response, then confirm the exact model appears in your TokenRex usage. Test streaming and tool use separately before larger agent tasks.