OmniRoute Remote VPS Deployment: Codex API Gateway, Auto-Fallback, and Caddy HTTPS

OmniRoute Remote VPS Deployment: Codex API Gateway, Auto-Fallback and Caddy HTTPS, covering configuration, validation, permission boundaries, failback and long-term maintenance.

This tutorial from OmniRoute only deals with the specific task in the title. For remote deployment, 20128 should only listen to the loopback address, and then Caddy provides TLS; Codex uses restricted endpoint tokens, and automatic fallback needs to be observable and cannot change models silently.

All the following operations are first placed in the test repository, test account or service that listens only on the loopback interface. The domain name, username, path and key in the command are placeholders and need to be replaced before execution.

The actual data path of the remote gateway

This section addresses the “actual data path to the remote gateway”. First record the current state, then perform the minimum action, and finally confirm the result with independent evidence.

For OmniRoute, the basis for judgment is: remote deployment should allow 20128 to only listen to the loopback address, and then Caddy should provide TLS; Codex uses restricted endpoint tokens, and automatic fallback needs to be observable and cannot change models silently. Don’t accidentally open more permissions at this stage.

1
docker version

Preserve command output and timestamp after execution. If the output depends on temporary variables in the current terminal, open a new terminal and check again.

Prepare Docker and persistent volumes on VPS

Process in the following order:

  1. Read the actual version and current configuration.
  2. Change only one setting relevant to this section.
  3. Run a read-only or revocable request.
  4. Check logs, exit codes, and final files.
  5. Revert the previous modification if it fails.
1
docker volume create omniroute-data

The completion criterion here is not that the interface appears, but that “Preparing Docker with Persistent Volumes on VPS” has repeatable results.

Let OmniRoute only listen on 127.0.0.1

What to check Acceptable performance Signals that you need to stop
Let OmniRoute only monitor 127.0.0.1 Clear input and output scope Automatically expand to other projects or accounts
Permissions Get only the permissions you need to complete the task Require administrator rights or full key
Log Failed to locate and has been desensitized Token, Cookie or private text appears
Rollback Can restore the previous state Modifications are irreversible and there is no backup
1
docker run -d --name omniroute --restart unless-stopped --stop-timeout 40 -p 127.0.0.1:20128:20128 -v omniroute-data:/app/data diegosouzapw/omniroute:latest

Once the stop signal in the table appears, undo the changes in this section first and do not continue with subsequent automation.

Read the model list for the first time

Prepare a success sample and a failure sample around “first read model list”. Successful samples verify the normal path, and failed samples verify whether the restrictions really take effect.

1
curl.exe http://127.0.0.1:20128/v1/models -H 'Authorization: Bearer YOUR_KEY'

It is recommended to record the following four items:

  • Pre-execution version or Git commit.
  • Actual input, no secret value recorded.
  • Observable output, status code or diff.
  • Recovery actions and review results after recovery.

If the cause of the failure is still unclear, modify only one variable at a time; do not change the port, runtime, provider, and proxy at the same time.

Minimum configuration of Caddy reverse proxy

This section addresses “Minimum Configuration of Caddy Reverse Proxy”. First record the current state, then perform the minimum action, and finally confirm the result with independent evidence.

For OmniRoute, the basis for judgment is: remote deployment should allow 20128 to only listen to the loopback address, and then Caddy should provide TLS; Codex uses restricted endpoint tokens, and automatic fallback needs to be observable and cannot change models silently. Don’t accidentally open more permissions at this stage.

1
caddy validate --config Caddyfile

Preserve command output and timestamp after execution. If the output depends on temporary variables in the current terminal, open a new terminal and check again.

Check certificate chain after issuing HTTPS

Process in the following order:

  1. Read the actual version and current configuration.
  2. Change only one setting relevant to this section.
  3. Run a read-only or revocable request.
  4. Check logs, exit codes, and final files.
  5. Revert the previous modification if it fails.
1
curl.exe -I https://ai.example.com/v1/models

The completion criterion here is not that the interface appears, but that “Checking the certificate chain after issuing HTTPS” has repeatable results.

Create a private access token for Codex

What to check Acceptable performance Signals that you need to stop
Create dedicated access token for Codex Clear input and output scope Automatically expand to other projects or accounts
Permissions Get only the permissions you need to complete the task Require administrator rights or full key
Log Failed to locate and has been desensitized Token, Cookie or private text appears
Rollback Can restore the previous state Modifications are irreversible and there is no backup
1
curl.exe https://ai.example.com/v1/models -H 'Authorization: Bearer YOUR_KEY'

Once the stop signal in the table appears, undo the changes in this section first and do not continue with subsequent automation.

How to choose auto routing and fixed models

Prepare a success sample and a failure sample around “how to choose auto routing and fixed models”. Successful samples verify the normal path, and failed samples verify whether the restrictions really take effect.

1
curl.exe http://127.0.0.1:20128/v1/chat/completions -H 'Content-Type: application/json' -d '{"model":"auto","messages":[{"role":"user","content":"ping"}]}'

It is recommended to record the following four items:

  • Pre-execution version or Git commit.
  • Actual input, no secret value recorded.
  • Observable output, status code or diff.
  • Recovery actions and review results after recovery.

If the cause of the failure is still unclear, modify only one variable at a time; do not change the port, runtime, provider, and proxy at the same time.

Provider observes rollback when limiting current

This section addresses “Observing rollback during provider current limiting”. First record the current state, then perform the minimum action, and finally confirm the result with independent evidence.

For OmniRoute, the basis for judgment is: remote deployment should allow 20128 to only listen to the loopback address, and then Caddy should provide TLS; Codex uses restricted endpoint tokens, and automatic fallback needs to be observable and cannot change models silently. Don’t accidentally open more permissions at this stage.

1
docker logs --since 10m omniroute

Preserve command output and timestamp after execution. If the output depends on temporary variables in the current terminal, open a new terminal and check again.

The compression function is evaluated offline first.

Process in the following order:

  1. Read the actual version and current configuration.
  2. Change only one setting relevant to this section.
  3. Run a read-only or revocable request.
  4. Check logs, exit codes, and final files.
  5. Revert the previous modification if it fails.
1
docker exec omniroute npm run eval:compression

The completion standard here is not the appearance of the interface, but the “compression function is evaluated offline first” with repeatable results.

Back up omniroute-data instead of just backing up the image

What to check Acceptable performance Signals that you need to stop
Back up omniroute-data instead of just backing up the image Clear input and output scope Automatically expand to other projects or accounts
Permissions Get only the permissions you need to complete the task Require administrator rights or full key
Log Failed to locate and has been desensitized Token, Cookie or private text appears
Rollback Can restore the previous state Modifications are irreversible and there is no backup
1
docker run --rm -v omniroute-data:/data -v ${PWD}:/backup alpine tar czf /backup/omniroute-data.tgz -C /data .

Once the stop signal in the table appears, undo the changes in this section first and do not continue with subsequent automation.

Let Codex switch back to the original endpoint in case of failure

Prepare a success sample and a failure sample around “let Codex switch back to the original endpoint in case of failure”. Successful samples verify the normal path, and failed samples verify whether the restrictions really take effect.

1
docker stop omniroute

It is recommended to record the following four items:

  • Pre-execution version or Git commit.
  • Actual input, no secret value recorded.
  • Observable output, status code or diff.
  • Recovery actions and review results after recovery.

If the cause of the failure is still unclear, modify only one variable at a time; do not change the port, runtime, provider, and proxy at the same time.

Differentiate gateway and upstream errors from Caddy logs

This section addresses “Differentiating gateway and upstream errors from Caddy logs”. First record the current state, then perform the minimum action, and finally confirm the result with independent evidence.

For OmniRoute, the basis for judgment is: remote deployment should allow 20128 to only listen to the loopback address, and then Caddy should provide TLS; Codex uses restricted endpoint tokens, and automatic fallback needs to be observable and cannot change models silently. Don’t accidentally open more permissions at this stage.

1
caddy validate --config Caddyfile

Preserve command output and timestamp after execution. If the output depends on temporary variables in the current terminal, open a new terminal and check again.

Limit the models that can be called by remote tokens

Process in the following order:

  1. Read the actual version and current configuration.
  2. Change only one setting relevant to this section.
  3. Run a read-only or revocable request.
  4. Check logs, exit codes, and final files.
  5. Revert the previous modification if it fails.
1
curl.exe https://ai.example.com/v1/models -H 'Authorization: Bearer YOUR_KEY'

The completion criterion here is not that the interface appears, but that “limiting the models that can be called by remote tokens” has reproducible results.

Simulate main Provider failure

What to check Acceptable performance Signals that you need to stop
Simulate the failure of the main Provider Clear input and output scope Automatically expand to other projects or accounts
Permissions Get only the permissions you need to complete the task Require administrator rights or full key
Log Failed to locate and has been desensitized Token, Cookie or private text appears
Rollback Can restore the previous state Modifications are irreversible and there is no backup
1
docker logs --follow omniroute

Once the stop signal in the table appears, undo the changes in this section first and do not continue with subsequent automation.

Fixed rollback label when upgrading image

Prepare a success sample and a failure sample around “Fixing rollback labels when upgrading images”. Successful samples verify the normal path, and failed samples verify whether the restrictions really take effect.

1
docker image ls diegosouzapw/omniroute

It is recommended to record the following four items:

  • Pre-execution version or Git commit.
  • Actual input, no secret value recorded.
  • Observable output, status code or diff.
  • Recovery actions and review results after recovery.

If the cause of the failure is still unclear, modify only one variable at a time; do not change the port, runtime, provider, and proxy at the same time.

OmniRoute FAQ

Is it possible to skip the test environment and use OmniRoute directly in the official project?

Not recommended. Complete at least one minimal success request, one intentional failure, and one recovery drill first.

The OmniRoute command can be run but the result is incorrect, where should I check first?

First check the input range, actual effective configuration and upstream response, and then check the model summary. A normal process does not mean that the business results are correct.

How to prevent OmniRoute keys or tokens from entering Git?

Use system environment variables, secret management, or configuration files outside the project, and search the diff before committing. Keys must be rotated after a breach is discovered.

What is the most common thing to miss when upgrading OmniRoute?

It is most easy to miss configuration format, default listening address, permission scope and cache compatibility. Save the version and verification samples before upgrading.

OmniRoute acceptance issue

Upon completion you should be able to answer the following questions:

  • Which exact version are you using?
  • Which directories, ports, accounts and external services can be accessed?
  • How to return the successful result to the original data or Git diff?
  • When the upstream fails, will it report an error, retry, or switch?
  • Is it possible that the key appears in logs or history?
  • How to return to the pre-modification state within ten minutes?

If any of these cannot be answered, OmniRoute is still in trial status and should not expand permissions or tap into production automation.