Skip to main content
Codex is a powerful command-line interface (CLI) tool that provides AI-powered coding assistance directly from your terminal. It offers intelligent code suggestions, explanations, and debugging help to enhance your development workflow. By integrating Codex with Unbound Security AI Gateway, you can leverage these AI capabilities while maintaining enterprise-grade security, cost control, and compliance.

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

unbound setup codex
This sets the OPENAI_API_KEY and OPENAI_BASE_URL environment variables to route Codex through Unbound. To remove the Unbound configuration:
unbound setup codex --clear
Restart your terminal after setup. 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:
codex
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

# Start interactive mode
codex

# Ask a specific question
codex "How do I create a REST API in Node.js?"

# Get help with debugging
codex "Help me debug this Python function"

Troubleshooting

Common Issues

Codex not found after installation:
# Check if npm global bin is in your PATH
npm config get prefix
# Add to PATH if needed
export PATH="$(npm config get prefix)/bin:$PATH"
API key not recognized:
# Verify your environment variables
echo $OPENAI_API_KEY
echo $OPENAI_BASE_URL
# Once the setup is complete, open codex in a new terminal
Connection issues:
  • Ensure your Unbound API key is valid
  • Check that the base URL is correct
  • 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