Codex CLI
Codex CLI
Codex CLI
Prepare
Use a gateway root, a virtual key with model access and a public model name. Test GET /v1/models first.
Configure
Use ~/.codex/config.toml to select the custom provider below. Export XHUB_API_KEY in the same terminal, restart and select YOUR_MODEL_NAME. This configuration requires a Responses-capable deployment.
Verify and troubleshoot
Send “Hello, introduce yourself.” and inspect the call ID in XHub request logs. Verify streaming, tool calls and images separately against deployment capabilities. For 401 check the virtual key; for 403 check model scope; for 404 check the URL and duplicated /v1. Client settings vary by version.
Request example
model = "YOUR_MODEL_NAME"
model_provider = "xhub"
[model_providers.xhub]
name = "XHub"
base_url = "http://localhost:4000"
env_key = "XHUB_API_KEY"
wire_api = "responses"