Skip to main content
Codex CLI uses the OpenAI Responses API. For AIOHub, configure a separate aiohub provider and let Codex CLI read the API key from an environment variable.

Prerequisites

  • Codex CLI installed
  • An AIOHub sk- API key
  • A group assigned to the API key that can access the Codex / GPT model you want to use
  • A positive account balance
You can first confirm Codex CLI is installed:

Setup

1. Set the API key

Add this line to ~/.zshrc, ~/.bashrc, or your shell profile if you want it to persist.

2. Configure the provider

Edit ~/.codex/config.toml. Use a separate aiohub provider instead of overriding Codex CLI’s built-in openai provider. Configuration file locations:
Set base_url to the /v1 root, not /v1/responses. supports_websockets = false keeps Codex using Responses over HTTP/SSE, which matches the current AIOHub gateway setup.

Optional: sync Codex App sessions

If you want Codex App sessions to sync between your phone and computer, let the AIOHub provider depend on your official OpenAI account login. The key setting is requires_openai_auth = true. Sign in to the same ChatGPT account in Codex App on both your phone and computer, then use this configuration in ~/.codex/config.toml:
This configuration is for Codex App workflows that need OpenAI account session sync. If you only use AIOHub in Codex CLI, keep using the env_key setup above with requires_openai_auth = false.

Verify

Check that the environment variable exists without printing the API key:
Start Codex CLI and send a short prompt:
Common commands: You can also verify the gateway with the Responses API:

Configuration notes

Troubleshooting

Confirm base_url is https://api.aiohub.org/v1, AIOHUB_API_KEY is set, and your network can reach api.aiohub.org.
Check that the group assigned to your API key can access the requested model in the console.
Confirm model_provider = "aiohub" and keep AIOHub out of the built-in openai provider. With requires_openai_auth = false, Codex CLI uses the API key from the variable named by env_key.
Keep supports_websockets = false. Codex CLI will use Responses HTTP/SSE transport and will not require a Responses WebSocket gateway.
/v1/responses/compact is only for models or routes that support compact. A normal Codex CLI session should keep wire_api = "responses" and must not set base_url to /v1/responses/compact.

Official reference