Codex CLI / App

codex

Codex connects to XSI through a custom provider using the Responses protocol. Once ~/.codex/config.toml and the environment variable are set up, Codex CLI and Codex App share the same connection settings.

Configuration

Config file location: ~/.codex/config.toml on Linux / macOS, %USERPROFILE%\.codex\config.toml on Windows.

model_provider = "xsi"
model = "gpt-6.2-sol"
approval_policy = "on-request"
sandbox_mode = "workspace-write"

[model_providers.xsi]
name = "XSI"
base_url = "https://api.xsicontrol.com/v1"   # or your own API domain
wire_api = "responses"
requires_openai_auth = false
env_key = "XSI_API_KEY"
supports_websockets = false

Set the key and launch:

export XSI_API_KEY="sk-Xvs..."
codex
$env:XSI_API_KEY="sk-Xvs..."
codex

Verify:

codex exec "Answer in one sentence: connection OK"

model can be any model in the price list that supports the Responses protocol. The Config Guide page in the Manage Console provides a one-shot setup script that fills in the key of the signed-in account.

Responses WebSocket

Set supports_websockets to true to use Responses WebSocket mode: only new input is sent over the same connection, which lowers latency and traffic for long sessions. The deployment's reverse proxy must support WebSocket; see Reverse Proxy.

Billing for interrupted turns:

  • HTTP mode: Codex drops the connection and resends the request with the full history. If the interrupted request did not receive upstream usage, XSI estimates the missing part from the most recent actual usage in the same session, billing the portion already cached in the session at the cache price.
  • WebSocket mode: When you interrupt by typing new input, Codex waits for the upstream to return actual usage. When you press Esc, XSI asks the upstream to abort; models whose upstream supports aborting are billed on the actual usage returned, and others are likewise estimated from session usage.

Enable WebSocket for long sessions with frequent interruptions; stay on HTTP if your network or proxy does not support WebSocket.

Sticky sessions

Codex sends a session identifier, which XSI uses to pin the session to the same upstream key. This raises the prompt cache hit rate and lowers cost, with no extra configuration.

Resources