cliproxyapi-dashboard

by alekc

Helm chartv0.1.4App 0.1.92MITVerified publisher

CLIProxyAPI Dashboard web UI for CLIProxyAPI, with OAuth provider logins, auth files, API keys, quota and usage tracking, on an external PostgreSQL

About this chart

cliproxyapi-dashboard

CLIProxyAPI Dashboard web UI for CLIProxyAPI, with OAuth provider logins, auth files, API keys, quota and usage tracking, on an external PostgreSQL

CLIProxyAPI Dashboard is a web UI for CLIProxyAPI, the proxy that exposes Claude Code, Gemini CLI, Codex and other subscription logins as an OpenAI-compatible API. The dashboard runs the OAuth provider logins, manages auth files and API keys, and tracks quota and usage per account, so none of that has to be done by hand against the management API. This chart runs it as a single Deployment next to an existing CLIProxyAPI (for example the cliproxyapi chart), on an external PostgreSQL, with an optional usage collector sidecar and either an Ingress or a Gateway API HTTPRoute. Renovate tracks upstream releases, so appVersion moves with every image release.

Quick start

The chart creates no Secrets. Create two first: one with the dashboard credentials, one with the database URL (or let CloudNativePG create the latter, see below).

kubectl create secret generic my-dashboard \
  --from-literal=JWT_SECRET="$(openssl rand -hex 32)" \
  --from-literal=MANAGEMENT_API_KEY='<the proxy management key>' \
  --from-literal=COLLECTOR_API_KEY="$(openssl rand -hex 32)" \
  --from-literal=PROVIDER_ENCRYPTION_KEY="$(openssl rand -hex 32)"
helm repo add alekc https://charts.alekc.dev
helm repo update
helm install my alekc/cliproxyapi-dashboard -f values.yaml

Or directly from the OCI registry:

helm install my oci://charts.alekc.dev/cliproxyapi-dashboard --version 0.1.0 -f values.yaml

A minimal working values.yaml:

fullnameOverride: my-dashboard

proxy:
  managementUrl: http://cliproxyapi:8317/v0/management

dashboardUrl: https://dashboard.example.com

auth:
  existingSecret: my-dashboard
  providerEncryptionKeyKey: PROVIDER_ENCRYPTION_KEY

database:
  existingSecret: my-dashboard-db-app
  existingSecretKey: uri

ingress:
  enabled: true
  hosts:
    - host: dashboard.example.com
      paths:
        - path: /
          pathType: Prefix
  tls:
    - hosts:
        - dashboard.example.com
      secretName: dashboard-tls

Database with CloudNativePG

The default database.existingSecret is <fullname>-db-app, which is the Secret a CloudNativePG Cluster named <fullname>-db creates. Its uri key is a postgresql:// URL and fits as-is. The schema is applied by the image entrypoint on every start (idempotent SQL under a Postgres advisory lock); no extensions are needed.

additionalManifests:
  db:
    apiVersion: postgresql.cnpg.io/v1
    kind: Cluster
    metadata:
      name: my-dashboard-db
    spec:
      instances: 1
      storage:
        size: 2Gi

Proxy side

The dashboard drives CLIProxyAPI through its management API, which is off by default:

  • Set MANAGEMENT_PASSWORD on the proxy to the same value as MANAGEMENT_API_KEY. That both enables remote management and sets the key, with no config.yaml edit.
  • Make the proxy's config.yaml writable. API keys, provider keys, plugins and the Config page all save through the management API; on a read-only mount those saves return 500. The cliproxyapi chart's configWritable option seeds a PVC copy from the config Secret.
  • For usage tracking, set usage-statistics-enabled: true and redis-usage-queue-retention-seconds: 3600 in config.yaml. The defaults (off, 60s) mean a 5-minute collector sees almost nothing.

First run: setup, then migrate API keys, in that order

  1. Open the dashboard and create the first admin on /setup. The first caller wins and public signup closes afterwards, so do this straight after the install.

  2. Import the proxy's existing API keys before anything else. As of 0.1.88 this is an admin API with no button: while logged in, run this in the browser console on the dashboard tab and expect keysAssigned to equal the proxy's key count:

    await (await fetch("/api/admin/migrate-api-keys", { method: "POST" })).json()
    

The dashboard pushes its whole API key list to the proxy, replacing the proxy's own, on every usage collection, on any key create or delete, and on the usage page's Refresh. Until the migration imports the proxy's existing keys, that list is empty, and the first push removes every key the proxy's clients use. The migration also refuses to run once any key exists in the dashboard, so the post-login setup wizard's "create API key" step must not come first: set SKIP_SETUP_WIZARD: "true" in env for the first run, and keep collector.enabled: false until step 2 is done.

Verifying the signature

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

Maintainers

NameEmailUrl
alekc[email protected]

Source Code

Gotchas

  • Two logins behind forward auth. The dashboard has its own session login and no header-based SSO, so an oauth2-proxy or similar in front means signing in twice.
  • Serve it at / of its own host. The app has no basePath setting.
  • Set dashboardUrl behind a reverse proxy. It is added to the origins the CSRF check accepts; without it, login and setup POSTs are rejected.
  • The session cookie's Secure flag follows X-Forwarded-Proto. Terminate TLS at the ingress and let it forward the header.
  • Five wrong management keys from one IP ban that IP for 30 minutes on the proxy. Behind node SNAT that IP can be the whole node, so check the key matches before rolling out.
  • PROVIDER_ENCRYPTION_KEY is set-once. Custom provider keys are stored AES-GCM encrypted with it; changing or losing it makes them unreadable. Back it up.
  • Docker features error out. The containers page, restart and one-click update need a Docker socket; on Kubernetes they show an error banner. Proxy status still works.
  • In-app backups are ephemeral. /app/backups is an emptyDir. Back up the database instead (CloudNativePG barman, pg_dump).
  • One replica. Logs, the in-app scheduler and the collector claim are per pod.
  • Never set SKIP_AUTH. It disables authentication. The schema rejects it in env; the keys of an envFrom Secret or ConfigMap cannot be checked at render time.

Upgrade notes

0.1.0

Initial release.

Values

KeyTypeDefaultDescription
additionalManifestsobject{}Additional raw Kubernetes manifests rendered alongside the chart's own resources, keyed by an arbitrary name and templated with tpl.
affinityobject{}Affinity rules for the pod.
allowLocalProviderUrlsboolfalseLet custom providers target localhost and RFC1918 addresses (ALLOW_LOCAL_PROVIDER_URLS). Cloud metadata addresses stay blocked.
annotations.deploymentobject{}Annotations added to the Deployment object itself, distinct from podAnnotations, which targets the pod template.
auth.existingSecretstring"{{ include \"cliproxyapi-dashboard.fullname\" . }}"Existing Secret holding the dashboard credentials. tpl-evaluated, so the default resolves to the release fullname. Not created by this chart.
auth.jwtSecretKeystring"JWT_SECRET"Key holding JWT_SECRET (at least 32 characters).
auth.managementKeyKeystring"MANAGEMENT_API_KEY"Key holding MANAGEMENT_API_KEY, the CLIProxyAPI management key (at least 16 characters). Must match the proxy's MANAGEMENT_PASSWORD.
auth.providerEncryptionKeyKeystring""Key holding PROVIDER_ENCRYPTION_KEY (64 hex). Empty leaves it unset. Set it before storing provider keys and never change it afterwards.
collector.enabledboolfalseRun a sidecar that POSTs /api/usage/collect on an interval. Each run also pushes the dashboard's API key list to the proxy: read the key-migration note in the README before enabling it.
collector.existingSecretstring""Existing Secret holding COLLECTOR_API_KEY. Empty uses auth.existingSecret. tpl-evaluated.
collector.existingSecretKeystring"COLLECTOR_API_KEY"Key holding COLLECTOR_API_KEY.
collector.intervalint300Seconds between collection runs.
collector.resourcesobject{"limits":{"memory":"96Mi"},"requests":{"cpu":"5m","memory":"32Mi"}}Resources for the collector sidecar.
commonAnnotationsobject{}Annotations merged onto every chart-managed resource except the pod template (use podAnnotations) and additionalManifests.
commonLabelsobject{}Labels merged onto every chart-managed resource and the pod template, not additionalManifests. Never reaches selector/matchLabels, safe to change.
dashboardUrlstring""Public URL of the dashboard (DASHBOARD_URL), added to the origins the CSRF check accepts. Required behind a reverse proxy or logins fail.
database.existingSecretstring"{{ include \"cliproxyapi-dashboard.fullname\" . }}-db-app"Existing Secret holding DATABASE_URL. The default matches the -app Secret of a CloudNativePG Cluster named <fullname>-db.
database.existingSecretKeystring"uri"Key holding a postgresql:// URL (postgres:// is rejected).
deployment.strategyobject{"type":"RollingUpdate"}Deployment strategy. No volume is ReadWriteOnce, so a rolling update is safe; the entrypoint serialises schema changes on a Postgres lock.
envobject{"LOG_LEVEL":"info","TZ":"UTC"}Dashboard env, keyed by name. A scalar renders as value, a map (secretKeyRef, configMapKeyRef, fieldRef, resourceFieldRef) as valueFrom. Rendered in key order, null removes a default. SKIP_AUTH is rejected.
envFromlist[]envFrom entries, for pulling a whole ConfigMap or Secret into the dashboard container environment. Their keys are not checked.
extraContainerslist[]Extra sidecar containers appended to the pod spec, templated with tpl.
extraVolumeMountslist[]Additional volume mounts appended to the dashboard container.
extraVolumeslist[]Additional volumes appended to the pod spec.
fullnameOverridestring""Overrides the full generated resource name.
gateway.additionalRuleslist[]Extra rules appended after the generated one, passed through as-is.
gateway.annotationsobject{}Annotations to add to the HTTPRoute.
gateway.apiVersionstring"gateway.networking.k8s.io/v1"HTTPRoute apiVersion.
gateway.enabledboolfalseRender a Gateway API HTTPRoute attached to an existing Gateway. The chart never creates the Gateway. Requires parentRefs.
gateway.filterslist[]Filters applied to the generated rule, passed through as-is.
gateway.hostnameslist[]Hostnames this route answers on.
gateway.matcheslist[{"path":{"type":"PathPrefix","value":"/"}}]Path matches for the generated rule.
gateway.parentRefslist[]Gateways to attach this route to. Required when enabled is true.
image.pullPolicystring"IfNotPresent"Image pull policy.
image.repositorystring"ghcr.io/itsmylife44/cliproxyapi-dashboard/dashboard"Container image repository.
image.tagstring""Overrides the image tag whose default is the chart appVersion. Tags carry no dashboard-v prefix, unlike the upstream git tags.
imagePullSecretslist[]Image pull secrets for a private registry mirror.
ingress.annotationsobject{}Annotations to add to the Ingress.
ingress.classNamestring""IngressClass name. Left empty, the cluster default class is used.
ingress.enabledboolfalseRender an Ingress for the Service. The app has no basePath, so it must be served at / of its own host.
ingress.hostslist[{"host":"chart-example.local","paths":[{"path":"/","pathType":"Prefix"}]}]Ingress hosts and their paths.
ingress.tlslist[]Ingress TLS blocks, passed through as-is.
initContainerslist[]Init containers prepended to the pod spec, templated with tpl.
livenessProbeobject{"enabled":true,"failureThreshold":3,"httpGet":{"path":"/api/health","port":"http"},"initialDelaySeconds":20,"periodSeconds":30,"timeoutSeconds":10}Liveness probe, passed through verbatim minus the enabled key. /api/health is the endpoint the upstream image healthcheck uses. Set enabled: false to disable; Helm's deep merge keeps defaults otherwise.
nameOverridestring""Overrides the chart name used in resource names and selector labels.
nodeSelectorobject{}Node selector for the pod.
podAnnotationsobject{}Annotations added to the pod template only, not to the Deployment object. Use annotations.deployment for the latter.
podSecurityContextobject{"fsGroup":1001,"runAsGroup":1001,"runAsNonRoot":true,"runAsUser":1001,"seccompProfile":{"type":"RuntimeDefault"}}Pod-level security context. The image runs as nextjs (uid 1001).
proxy.managementUrlstring"http://cliproxyapi:8317/v0/management"CLIProxyAPI management API base URL (CLIPROXYAPI_MANAGEMENT_URL). The dashboard also calls the proxy's model list on the same host:port.
readinessProbeobject{"enabled":true,"failureThreshold":3,"httpGet":{"path":"/api/health","port":"http"},"initialDelaySeconds":10,"periodSeconds":10,"timeoutSeconds":10}Readiness probe. Same endpoint as livenessProbe.
replicaCountint1Number of replicas. Keep at 1: the in-app scheduler

Deploy cliproxyapi-dashboard with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has cliproxyapi-dashboard 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-dashboard is pinned at v0.1.4 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