How to integrate RouterLink in Codex CLI

This documentation is provided for informational purposes only and demonstrates how to configure and use our API with third-party AI chat interfaces. Any third-party software, websites, or services mentioned are not operated, controlled, or endorsed by us.

Overview

This tutorial guides you through integrating RouterLink—WORLD3's decentralized AI model routing infrastructure—with Codex, a personal AI assistant you run on your own devices.

Purpose

RouterLink provides a unified API endpoint that routes requests to multiple AI model providers through a decentralized network. By integrating RouterLink with Codex, you gain access to a diverse range of large language models (LLMs) without managing multiple API keys or provider-specific configurations.

What You Will Learn

By completing this tutorial, you will:

  • Configure Codex to connect with RouterLink's API endpoint

  • Authenticate using your RouterLink API credentials with custom headers

  • Add and manage AI models available through the RouterLink network

  • Execute inference requests through Codex's conversational interface

Prerequisites

Before proceeding, ensure you have:

  • A RouterLink API key (obtain one from the Quick Start Guide)

  • A web browser with internet access

  • Basic familiarity with API configuration concepts

Introduction to Codex

Codex CLI is OpenAI’s coding agent that you can run locally from your terminal. It can read, change, and run code on your machine in the selected directory. It’s open source and built in Rust for speed and efficiency.Codex Key Features:

  • Terminal-based AI coding assistant

  • Natural language → code generation

  • Local execution with privacy

  • Multiple automation modes

  • Multi-language support

  • Debugging, refactoring & testing automation

  • Interactive workflow in CLI

Step 1: Install Codex

Install the newest LTS version of Node.js

After installation is complete, open the terminal (Windows users use PowerShell) and check the version number.

  • macOS, Linux, Windows:

Verify the installation.

If the version number is displayed correctly, the installation is successful.

Step 2: Configure Codex

Codex uses the config.toml file to parse provider parameters. Please locate and create/edit this file according to your operating system.

Edit or create config.toml file

On macOS & Linux: ~/.codex/config.toml

On Windows: C:\Users\<USERNAME>\.codex\config.toml

Delete the previous content and replace it with the following.Configuration file:

You can replace the "model" field with any model that is compatible with the OpenAI format.

Step 3: Codex Loading and Validation

Open the terminal (Windows users use PowerShell). Replace ${API_KEY} below with your key (obtain one from the Quick Start Guide).

  • macOS, Linux,

  • Windows PowerShell:

Launch codex

Select "Yes" to trust this folder.

Now you can use Codex.

Last updated