Run Codex App Server as a Windows Service with AlwaysUp

How to Run Codex App Server as a Windows Service with AlwaysUp

Automatically start OpenAI's Codex App Server whenever your computer boots and keep it running healthy 24/7 in the background — no need to log in


Last Updated on September 18, 2026

Codex App Server is OpenAI's back-end harness that powers agent applications. It runs headless and accepts requests over the network, both of which make it ideal for running continuously as an always-available Windows Service.


To install and run Codex App Server as a Windows Service with AlwaysUp:

  1. First, ensure that the Codex CLI starts from a command prompt and works as expected. That's required to install it as a Windows Service.

    For this tutorial, we deployed Codex with npm. This is the command we use to start Codex in app server mode, listening locally on port 4500:

    "C:\Users\[USER-NAME]\AppData\Roaming\npm\codex" app-server --listen ws://127.0.0.1:4500

    Codex App Server running

    Note: If you deployed Codex with npm like we did, you can choose to run the codex executable directly instead of going through Node.js. This very lengthy command also worked in our setup:

    "C:\Users\[USER-NAME]\AppData\Roaming\npm\node_modules\@openai\codex\node_modules\@openai\codex-win32-x64\vendor\x86_64-pc-windows-msvc\bin\codex.exe" app-server --listen ws://127.0.0.1:4500

    But we'll stick with the simpler command line for this guide.

  2. Download and install AlwaysUp, if necessary.

  3. Start AlwaysUp.

  4. Select Application > Add to open the Add Application window:

    Add Application

  5. On the General tab:

    1. In the Application field, enter the full path to Codex. You found this when you built your command line in step 1.

      Note that we added the ".cmd" suffix to our path, to make it clear that we were invoking the Windows CMD script that launches Codex.

    2. In the Arguments field, enter your parameters to Codex (again, from step 1).

    3. In the Start the application field, select Automatically, but shortly after the computer boots.

      This setting — which delays Codex by a couple of minutes after a reboot — will ensure that critical system services (like networking and security) up and ready before AlwaysUp launches the server.

    4. And in the Name field, enter the name that you will call the application in AlwaysUp. We'll go with Codex App Server but feel free to specify another name if you like:

    Codex Windows Service: General Settings

  6. Move to the Logon tab and enter the user name and password of the Windows account where you installed Codex. It's best to run in this account so that Codex and Node can find their settings:

    Codex Windows Service: Logon Settings

  7. Next, let's set up a web server health check to keep an eye Codex. If Codex ever stops responding, we want AlwaysUp to restart it.

    1. On the Monitor tab, check the Whenever it fails a periodic sanity check box and click the Set button on the right:

      Codex Windows Service: Enable sanity check

    2. In the Add Sanity Check window, select the Check that a web server is responding properly option and click Next to proceed:

      Codex: Choose the web server sanity check

    3. Enter the Codex health check URL. On our machine, where Codex is running on port 4500, that's:

      http://127.0.0.1:4500/healthz

      Codex: Set the URL to check

      Click Next to continue.

    4. On this page, specify how often AlwaysUp should ping the HTTP connection. Every 5 minutes (the default) should be fine but feel free to have AlwaysUp check more or less often as you like.

      After you're done, click Next to move on:

      Codex: Specify how often to run the health check

    5. And finally, review and confirm your settings:

      Codex: Confirm your web server sanity check settings

      If everything looks good, click Add to record your new sanity check and return to the Monitor tab.

  8. We're done configuring Codex App Server so click the Save button to record your settings. In a couple of seconds, an entry named Codex App Server (or whatever you called it) will show up in the AlwaysUp window.

    At this point, Codex is installed as a Windows Service but it's not yet running. The state will be "Stopped":

    Codex App Server Windows Service: Installed

  9. To launch the service, choose Application > Start "Codex App Server". The state swill transition to "Running" and Codex will start working in app-server mode:

    Codex App Server Windows Service: Running

    Now is a good time to confirm that the app server is working as expected. For example, can you connect to it from a terminal? That worked great on your machine:

    Codex app-server working as a service

  10. That's it! Next time your computer boots, Codex App Server will start up immediately, in the background, without anyone needing to log on. Please restart your machine and test that everything works properly after Windows comes back to life.

    And please feel free to edit Codex App Server in AlwaysUp and explore the many other settings that may be appropriate for your environment.

    For example, you can:


Codex App Server not working properly as a Windows Service?

  • Consult the AlwaysUp Troubleshooter — our online tool that can help you resolve the most common problems encountered when running an application as a Windows Service.

  • From AlwaysUp, select Application > Report Activity > Today to bring up an HTML report detailing the interaction between AlwaysUp and Codex CLI. The AlwaysUp Event Log Messages page explains what each message means.

  • Browse the AlwaysUp FAQ for answers to commonly asked questions and troubleshooting tips.

  • Contact us and we will be happy to help!

Our 14,000+ customers include...
AlwaysUp is fully compatible with Windows 11 AlwaysUp is fully compatible with Windows Server 2025
Over 97,000 installations, and counting!
 
AlwaysUp is number 1! Run as a Service with AlwaysUp

Rock-solid for the past 20+ years!