cliproxyapi

by alekc

Helm chartv2.1.7App v8.1.7MITVerified publisher

OAuth bridge exposing Antigravity, Codex, Claude Code and Grok subscription accounts as an OpenAI-compatible upstream, for gateways (litellm, etc.) that have no OAuth flow of their own.

About this chart

cliproxyapi

OAuth bridge exposing Antigravity, Codex, Claude Code and Grok subscription accounts as an OpenAI-compatible upstream, for gateways (litellm, etc.) that have no OAuth flow of their own.

Overview

CLIProxyAPI holds one or more browser-OAuth credentials (Antigravity, Codex/ChatGPT, Claude Code, Grok) and re-serves the accounts behind them as an ordinary OpenAI-compatible /v1/models + /v1/chat/completions API. Point any gateway that has no OAuth flow of its own (litellm, for example) at this Service as a plain upstream; the subscription's rotating token never has to leave this pod.

This chart deploys the proxy only. It does not create, log in, or authorize any credential, and it does not render config.yaml for you, see "Configuration" below.

Installing

There's no fullnameOverride, resource names follow the release name so a second account/instance in the same namespace doesn't collide. The commands in this README assume you installed with a release name that matches the chart, helm install cliproxyapi . (or --generate-name avoided), which resolves to a plain cliproxyapi for every resource. Install under a different release name and everything below still works, just substitute your release name for cliproxyapi in the commands.

From the classic chart repository:

helm repo add alekc https://charts.alekc.dev
helm repo update
helm install cliproxyapi alekc/cliproxyapi

Or directly from the OCI registry, no helm repo add needed:

helm install cliproxyapi oci://charts.alekc.dev/cliproxyapi --version 0.3.1

Nothing serves requests yet: see "Configuration" below before the pod can start, and "Authentication" before it can proxy anything.

Verifying the signature

curl -sO https://charts.alekc.dev/pubring.gpg
helm pull oci://charts.alekc.dev/cliproxyapi --version 0.3.1 --verify --keyring pubring.gpg

Configuration

persistence.config ships disabled. The binary needs /config/config.yaml to start at all, and this chart never creates the Secret it would mount there, so installing with the default values gives you a pod that can't come up. Before enabling it:

  1. Create the Secret yourself (kubectl create secret, an ExternalSecret, a SealedSecret, whatever fits your cluster), named to match persistence.config.objectName (default cliproxyapi-config), with at least a config.yaml key shaped like:
host: ""
port: 8317
auth-dir: "/root/.cli-proxy-api"
remote-management:
  allow-remote: false
  secret-key: ""
api-keys:
  - "<a bearer token your consumers will send>"
routing:
  strategy: "fill-first"
debug: false
  1. Set persistence.config.enabled: true (and objectName too, if you named the Secret something else). Only then will the pod start.

remote-management.secret-key must stay empty unless you want the management API writing back to this Secret's mount, which is read-only here on purpose. api-keys is the only thing standing between an unauthenticated caller and your subscriptions, treat it like a password.

Writable config

The management API saves changes (API keys, provider settings) by rewriting config.yaml in place, which fails on the read-only Secret mount. A web UI such as the cliproxyapi-dashboard chart needs those saves to stick. Set configWritable.enabled: true (it requires persistence.config.enabled: true) and the chart:

  • moves the Secret mount to /config-seed, still read-only;
  • mounts a small PVC (configWritable.size, default 64Mi) at /config;
  • adds a seed-config init container that copies config.yaml from the Secret only when the PVC has none yet.

After the first start the PVC copy is the source of truth: later edits to the Secret no longer reach the pod. To re-seed, delete /config/config.yaml on the PVC and restart the pod. Before turning the option off again, copy anything the management API wrote (keys created from the dashboard, for example) back into the Secret, or it is lost.

The management API itself stays off until it has a key. Give the pod a MANAGEMENT_PASSWORD env var from a Secret rather than a secret-key in config.yaml; a non-empty MANAGEMENT_PASSWORD also allows non-localhost callers, so allow-remote can stay false:

workload:
  main:
    podSpec:
      containers:
        main:
          env:
            MANAGEMENT_PASSWORD:
              secretKeyRef:
                name: cliproxyapi-management
                key: password

Authentication

There is no login button. You run the binary's own login flow once per account, directly against the running pod, then the credential persists on the persistence.auth volume.

Default: no outbound proxy needed

# Antigravity (Google): callback port is fixed at 51121
kubectl exec -n <namespace> deploy/cliproxyapi -- \
  /CLIProxyAPI/CLIProxyAPI -config /config/config.yaml \
  -antigravity-login -no-browser &

# Codex (ChatGPT): callback port is printed by the command itself, it is
# not fixed, read it from the output before starting the port-forward
kubectl exec -n <namespace> deploy/cliproxyapi -- \
  /CLIProxyAPI/CLIProxyAPI -config /config/config.yaml \
  -codex-login -no-browser &

# Tunnel the printed callback port to your workstation, then open the
# printed authorization URL in your own browser
kubectl port-forward -n <namespace> deploy/cliproxyapi <port>:<port>

The provider's login page redirects back to http://localhost:<port>/..., which lands on your local port-forward tunnel and completes the flow inside the pod. Each login has a short server-side window (observed: 5 minutes for Codex); if it times out, re-run the exec for a fresh authorization URL rather than reusing the old link.

Through an outbound proxy

If this pod's egress to the provider (accounts.google.com, auth.openai.com, etc.) has to go through a forward proxy, set the global proxy-url key in the config.yaml described above (documented upstream under CLIProxyAPI's configuration reference, not exercised against this image in this chart's own testing):

proxy-url: "socks5://user:[email protected]:1080"   # or http(s)://

A specific credential can opt out of that global proxy (and of any environment proxy) with its own proxy-url: direct or proxy-url: none. The login flow itself still needs the port-forward tunnel above, the proxy only affects the pod's own outbound calls, not how your browser reaches the callback.

Maintainers

NameEmailUrl
alekc[email protected]

Source Code

Requirements

RepositoryNameVersion
https://charts.alekc.devcommon39.0.3

Ingress

Warning: ingress.main ships disabled, as an example, not a recommendation. This pod holds long-lived OAuth refresh tokens with broad provider scopes (Antigravity's Google credential requests cloud-platform). api-keys in config.yaml is the only thing gating access to it. If you enable this ingress, put something in front that actually authenticates requests, a Traefik/nginx auth middleware, oauth2-proxy, a network policy restricting the source, before exposing it past your cluster's edge. Enabling it with a bare hostname and no auth hands anyone who can reach that host your authenticated subscriptions.

Values

KeyTypeDefaultDescription
configWritable.enabledboolfalseRun from a writable PVC copy of config.yaml so management API saves (e.g. from cliproxyapi-dashboard) persist. Seeded once from the persistence.config Secret; later Secret edits no longer apply. See "Writable config" in README.md.
configWritable.sizestring"64Mi"Size of the PVC holding the writable config.yaml.
configWritable.storageClassstring""StorageClass for that PVC. Empty uses the cluster default.
image.pullPolicystring"IfNotPresent"
image.repositorystring"eceasy/cli-proxy-api"Renovate opens a PR on a new tag (see Chart.yaml's # renovate: comment) but never auto-merges: test a login against the new tag first, an unattended bump can break a vendor OAuth handshake.
image.tagstring"v8.1.7"
ingress.main.enabledboolfalseDisabled by default: this pod holds long-lived OAuth refresh tokens with broad provider scopes. Enabling it with no access control in front hands anyone who can reach the host your authenticated subscriptions. See "Ingress" in README.md first.
ingress.main.hosts[0].hoststring"cliproxyapi.example.com"
ingress.main.hosts[0].paths[0].pathstring"/"
ingress.main.hosts[0].paths[0].pathTypestring"Prefix"
ingress.main.tls[0].hosts[0]string"cliproxyapi.example.com"
ingress.main.tls[0].secretNamestring"cliproxyapi-tls"
persistence.auth.accessModestring"ReadWriteOnce"
persistence.auth.enabledbooltrueOne JSON per account; a read-only mount breaks token refresh, losing this volume means re-running every login. No storageClass set here, uses the cluster's default; override with storageClass: <name> if you need a specific one.
persistence.auth.mountPathstring"/root/.cli-proxy-api"
persistence.auth.sizestring"500Mi"
persistence.auth.targetSelectAllbooltrue
persistence.auth.typestring"pvc"
persistence.config.enabledboolfalseDisabled by default: this chart never creates the Secret it points at, and the binary needs /config/config.yaml to start. Create that Secret first (see "Configuration" in README.md), then flip this to true.
persistence.config.expandObjectNameboolfalse
persistence.config.itemslist[{"key":"config.yaml","path":"config.yaml"}]Scoped to the one key the binary reads. Without this, any other key on the same Secret (e.g. a bearer token shared with a consumer like litellm) lands next to it as a stray file.
persistence.config.mountPathstring"/config"Not /CLIProxyAPI: the binary lives there and a volume would shadow it.
persistence.config.objectNamestring"cliproxyapi-config"Name of the pre-existing Secret to mount. Not created by this chart.
persistence.config.readOnlybooltrue
persistence.config.targetSelectAllbooltrue
persistence.config.typestring"secret"
securityContext.container.readOnlyRootFilesystemboolfalseOff: the OAuth refresh write-back to /root/.cli-proxy-api needs a writable rootfs on this image. See the hardened example below for what a non-root layout would need instead.
securityContext.container.runAsGroupint0
securityContext.container.runAsUserint0Runs as root. The upstream image is a root debian and the token store lives under /root/.cli-proxy-api; the common library's default (568) can't write there.
service.main.enabledbooltrue
service.main.ports.main.enabledbooltrue
service.main.ports.main.portint8317Port the binary listens on (-config's port: key must match).
service.main.ports.main.primarybooltrue
service.main.ports.main.protocolstring"http"
service.main.primarybooltrue
workload.main.podSpec.containers.main.commandlist["/CLIProxyAPI/CLIProxyAPI","-config","/config/config.yaml"]The image declares CMD with no ENTRYPOINT, so args alone leaves nothing to exec. The binary's compiled DefaultConfigPath is empty, so name the config file explicitly.
workload.main.podSpec.containers.main.probesobject{"liveness":{"enabled":true,"type":"tcp"},"readiness":{"enabled":true,"type":"tcp"},"startup":{"enabled":true,"type":"tcp"}}GET / is not a served route, which fails the common library's default httpGet probe. The listener being up is sufficient liveness for a proxy whose upstreams are remote.
workload.main.podSpec.containers.main.resources.limits.cpustring"1500m"Not set by this chart, this is the common library's own default surfacing here; made explicit so it is not mistaken for "no CPU limit". Set to 0 for unlimited.
workload.main.podSpec.containers.main.resources.limits.memorystring"512Mi"
workload.main.podSpec.containers.main.resources.requests.cpustring"50m"
workload.main.podSpec.containers.main.resources.requests.memorystring"128Mi"

Deploy cliproxyapi with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has cliproxyapi on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartcliproxyapi is pinned at v2.1.7 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply