Skip to content

OpenCodex: NordRouter in Codex CLI

OpenCodex is a third party local proxy for Codex and Claude Code. It accepts Codex requests in Responses API format and translates them to OpenAI-compatible /chat/completions, so for Codex it is more reliable than directly connecting to NordRouter via /responses.

When you need it

Use OpenCodex if you want to run the regular Codex CLI with NordRouter models. For OpenCode, Cline, Roo Code and other clients, such a proxy is not needed: they connect to NordRouter directly.

OpenCodex is not a product of NordRouter or OpenAI. Source code and releases:lidge-jun/opencodex.

Installation

Requires Node.js 18 or later. Install OpenCodex globally:

The instructions have been tested with the version 2.7.31:

bash
npm install -g @bitkyc08/opencodex@2.7.31

Create a configuration file:

  • Windows: %USERPROFILE%\.opencodex\config.json;
  • macOS/Linux: ~/.opencodex/config.json.
json
{
  "port": 10100,
  "defaultProvider": "nordrouter",
  "providers": {
    "nordrouter": {
      "adapter": "openai-chat",
      "baseUrl": "https://nordrouter.com/v1",
      "authMode": "key",
      "apiKey": "${NORDROUTER_API_KEY}",
      "defaultModel": "anthropic/claude-sonnet-4.6"
    }
  }
}

Do not paste the key into the instructions or screenshot

In the example, the key is read from NORDROUTER_API_KEY rather than stored in JSON. OpenCodex runs locally, but still has access to your API key and can change Codex configuration. Install it only from the specified repository and npm package.

Set the API key

PowerShell, for the current window only:

powershell
$env:NORDROUTER_API_KEY = "sk-nr-ВАШ-КЛЮЧ"

macOS/Linux, only for the current terminal:

bash
export NORDROUTER_API_KEY="sk-nr-ВАШ-КЛЮЧ"

If OpenCodex is running as a background service, the variable must be accessible to that service, not just the current terminal.

Launch

bash
ocx start

ocx start works in the current terminal and synchronizes models when launched. Leave it running and open Codex in a second terminal:

The OpenCodex panel is available locally at http://localhost:10100. By default, the proxy only listens to 127.0.0.1; do not change the address to 0.0.0.0 unless you need access from other devices.

bash
codex -m "nordrouter/anthropic-claude-sonnet-4.6"

For NordRouter models, the source ID contains /. In the Codex list, OpenCodex replaces internal / with -, so the model anthropic/claude-sonnet-4.6 appears as nordrouter/anthropic-claude-sonnet-4.6. The request to NordRouter automatically includes the original ID.

Checking and updating models

OpenCodex gets the list of models from the secure endpoint NordRouter /v1/models. After changing the directory, run:

bash
ocx sync

If the models do not appear:

  1. check that the variable NORDROUTER_API_KEY is set in the same environment;
  2. check the Base URL - it should end exactly at /v1;
  3. execute ocx doctor, then ocx sync;
  4. first check the key with a regular query fromquick start.

Support for tools, images and reasoning levels depends on the selected model. OpenCodex translates the protocol, but does not add capabilities to the model that it does not have.

How to completely remove OpenCodex

bash
ocx uninstall
npm uninstall -g @bitkyc08/opencodex

According to the project documentation, ocx uninstall stops the local proxy, removes the service and shim, restores the original Codex configuration and deletes the ~/.opencodex directory.

Codex CLI direct connection·All programs