
Set up Codex CLI
Use the GPT models in your LaRouter plan with OpenAI's codex command in Terminal, on Mac, Windows or Linux.
Option A · Fastest
1-click setup file
Download one file and open it. It installs Codex CLI and connects it to LaRouter with your key. You need a LaRouter account with a plan.
Download the file
Loading your key…
The file is made in your browser and contains your key: don't share it, and delete it after use. Before changing a settings file it saves a copy next to it (names ending in .bak-…). Those copies can hold a key too, so delete them once everything works.
On Linux? Use the manual setup below: one command in a terminal.
Open the file
The first time you open a file from the web, your computer warns you. This is how to get past it.
macOS
1. Open the zip file in Downloads (Safari unzips it for you). Right-click the setup file, choose Open, then click Open again.

2. On macOS 15 and later you see "LaRouter setup" Not Opened instead. Click Done.

3. Go to System Settings > Privacy & Security, scroll to Security and click Open Anyway. Confirm, and the setup runs.

Windows
1. Open the .cmd file in Downloads. If a blue "Windows protected your PC" screen appears, click More info.

2. Click Run anyway. The setup runs in a window. Windows asks for permission a few times while the apps install: click Yes each time. The window says Done when it finishes.

This is the normal warning for any small file that isn't from an app store. You can open it in a text editor and read it first.
Check it works
When the file says Done, open a new Terminal window (PowerShell on Windows) and type the command it shows: claude or codex. Send any message: the reply comes through LaRouter.
Option B
Manual setup
Prefer to see every step, or on Linux? Set up Codex CLI by hand: the commands below already include your key when you are signed in.
The video is in Vietnamese; the written steps below are the same.
What you need
- A LaRouter account with a plan
- Codex CLI from OpenAI (install steps below)
- Nothing else to install: the setup command uses tools already on your computer
- About 2 minutes
How to install Codex for Terminal
curl -fsSL https://chatgpt.com/codex/install.sh | shpowershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"Loading your API key…
Connect Codex to LaRouter
Open Terminal. On a Mac, press Command + Space, type Terminal and press Return. On Windows, open the Start menu, type PowerShell and press Enter.
Copy the command for your computer, paste it into the window and press Enter.
Mac / Linuxcurl -fsSL https://larouter.lapage.vn/setup/codex.sh | LAROUTER_KEY='YOUR_API_KEY' bashSee what this command does
It downloads a short LaRouter script and runs it on your computer. The script adds LaRouter to your settings file, keeps everything else, and saves a backup first. Your key is passed in by the command and saved only in that file on your computer; it is never part of the script. Read the script
Wait for the message "Done. LaRouter is set up". Your other settings stay as they were, and a backup copy is saved next to them.
Check it works
Open a new Terminal window, type codex and press Enter.
Ask something simple, such as "Say hello". If you get an answer, it works.
Common problems
- Codex asks me to sign in to ChatGPT.
- Codex hasn't picked up the LaRouter settings yet. Quit Codex completely and open it again. If it still asks, run the command from step 2 again.
- I see "too complex to change automatically".
- Your settings file has a format the command won't touch, so nothing was changed. Use "Set it up by hand" below.
- I get error 401 or "unauthorized".
- The API key is wrong or has changed. Sign in on this page so your key is filled in, then run the command again.
- Terminal says "curl: command not found" (Linux).
- Some Linux computers don't have curl. Use this command instead; it does the same thing with wget.Mac / Linux
wget -qO- https://larouter.lapage.vn/setup/codex.sh | LAROUTER_KEY='YOUR_API_KEY' bash
The command didn't work? Set it up by hand
Open the hidden .codex folder. On a Mac, open Finder, press Command + Shift + G, paste the Mac address and press Return. On Windows, press Windows + R, paste the Windows address and press Enter.
Mac~/.codexWindows%USERPROFILE%\.codexOpen the file config.toml with TextEdit or Notepad. If it isn't there, create a new file with exactly that name.
Paste these two lines at the very top of the file. If the file already has lines that start with model = or model_provider =, delete them.
Top of the filemodel = "gpt-6.1-sol" model_provider = "larouter"Paste this block at the end of the file. If the file already has a block starting with [model_providers.larouter], delete that old block first.
End of the file[model_providers.larouter] name = "LaRouter" base_url = "https://i-larouter.lapage.vn/v1" wire_api = "responses" requires_openai_auth = false supports_standalone_web_search = true experimental_bearer_token = "YOUR_API_KEY" http_headers = { "x-openai-actor-authorization" = "larouter" }Save the file, then quit Codex and open it again.
Agent skills
Skills let your agent use more LaRouter models. Install one, then ask your agent in plain words.