Codex CLI on your server: installation and operation from Russia
Codex CLI is the OpenAI console agent: it lives in the terminal, reads your repository, edits files and runs commands. It does not work directly from Russia, and bypassing this on your computer is risky for your account. Below is a diagram in which your device does not bypass anything.
Idea in one paragraph
The agent runs on a rented server in a country where the service is available. You connect to this server and work on it. Your phone connects only to your own server; you don’t need to create any tunnels on it.
What you will need
Server: regular VPS from any provider, Linux, from one gigabyte of memory. This is enough for the agent, it works with the text and runs your commands.
OpenAI account with your subscription. It remains yours, so do the limits.
A way to reach the server from your phone. More on this below.
Installation
On a fresh Ubuntu, three lines are enough:
apt update && apt install -y nodejs npm git
npm i -g @openai/codex
codex
When you launch it for the first time, the agent will ask you to log in. Then it works in your environment: it sees your files, your variables, your keys.
If you already have a running agent on another machine, do not rewrite the commands manually. Give him access to the server and describe the task in words: install Codex, configure autorun, check that everything starts up after a reboot.
What does it look like without administrator skills?
Separate console, keys, autostart: usually people give up on this idea. In Remotai, the path is collected in one window.
- 1. We rented a server, received an address, login and password.
- 2. Opened Remotai in the browser and added the server via SSH. There is no need for a separate SSH client, the console opens right here.
- 3. Clicked “Install Remotai”. The application will show the command and open the server terminal in the same window. The installer will install the service, configure autostart and print the connection code.
- 4. Enter the code in “My Computers”. The server is included in the general list next to your computers.
- 5. Codex was installed in the same terminal.
From this point on, the server is no different from the home computer in the application, except that it does not turn off.
Try it
Opens in the browser, no application required. The first 7 days are free and without a card, then 900 ₽ per month.
Open web versionHow Codex differs from Claude Code in this scheme
For a server-based scheme, they are the same: both are console-based, both live in your environment, both require someone to answer their questions.
The difference is in behavior. Codex is usually more willing to rule right away, Claude Code is more likely to propose a plan and wait for confirmation. In practice, many people put both on the same machine: they compare on one task and switch when one of the services has limits or a failure. They will not interfere with each other, they are just two programs in the terminal.
How to approach an agent from your phone
An agent on the server is useless if you can't respond to it at the right time. He constantly asks: confirm the plan, select an option, allow writing to the file.
A regular SSH client solves the problem halfway. The connection breaks when switching between networks, and the session dies along with the process if you forget to start tmux. Esc and arrows live on a separate panel, which you hit with your finger once. Scrolling fights with the agent because it redraws the entire screen.
We made a tool for this task: the service on the server itself maintains the connection to the outside, the phone works as a remote control. The task survives the loss of connection, and the next time you connect you see the same screen.
How much does it cost per month
Server: approximately from 300 to 800 rubles. OpenAI subscription: at their rates, you have your own. Access from phone: 900 rubles per month, local work on your computer is free forever.
What this circuit doesn't do
It doesn't change your Internet access and doesn't tunnel anything for you. It does not cancel the rules of the service: the account is yours, the limits are yours, the terms are yours to read. And it is not free, the server charges money every month.
Frequently asked questions
Do you need a computer if there is a server?
No. The agent and files live on the server, a phone is needed to watch and respond.
Is it possible to put Claude Code next to it?
Yes, they don't conflict. An analysis of the neighboring scenario is in the article about Claude Code on your server.
What happens after a server reboot?
With autostart configured, the service will start on its own, and terminals with history will return.