Connect Codex
Use Node 20 or newer, an installed Codex with first-time setup complete, a workspace API key, and available RunInfra credits.on again to refresh the saved model list.
Configure manually
Load your workspace API key intoRUNINFRA_API_KEY through your secret-management workflow. Keep it in the environment that launches Codex.
Back up ~/.codex/config.toml, then merge these settings into it. If you set CODEX_HOME, use config.toml in that directory. Keep the four model settings at the top level, outside the provider table.
env_key names the environment variable, not the key itself. Codex reads it at runtime and sends Bearer authentication. This credential form does not replace your saved sign-in.
Codex uses wire_api = "responses". The old chat value is not supported. Keep the base URL at https://api.runinfra.ai/v1; Codex appends /responses.
The example uses the published context window for deepseek-v4-flash and its supported medium effort. Update both when you change models. Effort values are model-specific: for example, glm-5-3-flash honors low and high, but refuses none.
Connect also supplies a model_catalog_json file for the picker. The manual example selects one model directly; it does not populate a picker catalog.
Verify
Load the same workspace key intoRUNINFRA_API_KEY in your terminal. This request uses credits and reads usage.input_tokens_details.cached_tokens. The macOS and Linux example uses jq.
- macOS and Linux
- PowerShell
0 is valid; a successful request does not guarantee a cache hit. This tests the API, not whether Codex has restarted or inherited the key environment.
RunInfra’s Responses endpoint is stateless. Resend the conversation rather than using previous_response_id. See OpenAI compatibility for tools, streaming, and accepted request fields.
Revert
If you used Connect:on, which may already contain RunInfra settings. If a managed file changed afterward, Connect refuses to overwrite it. Back up and review those edits before proceeding.
For manual setup, restore your previous model_provider, model, model_context_window, and model_reasoning_effort values. Remove the [model_providers.runinfra] table only if you added it for this setup. Check any project-level model pin as well, then restart Codex. The env_key configuration leaves your saved sign-in unchanged.
Connect’s logout removes only its saved credentials. It does not restore agent settings or revoke the workspace key. Revoke an unwanted key in the dashboard.
Related
Connect
Set up, inspect, and restore your coding agent.
OpenAI compatibility
Read the Responses contract and client examples.
Models
Find model ids and context windows.