Configuration

June 27, 2026 · View on GitHub

Back to README

Configuration is managed through infrastructure/.env.

Environment Variables

Infrastructure (set in infrastructure/.env)

VariableRequiredDescriptionDefault / Example
DOMAINYesBase domain for your installationexample.com
DASHBOARD_SUBDOMAINYesDashboard subdomaindashboard
API_SUBDOMAINYesAPI subdomainapi
DASHBOARD_URLYesFull dashboard URL (used for OAuth callbacks, Telegram links)https://dashboard.example.com
API_URLYesFull API URL (used for proxy model config)https://api.example.com
DATABASE_URLYesPostgreSQL connection stringpostgresql://user:pass@host:5432/db
POSTGRES_PASSWORDYesPostgreSQL passwordGenerated by installer
JWT_SECRETYesJWT signing secret (min 32 chars)Generated by installer
MANAGEMENT_API_KEYYesCLIProxyAPI management API key (min 16 chars)Generated by installer
INSTALL_DIRYesAbsolute path to project rootSet by installer
TZNoServer timezoneUTC

Dashboard (set in infrastructure/.env or container environment)

VariableRequiredDescriptionDefault
CLIPROXYAPI_MANAGEMENT_URLNoInternal management API URLhttp://cliproxyapi:8317/v0/management
NODE_ENVNoRuntime environmentdevelopment
JWT_EXPIRES_INNoJWT token expiration time7d
LOG_LEVELNoPino log level (fatal, error, warn, info, debug, trace)info
LOG_DIRNoDirectory for log file storage<cwd>/logs
CLIPROXYAPI_CONTAINER_NAMENoDocker container name used only for the cosmetic uptime indicator (via docker inspect). Liveness is determined by probing CLIPROXYAPI_MANAGEMENT_URL, so this can be left at its default under Docker Swarm or Kubernetes — uptime simply reads as unknown when the name does not resolve.cliproxyapi
DOCKER_HOSTNoDocker socket proxy URL (for container management)tcp://docker-proxy:2375
GITHUB_REPONoGitHub repo for update checksitsmylife44/cliproxyapi-dashboard
SYNC_TOKEN_MAX_AGE_DAYSNoConfig sync token expiration in days90
COLLECTOR_API_KEYNoAPI key for automated usage collection cron service (64-char hex)Generated by installer
BACKUP_SCHEDULER_KEYNoAPI key for the backup scheduler cron service (64-char hex)Generated by installer
ALLOW_LOCAL_PROVIDER_URLSNoPermit custom providers to target localhost / RFC1918 (Ollama, LM Studio, llama.cpp). Cloud metadata (169.254.169.254, 100.100.100.200) stays blocked.false

Dashboard-Only Mode

When installed with ./install.sh --dashboard-only, the dashboard uses infrastructure/docker-compose.dashboard-only.yml and connects to an existing CLIProxyAPI instead of starting the bundled proxy container. The existing CLIProxyAPI can run in Docker, directly on a host, or on another server.

Set these values to match your existing proxy:

VariableDescription
CLIPROXYAPI_MANAGEMENT_URLExisting CLIProxyAPI management endpoint, ending in /v0/management; it must be reachable from inside the dashboard container
MANAGEMENT_API_KEYExisting CLIProxyAPI management key/password
API_URLPublic URL clients should use for the existing CLIProxyAPI API

The dashboard-only compose file exposes the dashboard on 127.0.0.1:3000 and adds host.docker.internal for same-host CLIProxyAPI installs. If you only have the public OpenAI-compatible API URL and no management endpoint/key, dashboard management features cannot operate.

Perplexity Sidecar

VariableRequiredDescriptionDefault
PERPLEXITY_SIDECAR_SECRETNoShared secret for sidecar authentication (min 16 chars)
PERPLEXITY_COOKIESNoPerplexity Pro session cookies

Webhook / Deploy (optional, for CI/CD)

VariableRequiredDescriptionDefault
WEBHOOK_HOSTNoWebhook server URL for deploy triggershttp://localhost:9000
DEPLOY_SECRETNoSecret for deploy webhook authentication

CLIProxyAPI Configuration

CLIProxyAPI configuration lives in infrastructure/config/config.yaml. The dashboard provides a structured UI for editing it, but you can also edit the file directly:

api-keys:
  - "sk-your-api-key-here"

providers:
  - name: "claude"
    type: "claude"
    # Provider-specific configuration...
  
  - name: "gemini"
    type: "gemini"
    api-key: "YOUR_GEMINI_API_KEY"
    # Provider-specific configuration...

Dashboard Settings

Dashboard-specific settings are managed through the Settings page in the UI:

  • User management (admin password)
  • Config Sync token management
  • Theme preferences

Config Sync

The dashboard can automatically sync your OpenCode configurations to your local machine using the companion plugin.

How It Works

  1. Generate a Sync Token: Navigate to Settings -> Config Sync in the dashboard
  2. Install the Plugin: Add opencode-cliproxyapi-sync to your OpenCode plugins
  3. Configure: Create ~/.config/opencode-cliproxyapi-sync/config.json with your dashboard URL and sync token
  4. Auto-Sync: On every OpenCode startup, the plugin checks for config changes and updates your local opencode.json and oh-my-openagent.json

Plugin Installation

npx opencode install opencode-cliproxyapi-sync

Or add manually to your opencode.json:

{
  "plugin": [
    "opencode-cliproxyapi-sync",
    "oh-my-openagent@latest"
  ]
}

The plugin supports OCX profiles — each profile can have its own sync config.

For full plugin documentation, see opencode-cliproxyapi-sync.

Usage Collection

The dashboard automatically collects usage statistics from CLIProxyAPI every 5 minutes using a dedicated cron service.

How It Works

  1. Usage Collector Service: Runs as a Docker container with cron job
  2. Collection Endpoint: POST /api/usage/collect fetches data from CLIProxyAPI
  3. Data Storage: Usage records stored in PostgreSQL with deduplication
  4. Dashboard Display: View statistics on the Usage page

Required Configuration

  • COLLECTOR_API_KEY: Authentication key for the cron service (automatically generated during installation)

Troubleshooting

If usage data isn't appearing in your dashboard:

  1. Check collector service: docker compose ps usage-collector
  2. Verify API key: grep COLLECTOR_API_KEY infrastructure/.env
  3. View logs: docker compose logs usage-collector
  4. Manual trigger: Click "Refresh" on Usage page (admin only)

For detailed troubleshooting and advanced configuration, see infrastructure/docs/USAGE_COLLECTION.md.

Scheduled Backups

The dashboard can create scheduled database backups via a dedicated cron service that mirrors the usage collector. Configure the schedule under Settings → Backup.

How It Works

  1. Backup Scheduler Service: backup-scheduler container ticks every 5 minutes
  2. Scheduled Endpoint: POST /api/admin/backup/scheduled is idempotent — it only creates a backup when the configured cron time has elapsed
  3. Retention: Old SCHEDULED backups are removed according to the retention setting (days)
  4. Time Zone: The cron expression is evaluated using the container's TZ (falls back to UTC on invalid TZ)

Required Configuration

  • BACKUP_SCHEDULER_KEY: Bearer token for the scheduler service (auto-generated during installation)
  • At least one admin user must exist; backups are attributed to the oldest admin

Upgrading Existing Deployments

Installs that predate the scheduler need the new key and service added manually:

# Add the key if missing
grep -q '^BACKUP_SCHEDULER_KEY=' infrastructure/.env || \
  echo "BACKUP_SCHEDULER_KEY=$(openssl rand -hex 32)" >> infrastructure/.env

# Start the new container
cd infrastructure && docker compose up -d backup-scheduler

Troubleshooting

  1. Scheduler running? docker compose ps backup-scheduler
  2. Key present? grep BACKUP_SCHEDULER_KEY infrastructure/.env
  3. Logs: docker compose logs backup-scheduler and dashboard logs for BACKUP_SCHEDULED_TICK
  4. Schedule enabled? Settings → Backup — verify "Enabled" and the next run timestamp

Config Sharing

Share your configuration with others:

  • Publish: Generate a unique share code (format: XXXX-XXXX) for your config
  • Subscribe: Enter a share code to sync with a publisher's model selection
  • Automatic Sync: Subscribers see publisher's models on page reload
  • Subscriber Isolation: Subscribers keep their own MCP servers and plugins
  • Mutual Exclusivity: Users can be either publisher OR subscriber, not both