RuntokenDocs

Codex

Revision 1 · Updated 2026-11-12 · 3 min read

Connect Codex CLI to Runtoken.

Prerequisites#

Before you start, prepare:

  • A working Codex CLI installation; run codex --version. See the official installation instructions if needed.
  • A Runtoken platform API key.
  • A model ID supporting Responses and the tools required by your coding task.

Connection settings#

Open your user configuration at ~/.codex/config.toml. If you set a custom CODEX_HOME, use the configuration under that directory instead. Merge the following provider table into the existing TOML file; do not replace other settings or create a duplicate table.

config.toml · provider definitiontext
[model_providers.runtoken]
name = "Runtoken"
base_url = "https://api.runtoken.net/v1"
env_key = "RUNTOKEN_API_KEY"
wire_api = "responses"

The provider definition contains no secret. Set its credential in the terminal used to launch Codex.

ConfigurationValuePurpose
Provider IDruntokenSelects the table defined above.
base_urlhttps://api.runtoken.net/v1Forms the Responses endpoint; do not append /responses here.
env_keyRUNTOKEN_API_KEYNames the environment variable containing your platform key.
wire_apiresponsesUses the Responses protocol.

A Chat Completions model cannot be substituted just by changing its ID. Use the Responses route for this configuration.

Set credentials and launch#

Open a separate terminal in a small test project. The launch below selects Runtoken for this invocation without changing your default provider.

bash
export RUNTOKEN_API_KEY="YOUR_PLATFORM_KEY"
codex -c 'model_provider="runtoken"' --model "YOUR_MODEL_ID"

Replace YOUR_PLATFORM_KEY with a platform key and YOUR_MODEL_ID with the exact Responses model ID from the Runtoken catalogue. Do not put either placeholder into a real credential store unchanged. Keep real keys out of prompts, screenshots and shared files; commands containing a key can remain in shell history.

Check the connection and file task#

In the interactive session, run /status and check the selected model and provider information. Send a short request, then locate the matching Runtoken request record by time, model and key. A saved sign-in status alone does not establish which inference route was used.

Try the following task in the test project.

Check a coding round triptext
Create greeting.py with a greet(name) function returning "Hello, " plus name.
Read the file back and explain it. Do not install packages or use the network.

Inspect the proposed file changes and keep the normal permission controls. In the same session, ask Codex to return "Hello, friend" for an empty name. Check the resulting file and the second request record as well as the text reply.

Capabilities and limits#

Runtoken inference is stateless. Do not build gateway integration around server-retained response IDs or background mode. A text response does not establish compatibility with every tool schema, compaction operation or reasoning option sent by a client.

FeatureWhat determines availability
Responses streaming and tool callsSelected model, gateway route and client request format.
Context compactionThe client's compaction protocol and the selected model's supported interface.
Hosted search, image generation or other model toolsExplicit support for that tool; changing the provider does not enable it.
Local file edits and shell commandsClient permissions and the tools the model can use.

Do not enable a provider capability or enlarge a context limit solely to suppress an error. Such settings do not add server-side support.

Troubleshooting#

Use the reported path and error details to separate configuration failures from model failures.

SymptomWhat to check
Missing environment keySet RUNTOKEN_API_KEY in the launching terminal; do not print its value to diagnose it.
Request goes to the default providerCheck the launch override and effective configuration.
404Check the base URL and reported model or route; the status alone does not identify the cause.
Unknown field or rejected protocolCompare the field with your CLI version's official configuration reference.
Text works but a file task failsInspect the rejected tool fields and model support.
429 or interrupted streamRead the limit/reset information; retain partial results before deciding to retry.

Restore settings and further reading#

Close the test terminal and launch without the provider override to return to your normal selection. Remove only the added provider table if you no longer need it; retain unrelated configuration and sign-in data.

See OpenAI Responses for the API and official Codex configuration for client settings.

Was this page helpful?