Open Source
All templates and components

App template

CLIProxyAPI

An OpenAI- and Gemini-compatible API proxy, with keys and a management page.

Memory when idle
about 20 MiB
CI measures it once the app is ready and before any traffic. Leave room for more.
Tested on
x86 servers

Introduction

CLIProxyAPI is an API proxy. Clients send OpenAI-style or Gemini-style requests to it, and it forwards them to the model providers you set up.

This template runs one CLIProxyAPI instance behind your domain. The API is protected by a key that is generated at deploy time. There is no web page and no sign-in. The management API is not on the domain.

Values you provide

You don’t fill in anything when you deploy.

Made for you

These values are generated at deploy and kept in a Kubernetes Secret, shown as Secret/key.

  • app-secrets/api-key
  • app-secrets/management-key

Getting started

  1. In Zeabur OSS, open the cliproxyapi service. When Overview shows its replica as ready, the service is up. Its domain is on the Networking tab under Public domains, for example cliproxyapi.example.com.

  2. Get the API key. Open Variables, click app-secrets under From config files and secrets, and click the eye icon next to api-key. Without Zeabur OSS, read Secret app-secrets, key api-key, with kubectl:

    kubectl -n <namespace> get secret app-secrets -o jsonpath='{.data.api-key}' | base64 -d
    
  3. Point your client at https://cliproxyapi.example.com/v1 (or /v1beta for Gemini-style clients) and send the key as a Bearer token. Calls without it get 401.

  4. Get the management key when you need it. It is the key management-key in the same app-secrets list, or with kubectl:

    kubectl -n <namespace> get secret app-secrets -o jsonpath='{.data.management-key}' | base64 -d
    

The API key only lets clients in. Credentials for the model providers are separate; see Configuration.

Configuration

Call the management API

The management API only accepts calls from inside the pod. Zeabur OSS has no screen for this, so open a tunnel with kubectl, then send the management key as a Bearer token:

kubectl -n <namespace> port-forward deployment/cliproxyapi 8317:8317 --address 127.0.0.1
curl -H 'Authorization: Bearer <management key>' http://localhost:8317/v8/management/config

See Management API v8.

Add a provider credential

Upload a credential file that the CLIProxyAPI login command created. With the tunnel from the previous item open:

curl -X POST -H 'Authorization: Bearer <management key>' \
  -F file=@<credential>.json \
  http://localhost:8317/v8/management/credentials

The file is stored on the volume and survives restarts. See Management API v8 and Authentication Directory.

Provider keys that you write through /config are kept only until the pod restarts, because the template builds the configuration file again on every start.

Troubleshooting

The management API returns 401 or stops answering

Five wrong keys in a row from one address ban that address for about 30 minutes. Check that you use the value of management-key, not api-key, and wait for the ban to end. See Management API v8.

The page shows 502 or does not load

Open the cliproxyapi service in Zeabur OSS. Check that Overview shows its replica as ready, then read the Logs tab. If the replica is not ready, open Deployments and switch to Events. If Events show OOMKilled, the service ran out of memory. Raise Maximum memory under Settings → Compute. If the domain or the certificate stays pending, see Troubleshooting on the domains page.

Without Zeabur OSS, read the logs with kubectl -n <namespace> logs deployment/cliproxyapi and the events with kubectl -n <namespace> get events --sort-by=.lastTimestamp.

See Adjust replicas, resources, and health checks and View logs, events, and usage, and open a terminal in the Zeabur OSS docs.

Requests fail with a model provider error

The api-key only lets your client in. The provider needs its own credential, as in Add a provider credential. When a request fails, read the Logs tab of the cliproxyapi service, then check three things. The model name in the request must be one that a credential you added can use. That credential must still be valid. And its account must not be over its rate limit or quota at the provider. See Authentication Directory in the CLIProxyAPI docs.

Resources

Each service is guaranteed the first amount and can use up to the second.

  • cliproxyapi

    Ports

    8317

    CPU

    0.1 cores to 1 core

    Memory

    256 MiB to 1 GiB

Technical details

This release

Version
v8.0.75
Licence
MIT
Homepage
github.com

Tested in CI

CI installs these exact files on a new cluster, waits until they are ready, then records the idle memory.

DistributionPlatformKubernetesPassedIdle memory
kindlinux/amd64v1.37.019 MiB

Security

CLIProxyAPI runs as a restricted non-root workload. The root filesystem is read-only, there is no service-account token, and extra capabilities are dropped. HTTPS ingress comes only from Traefik. Outbound traffic is not limited.

Known risks

  1. Risk

    OAuth refresh tokens give access to your upstream provider accounts. The provider's subscription terms may also limit proxying.

    How it is handled

    Use only accounts that you own and are allowed to proxy. The credentials sit on the private PVC, so encrypt any backup of it. Sign in with the native device login through kubectl exec. The callback ports are not exposed.

  2. Risk

    API keys can use up your account quotas. The management interface can read and change sensitive proxy settings.

    How it is handled

    Client keys and management keys are generated separately. The ingress exposes only /v1 and /v1beta. Remote management and the downloadable control panel are turned off. To manage the proxy, run kubectl -n NAMESPACE port-forward deployment/cliproxyapi 8317:8317 --address 127.0.0.1 and do not publish the tunnel.

What the cluster needs

Zeabur OSS suggests the components a cluster is missing. Without it, install them first.