Skip to content

OpenAI Codex Usage Guide

This guide introduces how to install and configure Codex to access Ya Code on your computer.

Introduction

Codex is an AI Coding Agent developed by OpenAI, mainly categorized into:

  • Codex CLI: Terminal-based version of Codex, GUI-less, focusing on coding.
  • Codex Desktop: Standalone application with a GUI, a comprehensive assistant to boost your productivity.

Codex Desktop Installation

Visit the Official Site to download and install.

Access in some areas may require a VPN. Recommended provider:

Peiqian Proxy立即前往

Other configuration steps are the same as Codex CLI.

Codex CLI Installation and Configuration

Prerequisites

  • Node.js version 18.x or higher installed.
  • Windows users are highly recommended to use WSL2.
  • Already created an access key on Ya Code.

Verify your environment:

bash
node -v

Install Codex CLI

bash
npm install -g @openai/codex

# If access is slow or blocked, run the following command:
npm install -g @openai/codex --registry https://registry.npmmirror.com

Verify:

bash
codex --help
codex --version

If Windows PowerShell hits script execution policy restrictions, run:

powershell
codex.cmd

# Or run the command in Administrator mode to permanently alter the execution policy:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

WARNING

If errors occur during installation or execution on Windows, please run cmd or PowerShell as an Administrator.

Configure Ya Code

Manual configuration file location:

  • macOS / Linux / WSL: ~/.codex/config.toml
  • Windows: %USERPROFILE%\.codex\config.toml

config.toml:

model_provider = "yacode"
model = "gpt-5.6-terra" # Default model, can be switched later
model_reasoning_effort = "xhigh"
disable_response_storage = true

[model_providers.yacode]
name = "Ya Code"
base_url = "https://yacode.xyz"
wire_api = "responses"
requires_openai_auth = true

Store the API Key in the same directory under auth.json:

json
{
  "OPENAI_API_KEY": "sk-xxx"
}

TIP

If the .codex folder doesn't exist, you can create it manually.

Common Commands

bash
# Interactive mode: resolve complex tasks with multi-turn dialogues
codex

# Non-interactive mode: suitable for programmatic task execution
codex exec "task description"
codex exec --full-auto "task description" # Allows modifying workspace files

Common interactive mode commands:

  • @filename: Reference a file
  • $skill: Use a skill
  • /model: Switch models and reasoning efforts
  • /plan: Switch to plan mode
  • /approvals: Set approval rules
  • /permissions: Configure command execution permissions
  • /review: Code review
  • /diff: View current diffs
  • /status: Check models, sandbox, tokens, etc.
  • /init: Generate AGENTS.md
  • /mcp: View MCP tools
  • /exit or /quit: Quit

Usage Security

Codex has two categories of security rules:

One-stop AI routing for more efficient ideas and work.