Codex CLI
Current Codex CLI custom-provider contract and its compatibility with ToyGate.
Current compatibility
Codex CLI custom providers use the OpenAI Responses API wire format. ToyGate currently exposes /v1/chat/completions, but does not mount /v1/responses. Therefore a direct Codex CLI custom-provider setup is not available yet: configuring the provider below will make Codex send requests that the gateway rejects as endpoint_not_supported.
Do not point OPENAI_BASE_URL at ToyGate for Codex, and do not use the legacy codex chat or --stream examples. They do not change Codex's current custom-provider wire protocol.
Official Codex provider shape
When ToyGate supports /v1/responses, configure ~/.codex/config.toml with a provider and a profile. Keep the gw_... key in an environment variable rather than in the file:
wire_api = "responses" is required by current Codex CLI. It is not a Chat Completions compatibility mode, so it must not be changed to chat for the current gateway.
Non-interactive command after Responses support
After the gateway implements the Responses endpoint, run Codex non-interactively with the named profile:
The model in the profile must be an enabled slug from the catalog, not an upstream model ID.
Troubleshooting
endpoint_not_supportedfor/v1/responses— expected with the current ToyGate runtime. Codex requires Responses API for custom providers, while ToyGate currently supports Chat Completions only.- HTTP 401 with
type: "authentication_error"andcode: null— once Responses support is available, the gateway received the header but rejected the key. Make sureTOYGATE_API_KEYstarts withgw_and exists in the client portal or admin panel without being revoked. 404 model_not_found— once Responses support is available, the configured slug is missing from the catalog or disabled. Pull the catalog withcurl <GatewayUrl/>/v1/catalog | jq '.data[].id'to see the live list.
Gateway URL: https://api.toygate.store