Install CPA Proxy on Oracle VPS Ubuntu Guide

Now CPA installation tutorials are everywhere.
Here I want to record my own operation process. Oracle VPS, Ubuntu system, using a non-root user, without sudo -i 

Official installation script
curl -fsSL https://raw.githubusercontent.com/brokechubb/cliproxyapi-installer/refs/heads/master/cliproxyapi-installer | bash

Pay attention to the information output by the script
After the one-click install script finishes, follow the prompts to view output

Execute command #1, enter your installation directory
cd /home/ubuntu/cliproxyapi
* If you are a root user, this directory will be different from mine, use your own directory as the reference

Execute command #2, check whether the cpa background process can run, and whether there are any errors
./cli-proxy-api

Open a new SSH session, test with curl
curl localhost:8317
* Note: 8317 is the default port for cpa

You should get a result like this
{"endpoints":["POST /v1/chat/completions","POST /v1/completions","GET /v1/models"],"message":"CLI Proxy API Server"}
At the same time, the SSH session running cpa has a new line of log printed

cpa core running on port 8317

At this point, the cpa core is running.

First, stop the cpa background process with ctrl+c 
Modify the ./config.yaml configuration file 
Set the following 2 items 
  allow-remote: true
  secret-key: "your password"
allow-remote and secret-key set in config.yaml
* Note that the leading space indentation in the yaml file is meaningful and should not be changed arbitrarily.
* Note that you need to remember your password separately, because after cpa runs once, it will hash the plaintext password and save it in the config file. When you open the config file later, you will only see the garbled text after hashing.

Use command #3 to run the cpa background as a service
systemctl --user enable cliproxyapi.service
systemctl --user start cliproxyapi.service
Then use your own browser to access
http://your VPS IP:8317/management.html
The cpa management page should open

Enter the admin password you just set in the config file, you should log in successfully.
Open management.html and log in with the admin password

CPAMC panel showing cpa connected

Configure domain and TLS certificate

I use the caddy reverse proxy solution 
Config file Caddyfile
your domain
{
    tls Y3JhenlwZWFjZQ@gmail.com
    reverse_proxy localhost:8317 {
        header_up Host {upstream_hostport}
    }
}
After the configuration is successful, you can use https://your domain/ to log in and use cpa

In terms of security, you also need to delete api-keys with weak password strength
delete api-key with too-weak password strength


Add a public service

AI Provider - OpenAI-compatible provider
Adding an OpenAI-compatible free community provider

base url - api key - get from /models
Fill in base url and API key, fetched from /models

Select your favorite model
check the models to use then add

Add to your own Openclaw

Model/auth provider
Custom Provider

API Base URL
https://your cpa domain/v1

* Note: If you haven't configured a domain and TLS certificate, then here it is http://your cpa IP:8317/v1 

How do you want to provide this API key?
Paste API key now

API Key (leave blank if not required)
sk-your cpa generated apikey

Endpoint compatibility
OpenAI-compatible

Model ID
gpt-5.4 (models supported by your cpa system)
Filling in self-hosted cpa Base URL and model ID in OpenClaw


========

Postscript


If you want to back up data, including the public services you have added, including the api keys you set for outbound provision, ... 
Just back up the config.yaml file.

Recommend turning on Config Panel - System Config - Usage Statistics
Turn on usage statistics in system configuration
You can see the number of tokens you have used, you can see different providers, how many requests were made, and how many succeeded and how many failed.

Important Reminder

When using a proxy/relay service, do not use it on your own important projects, do not involve your own important accounts, and do not let Agent run on your own important VPS.

========

Still want to read more


Comments