Codex CLI

Current Codex CLI custom-provider contract and its compatibility with ToyGate.

Integrations

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:

toml
[model_providers.toygate]name = "ToyGate"base_url = "https://api.toygate.store/v1"env_key = "TOYGATE_API_KEY"wire_api = "responses"[profiles.toygate]model_provider = "toygate"model = "gpt-5.5"
export TOYGATE_API_KEY="gw_..."

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_supported for /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" and code: null — once Responses support is available, the gateway received the header but rejected the key. Make sure TOYGATE_API_KEY starts with gw_ 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 with curl <GatewayUrl/>/v1/catalog | jq '.data[].id' to see the live list.

Gateway URL: https://api.toygate.store