Skip to main content
Use RunInfra models in Codex through the OpenAI-compatible Responses API.

Connect Codex

Use Node 20 or newer, an installed Codex with first-time setup complete, a workspace API key, and available RunInfra credits.
In an interactive terminal, Connect starts login if needed. Review and approve the proposed changes. Connect saves a snapshot, writes the provider settings and model catalog, and makes a real Responses request that uses credits. Follow the printed restart hint before using Codex. To choose a model during setup:
See Connect for key placement, status, diagnostics, and restore behavior. Run on again to refresh the saved model list.

Configure manually

Load your workspace API key into RUNINFRA_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.
Start a new Codex session:
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.
Provider keys are ignored in a project-level .codex/config.toml. Put model_provider and model_providers in your user configuration. A trusted project’s configuration can pin a model, but it cannot select or define the provider.
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 into RUNINFRA_API_KEY in your terminal. This request uses credits and reads usage.input_tokens_details.cached_tokens. The macOS and Linux example uses jq.
A count of 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:
This restores the snapshot from immediately before the most recent 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.

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.