Skip to main content

Installation

Official Download (macOS Version)

https://openai.com/en/codex/

Install via Command Line

npm install -g @openai/codex

Environment Variable Configuration

Configure Using Configuration Files

  1. Modify the ~/.codex/config.toml configuration file to add the following settings:
profile = "aihubmix"

[model_providers.aihubmix]
name = "aihubmix"
base_url = "https://aihubmix.com/v1"
personality = "pragmatic"
wire_api = "responses"

[profiles.aihubmix]
model = "gpt-5.2"
model_provider = "aihubmix"
model_reasoning_effort = "high"
  1. Modify the ~/.codex/auth.json configuration file to change the following settings:
{
  "OPENAI_API_KEY": "AIHUBMIX_API_KEY"
}

Configure via cc-switch

  1. Run CC-Switch and add the provider.
Codex 1
  1. Select “AiHubMix” from the preset list.
Codex 2
  1. Enter your key in the “API Key” field and click “Add” to save the settings.
Codex 3
  1. Return to the home page, select “AiHubMix” from the provider list, and click “Enable” to start using it.
Codex 4

Using Codex

Using in the Terminal

  1. Open the terminal, navigate to your project directory, and run the codex command.
cd /your/project/path
codex
  1. Set permissions as needed.
Codex 5
  1. Select the model you need based on your requirements.
Codex 6
  1. Input natural language; if you receive a normal response, the configuration is successful.
Codex 8

Using in the Codex Desktop Application

  1. Open the Codex desktop application and select the working directory.
  2. Enter the task in the input box; if you receive a normal response, the configuration is successful.
Codex 9

Useful Command References

Help Command

codex -h

Complete Command Options

Usage
  $ codex [options] <prompt>

Options
  -h, --help                 Show help information and exit
  -m, --model <model>        Specify the model to use (default: codex-mini-latest)
  -i, --image <path>         Path to the file containing image input
  -v, --view <rollout>       View previously saved session records
  -q, --quiet                Non-interactive mode, only prints the final output of the assistant
  -a, --approval-mode <mode> Override approval policy: 'suggest', 'auto-edit', or 'full-auto'

  --auto-edit                Automatically approve file edits; will still prompt for command confirmation
  --full-auto                Automatically approve edits and commands in sandbox environment

  --no-project-doc           Do not automatically include 'codex.md' file from the repository
  --project-doc <file>       Include specified Markdown file as context
  --full-stdout              Do not truncate stdout/stderr of command output

Dangerous Options
  --dangerously-auto-approve-everything
                             Skip all confirmation prompts and execute commands directly (no sandbox protection)
                             For use only in temporary local testing environments

Experimental Options
  -f, --full-context         Start in "full context" mode, loading the entire repository into context
                             and applying bulk edits in a single operation
                             Only compatible with --model parameter

Examples
  $ codex "Write and run a Python program that prints ASCII art"
  $ codex -q "Fix build issues"