> ## Documentation Index
> Fetch the complete documentation index at: https://liaobots.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate CodeX

<img src="https://mintcdn.com/liaobots/YPQypY9BkVNBlUi7/images/API/CodeX/codex-cli-splash.png?fit=max&auto=format&n=YPQypY9BkVNBlUi7&q=85&s=ff5c807c2782668d10f11c16744fabc6" alt="CodeX" width="2936" height="1734" data-path="images/API/CodeX/codex-cli-splash.png" />

## Preparation

CodeX billing method is synchronized with official. For price ratio, please refer to [Models & Pricing](/Aggregation/Model-Price). For API addresses and backup URLs, see [API Call Examples](/Getting-Started/en/API)

## Process

<Steps>
  <Step title="Step 1 - Install Node.js">
    <Card title="Verify Node.js Installation" img="https://mintcdn.com/liaobots/pAzQwH2vlz1d7UuQ/images/API/ClaudeCode/step-1.png?fit=max&auto=format&n=pAzQwH2vlz1d7UuQ&q=85&s=b0fc3c368ebf529188afeb00fef69b94" width="2032" height="1330" data-path="images/API/ClaudeCode/step-1.png">
      Open terminal and enter `node --version` and `npm --version` to verify Node.js installation
      If you see a version number like `v22.16.0`, proceed to the next step. Otherwise, please download from the official website [https://nodejs.org/en/download/](https://nodejs.org/en/download/)
    </Card>
  </Step>

  <Step title="Step 2 - Install CodeX">
    <Card title="Install CodeX" img="https://mintcdn.com/liaobots/YPQypY9BkVNBlUi7/images/API/CodeX/step-2.png?fit=max&auto=format&n=YPQypY9BkVNBlUi7&q=85&s=f864ec1d6e7c3e50ea200fa5e5ba6c13" width="1318" height="821" data-path="images/API/CodeX/step-2.png">
      Open terminal and enter `npm i -g @openai/codex` to install CodeX globally
      After successful installation, use the `codex` command in the target folder path (such as the folder where you will create/modify code)
      As shown in the image, installation is successful (this is just to check if installation is successful, no interaction is needed, just use `Ctrl+C` to exit after successful startup)
    </Card>
  </Step>

  <Step title="Step 3 - Create Configuration File">
    <Card title="Edit Configuration File">
      Navigate to `~/.codex` path, create or edit the `config.toml` file with the following configuration:

      ```toml config.toml theme={null}
      model = "gpt-5.4"
      model_reasoning_effort = "xhigh"
      service_tier = "fast"

      model_context_window = 900000
      model_auto_compact_token_limit = 800000
      tool_output_token_limit = 128000
      model_provider = "liao"

      [model_providers.liao]
      name = "liao"
      base_url = "https://ai.liaobots.work/codex/v1"
      env_key = "LIAO_API_KEY"
      wire_api = "responses"
      request_max_retries = 4
      stream_max_retries = 5
      stream_idle_timeout_ms = 300000
      ```

      Then create a `.env` file in the `~/.codex` path with the following content:

      ```.env theme={null}
      LIAO_API_KEY=Your Authcode
      ```

      <Note>
        `model_context_window` and `model_auto_compact_token_limit` are only supported with 1M context by `gpt-5.4`. If using other models (e.g. `o3-pro`), comment out these two lines or you may get errors.
      </Note>
    </Card>
  </Step>

  <Step title="Step 4 Start Using">
    <Card title="Start Using" img="https://mintcdn.com/liaobots/YPQypY9BkVNBlUi7/images/API/CodeX/step-4.png?fit=max&auto=format&n=YPQypY9BkVNBlUi7&q=85&s=6916b860987939cc2b8d16d0d2320b22" width="1198" height="742" data-path="images/API/CodeX/step-4.png">
      Use the cd command to enter the project folder you want to edit, enter `codex`, and then you can start using CodeX
    </Card>
  </Step>
</Steps>
