Operate Codex CLI behind one governed boundary.
Use an isolated Codex profile, a workload key, and the gateway's Responses endpoint without changing the user's normal provider configuration.
Connect Codex CLI without putting a provider secret on the machine.
Use an isolated Codex profile so the governed base URL and workload key do not alter your normal provider configuration.
- 1Create a distinct workload
Use one key for one environment or agent. Attach the hard dollar cap, rate boundary, approved route, and fallback before sending a request.
- 2Keep the key out of the configuration file
Put
AIGHQ_API_KEYin the local keychain, CI secret, or workload secret manager. The example contains no real credential. - 3Prove both the allow and stop paths
Run a small smoke test, inspect its metadata-only receipt, then exercise the zero-balance block and provider-health fallback.
This setup uses an AI Gateway HQ workload credential. Requests are charged to the approved BYOK provider account or prepaid managed Bedrock balance selected by the route—not to a personal ChatGPT or Claude subscription allowance.
# Save as ~/.codex/aighq.config.toml; keep the key out of this file.
model = "company-approved-fast"
model_provider = "aighq"
[model_providers.aighq]
name = "AI Gateway HQ"
base_url = "https://api.aigatewayhq.com/v1"
env_key = "AIGHQ_API_KEY"
wire_api = "responses"
request_max_retries = 0
stream_max_retries = 0
# Then export AIGHQ_API_KEY and run: codex --profile aighqUse the exact production origin shown. Replace only the workload key and organization-approved alias supplied inside the customer console.
Client configuration was checked against the vendor's current published interface. Review the primary documentation before a broad rollout because client capabilities change independently of the gateway.
Status determines what can be configured.
Beta connections require customer validation against the exact model, payload, streaming mode, region, and provider account before production use.
AIGHQ_BASE_URL=https://api.aigatewayhq.com/v1
AIGHQ_API_KEY=from-your-workspace
AIGHQ_MODEL=company-approved-fastApplications keep a stable gateway URL and model alias while an administrator changes eligible provider accounts and models.
Only documented protocols become eligible.
Create a separate aighq profile file, supply its workload key through AIGHQ_API_KEY, and use the organization-approved model alias. A managed installer remains planned.
Compatibility is bounded to the provider's current published interface. Review the provider documentation before approving a production model.
Need the complete client-to-provider path? Follow the tested Codex CLI, AI Gateway HQ, and Groq setup