Skip to main content
Codex is a command-line tool that brings AI coding assistance to your terminal — code suggestions, explanations, and debugging help. Integrating it with Unbound Security AI Gateway adds enterprise-grade security, cost control, and compliance.

Integration Options

Unbound provides two ways to integrate Codex depending on your needs:
  1. Using API Key: Use Codex through Unbound Gateway without needing your own OpenAI subscription
  2. With OpenAI Account: Keep your existing OpenAI subscription and add Unbound for tracking and analytics

Prerequisites

Before setting up the integration, ensure you have:
  • Unbound CLI: Installed and logged in — see the CLI guide
  • Node.js: Version 20 or higher
  • Codex CLI: Install with npm install -g @openai/codex

Setup with Unbound CLI

You’ll be prompted to choose a mode:
  1. Subscription — Keep your OpenAI subscription, add Unbound for policy enforcement and analytics
  2. Gateway — Use Unbound as the AI provider (no OpenAI subscription needed)
You can also skip the prompt:
To remove the Unbound configuration:
After setup, restart your terminal. When you open Codex for the first time, select “Provide your own API Key” and press Enter — the key is already configured.

Usage

Basic Usage

Once configured, you can start using Codex in your terminal:
This launches the interactive Codex interface where you can:
  • Ask coding questions
  • Get code suggestions
  • Request explanations for existing code
  • Debug issues with AI assistance

Example Commands

Troubleshooting

Common Issues

Codex not found after installation:
API key not recognized:
Connection issues:
  • Ensure your Unbound API key is valid
  • In gateway mode, check openai_base_url in ~/.codex/config.toml
  • Verify your internet connection

Security Benefits

Using Codex with Unbound Security AI Gateway provides:
  • Request Monitoring: All AI requests are logged and monitored
  • Cost Control: Set spending limits and track usage
  • Compliance: Ensure AI interactions meet your organization’s standards
  • Guardrails: Apply security policies to AI responses
  • Audit Trail: Complete visibility into AI usage patterns

Unbound CLI

Install the CLI to set up and manage tools

Tool Policies

Configure security guardrails for AI tools