CCHPCCHPDocs
↑↓↵pagefind

Chapter 0217 min read

Install with Docker Compose

Deploy CCHP on one machine with Docker Compose, add a provider, a provider group and a user, and send the first request.

This tutorial installs CCHP 1.0.2 on one machine with Docker Compose. At the end, a user calls a model through the CCHP gateway, and the request appears in the console.

Services and ports of the Compose deploymentServices and ports of the Compose deploymentCCHP

One cchp container runs the console, the gateway and the background worker. The CCHP project recommends K3s or Kubernetes for production, because each role then scales and upgrades as its own workload.

Before you start#

Prepare these items on the machine that runs CCHP:

  • Docker Engine with the Compose plugin 2.23 or newer. The command docker compose version shows the version.
  • The curl and openssl commands.
  • Ports 8080 and 8081, not used by another program. The console listens on 8080 and the gateway listens on 8081.
  • Outbound network access to the image registries and to cch-plus.cyou. CCHP downloads the model price table from cch-plus.cyou.
  • A browser on the same machine. Sign-in works only on an HTTPS address or on a localhost address.

Prepare the API address and one API key of an upstream LLM provider.

This tutorial does not set up an email service. The administrator creates the account of a new user with a temporary password, and the user sets their own password at the first sign-in.

If CCHP runs on a remote server, forward the two ports to your own machine and open the console on localhost:

bash
ssh -L 8080:localhost:8080 -L 8081:localhost:8081 user@your-server

The screenshots in this tutorial use example values. Replace them with your own values.

ItemExample value
Administrator[email protected]
Organization and teamExample Inc, Core team
Providerexample-provider
Upstream base URLhttps://api.example.com
Provider key nameprimary-key
Modelgpt-4o-mini
Provider groupexample-group
UserAlice, [email protected]
API key namealice-key

Step 1: Create the Compose file#

  1. Create an empty directory and go into it.

    bash
    mkdir cchp && cd cchp
  2. Create the file compose.yml with this content.

    compose.ymlyaml
    # Claude Code Hub Plus — Docker Compose deployment on one machine.
    #
    #   docker compose up -d      # after creating .env (see README.md, "Install")
    #
    # One application container runs every role (`api --role=all`): the dashboard
    # and admin API on 8080, the LLM gateway on 8081 and the background worker.
    # A one-shot `migrate` applies the database schema before it starts.
    # PostgreSQL and Dragonfly stay on the internal Compose network.
    #
    # For production, deploy with K3S or Kubernetes instead: deployments/k3s and
    # deployments/k8s run each role as its own workload that scales and upgrades
    # independently (README.md, "Deployment").
    name: cch-plus
     
    services:
      postgres:
        image: ${POSTGRES_IMAGE:-timescale/timescaledb:latest-pg18@sha256:e72689191e1c977892c53d6f2c344dbc4a9657a867dc8cc1899229f9d3672b2e}
        restart: unless-stopped
        # pg_stat_statements feeds System settings > Observability > Database.
        command:
          - postgres
          - -c
          - shared_preload_libraries=timescaledb,pg_stat_statements
          - -c
          - pg_stat_statements.max=10000
          - -c
          - track_io_timing=on
        environment:
          POSTGRES_USER: ${POSTGRES_USER:-hub}
          POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}
          POSTGRES_DB: ${POSTGRES_DB:-app}
          POSTGRES_INITDB_ARGS: "--auth-host=scram-sha-256"
          # Data lives in a subdirectory of the named volume, so it persists with
          # the pg18 image layout and initdb never meets the volume's lost+found.
          PGDATA: /var/lib/postgresql/data/pgdata
        configs:
          - source: postgres_init
            target: /docker-entrypoint-initdb.d/002-enable-pg-stat-statements.sql
        volumes:
          - cch_pg:/var/lib/postgresql/data
        healthcheck:
          test: ["CMD-SHELL", "pg_isready -h 127.0.0.1 -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
          interval: 5s
          timeout: 5s
          retries: 20
     
      dragonfly:
        # Not published and without a password: only the Compose network reaches it.
        image: ${DRAGONFLY_IMAGE:-docker.dragonflydb.io/dragonflydb/dragonfly:v2.0.2@sha256:061f00b201b58e12f974e4e96c761a881ee1c05e9d8ee967466a604b7299753b}
        restart: unless-stopped
        ulimits:
          memlock: -1
        volumes:
          - cch_df:/data
        healthcheck:
          test: ["CMD", "redis-cli", "ping"]
          interval: 5s
          timeout: 3s
          retries: 10
     
      migrate:
        image: ${CCHP_IMAGE:-ghcr.io/cch-hq/cch-plus}:${CCHP_IMAGE_TAG:-latest}
        restart: "no"
        entrypoint: ["/usr/local/bin/migrate"]
        command: ["apply"]
        environment:
          APP_ENV: production
          ATLAS_DATABASE_URL: postgres://${POSTGRES_USER:-hub}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-app}?sslmode=disable
          # Every run creates the runtime login or sets its password, so fresh volumes
          # and volumes created before the restricted role existed both converge here.
          CCHP_DATABASE_RUNTIME_ROLE: ${CCHP_DATABASE_RUNTIME_ROLE:-cchp_runtime}
          CCHP_DATABASE_RUNTIME_PASSWORD: ${CCHP_DATABASE_RUNTIME_PASSWORD:?set CCHP_DATABASE_RUNTIME_PASSWORD in .env}
          CCH_MASTER_KEY: ${CCH_MASTER_KEY:?set CCH_MASTER_KEY in .env}
          CCH_MASTER_KEY_ID: ${CCH_MASTER_KEY_ID:-primary}
        depends_on:
          postgres:
            condition: service_healthy
     
      cchp:
        image: ${CCHP_IMAGE:-ghcr.io/cch-hq/cch-plus}:${CCHP_IMAGE_TAG:-latest}
        restart: unless-stopped
        # Covers the gateway drain on SIGTERM: readiness delay 5s + in-flight drain
        # 150s + cancel grace 10s (CCH_SHUTDOWN_*_MS) plus cleanup.
        stop_grace_period: 180s
        command: ["api", "--role=all", "--control-addr=:8080", "--addr=:8081"]
        environment:
          APP_ENV: production
          # The roles connect as the restricted runtime login that the migrate job
          # creates and grants, never as POSTGRES_USER. A custom password with
          # @ : / ? # or % must be URL-encoded here.
          DATABASE_URL: postgres://${CCHP_DATABASE_RUNTIME_ROLE:-cchp_runtime}:${CCHP_DATABASE_RUNTIME_PASSWORD:?set CCHP_DATABASE_RUNTIME_PASSWORD in .env}@postgres:5432/${POSTGRES_DB:-app}?sslmode=disable
          CCHP_DATABASE_RUNTIME_ROLE: ${CCHP_DATABASE_RUNTIME_ROLE:-cchp_runtime}
          DRAGONFLY_URL: redis://dragonfly:6379/0
          CCH_TOKEN_PEPPER: ${CCH_TOKEN_PEPPER:?set CCH_TOKEN_PEPPER in .env}
          CCH_MASTER_KEY: ${CCH_MASTER_KEY:?set CCH_MASTER_KEY in .env}
          CCH_MASTER_KEY_ID: ${CCH_MASTER_KEY_ID:-primary}
          DRAGONFLY_KEY_SECRET: ${DRAGONFLY_KEY_SECRET:?set DRAGONFLY_KEY_SECRET in .env}
          # The address people open the dashboard at. Sign-in cookies, CSRF checks
          # and email links use it, so it must be HTTPS or a localhost address.
          CCH_PUBLIC_BASE_URL: ${CCH_PUBLIC_BASE_URL:-http://localhost:${CCHP_DASHBOARD_PORT:-8080}}
          # The gateway address the dashboard shows to API users.
          CCH_GATEWAY_PUBLIC_URL: ${CCH_GATEWAY_PUBLIC_URL:-http://localhost:${CCHP_GATEWAY_PORT:-8081}}
          # Browser origins allowed to call the gateway API, comma-separated.
          CCH_CONTROL_PLANE_ALLOWED_ORIGINS: ${CCH_CONTROL_PLANE_ALLOWED_ORIGINS:-http://localhost:${CCHP_DASHBOARD_PORT:-8080}}
          CCH_NOTIFICATION_HOST_ALLOWLIST: ${CCH_NOTIFICATION_HOST_ALLOWLIST:-}
          CCH_UPSTREAM_HOST_ALLOWLIST: ${CCH_UPSTREAM_HOST_ALLOWLIST:-}
          CCH_SIEM_MODE: ${CCH_SIEM_MODE-disabled}
          CCH_SIEM_WEBHOOK_URL: ${CCH_SIEM_WEBHOOK_URL:-}
          CCH_SIEM_WEBHOOK_TIMEOUT_MS: ${CCH_SIEM_WEBHOOK_TIMEOUT_MS:-10000}
          CCH_SIEM_WEBHOOK_AUTH_HEADER_NAME: ${CCH_SIEM_WEBHOOK_AUTH_HEADER_NAME:-Authorization}
          CCH_SIEM_WEBHOOK_AUTH_HEADER: ${CCH_SIEM_WEBHOOK_AUTH_HEADER:-}
          # Start before any upstream provider exists; proxy requests return a
          # no-route error until one is added from the dashboard.
          CCH_ALLOW_EMPTY_ROUTING_BOOTSTRAP: "true"
          CCH_OBJECTSTORE_LOCAL_ROOT: /var/lib/cchp/objectstore
          CCH_ARCHIVE_ROOT: /var/lib/cchp/archive
          CCH_PRICE_SNAPSHOT_PATH: /var/lib/cchp/archive/price-snapshot/latest.json
          # Generated images and audio are staged here before they are uploaded to
          # the task result store; files left by a restart are uploaded on startup.
          CCH_TASK_SPOOL_DIR: /var/lib/cchp/archive/task-spool
          CCHP_IMPORT_DIR: /var/lib/cchp/imports
          CCH_TASK_RESULT_ROOT: /var/lib/cchp/task-results
          CCH_PLUGIN_WASM_CACHE_DIR: /var/cache/cchp/wasm
          # Internal port for the dashboard's signed request-archive reads and
          # profiling. The dashboard runs in this container, so loopback reaches it.
          CCH_ARCHIVE_INTERNAL_ADDR: ":8091"
          CCH_ARCHIVE_INTERNAL_URL: http://127.0.0.1:8091
          CCH_REPLAY_NODE_ID: cchp
          CCH_REPLAY_OWNER_PROXY_NODES: cchp=http://127.0.0.1:8081
        volumes:
          - cch_objectstore:/var/lib/cchp/objectstore
          - cch_archive:/var/lib/cchp/archive
          - cch_imports:/var/lib/cchp/imports
          - cch_task_results:/var/lib/cchp/task-results
          - cch_wasm_cache:/var/cache/cchp/wasm
        ports:
          - "${CCHP_DASHBOARD_PORT:-8080}:8080"
          - "${CCHP_GATEWAY_PORT:-8081}:8081"
        # Healthy only when the gateway, the dashboard and the worker are all ready.
        healthcheck:
          test:
            - CMD
            - /usr/local/bin/gateway
            - healthcheck
            - --url=http://127.0.0.1:8081/readyz
            - --url=http://127.0.0.1:8080/readyz
            - --url=http://127.0.0.1:8082/readyz
          interval: 10s
          timeout: 15s
          retries: 12
          start_period: 30s
        depends_on:
          postgres:
            condition: service_healthy
          dragonfly:
            condition: service_healthy
          migrate:
            condition: service_completed_successfully
     
    configs:
      # Creating the extension needs a superuser, so it runs when the database
      # volume is first initialised.
      postgres_init:
        content: |
          CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
     
    volumes:
      cch_pg:
      cch_df:
      # Plugin packages, exports and audit archives.
      cch_objectstore:
      # Request archive: SQLite in WAL mode plus encrypted chunks, up to
      # archive.local.disk_budget_bytes (10 GiB by default). Keep it on local disk.
      cch_archive:
      # CC Hub import work area; keep at least 4 GiB free for it.
      cch_imports:
      # Task result files of the local task result store; .cchp-task-store-id at
      # its root identifies the store.
      cch_task_results:
      cch_wasm_cache:

The file defines four services:

  • postgres is the database. The image is TimescaleDB on PostgreSQL 18. PostgreSQL creates the role POSTGRES_USER and the database POSTGRES_DB when the volume cch_pg is first created. The service publishes no port to the host.
  • dragonfly is the in-memory store that CCHP uses through the Redis protocol. It has no password and publishes no port, so only the Compose network can connect to it.
  • migrate runs one time before cchp starts. It applies the database schema as POSTGRES_USER. It also sets the password of the restricted role CCHP_DATABASE_RUNTIME_ROLE (creating the role first when it does not exist) and the role’s table grants.
  • cchp is the application. The command api --role=all starts the console and the admin API on port 8080, the gateway on port 8081 and the background worker. The service connects to PostgreSQL as the restricted role. Docker reports the service as healthy when the gateway, the console and the worker are all ready.

The file defines seven volumes:

  • cch_pg holds the database, and cch_df holds the Dragonfly data.
  • cch_objectstore holds plugin packages, exports and audit archives.
  • cch_archive holds the request archive. The archive uses up to 10 GiB by default. Keep this volume on a local disk.
  • The directory task-spool in cch_archive holds generated images and audio until CCHP uploads them to the task result store.
  • cch_imports is the work area of the CC Hub import. Keep 4 GiB or more free for it.
  • cch_task_results holds task result files, and cch_wasm_cache holds the plugin cache.

Step 2: Create the settings file#

Warning: Do step 2 of this section one time only, before the first start. After CCHP has started, new secrets cannot decrypt the stored provider keys, and the new POSTGRES_PASSWORD does not match the password in the database volume.

Warning: Keep a copy of .env after step 2. Without CCH_MASTER_KEY, CCHP cannot decrypt the provider keys that it stores.

  1. Create the file .env in the same directory with this content.

    .envbash
    # Claude Code Hub Plus — settings for compose.yml. Save as `.env` next to it.
    #
    # The five secrets at the end of this file are required and ship empty. Generate
    # them once, before the first start. These commands remove the five lines and
    # write them again with new values:
    #   grep -v -E '^(POSTGRES_PASSWORD|CCHP_DATABASE_RUNTIME_PASSWORD|CCH_TOKEN_PEPPER|CCH_MASTER_KEY|DRAGONFLY_KEY_SECRET)=' .env > .env.new
    #   for key in POSTGRES_PASSWORD CCHP_DATABASE_RUNTIME_PASSWORD CCH_TOKEN_PEPPER CCH_MASTER_KEY DRAGONFLY_KEY_SECRET; do
    #     printf '%s=%s\n' "$key" "$(openssl rand -hex 32)" >> .env.new
    #   done
    #   mv .env.new .env
    # Keep them: the master key decrypts stored provider keys, and the database
    # owner password is fixed when the database volume is first created.
     
    # Image channel: current (GA) / latest / X.Y.Z / beta / rc / alpha / canary.
    CCHP_IMAGE_TAG=latest
     
    # Published ports: the dashboard (web UI + admin API) and the LLM gateway your
    # clients call. Put both behind a TLS reverse proxy in production.
    CCHP_DASHBOARD_PORT=8080
    CCHP_GATEWAY_PORT=8081
     
    # The address people open the dashboard at. Defaults to
    # http://localhost:<dashboard port>. Opening the dashboard from another machine
    # needs HTTPS: set your public HTTPS address here, for example
    #CCH_PUBLIC_BASE_URL=https://hub.example.com
    # Browser origins allowed to call the gateway API, comma-separated. Defaults to
    # http://localhost:<dashboard port>; set your public dashboard address with it.
    #CCH_CONTROL_PLANE_ALLOWED_ORIGINS=https://hub.example.com
    # The gateway address the dashboard shows to API users. Defaults to
    # http://localhost:<gateway port>.
    #CCH_GATEWAY_PUBLIC_URL=https://api.example.com
     
    # PostgreSQL role and database created on first start.
    POSTGRES_USER=hub
    POSTGRES_DB=app
    # cchp never connects as POSTGRES_USER: it logs in as this restricted runtime
    # role (NOINHERIT, NOSUPERUSER, NOBYPASSRLS, no CREATEDB or CREATEROLE). Every
    # run of the migrate job creates it or sets CCHP_DATABASE_RUNTIME_PASSWORD and
    # grants it only the tables it needs, on new and existing volumes alike.
    CCHP_DATABASE_RUNTIME_ROLE=cchp_runtime
     
    # Private or self-hosted upstreams (for example a model server on your LAN) are
    # allowed in the console: System settings > Routing > Outbound addresses, by host
    # name, by IP range, or by turning the private address guard off. The two
    # variables below only seed those settings: the first start imports their
    # comma-separated host names or IP addresses once, and the console settings are
    # authoritative afterwards. Public providers need nothing here.
    CCH_NOTIFICATION_HOST_ALLOWLIST=
    CCH_UPSTREAM_HOST_ALLOWLIST=
     
    # Remote SIEM audit copy. `disabled` keeps the local PostgreSQL audit only. To
    # enable it, set MODE=enabled, an HTTPS URL, and keep the auth value secret.
    CCH_SIEM_MODE=disabled
    CCH_SIEM_WEBHOOK_URL=
    CCH_SIEM_WEBHOOK_TIMEOUT_MS=10000
    CCH_SIEM_WEBHOOK_AUTH_HEADER_NAME=Authorization
    CCH_SIEM_WEBHOOK_AUTH_HEADER=
     
    # Required secrets. Compose refuses to start while one of them is empty. The
    # commands at the top of this file fill them in. Run those commands once, before
    # the first start: after CCHP has started, new values cannot decrypt the stored
    # provider keys and no longer match the owner password in the database volume.
    POSTGRES_PASSWORD=
    CCHP_DATABASE_RUNTIME_PASSWORD=
    CCH_TOKEN_PEPPER=
    CCH_MASTER_KEY=
    DRAGONFLY_KEY_SECRET=

    The last five lines are the five secrets. Their values are empty in this file.

  2. Generate the five secrets. The commands remove the five empty lines from .env and then write the five lines again with new values.

    bash
    grep -v -E '^(POSTGRES_PASSWORD|CCHP_DATABASE_RUNTIME_PASSWORD|CCH_TOKEN_PEPPER|CCH_MASTER_KEY|DRAGONFLY_KEY_SECRET)=' .env > .env.new
    for key in POSTGRES_PASSWORD CCHP_DATABASE_RUNTIME_PASSWORD CCH_TOKEN_PEPPER CCH_MASTER_KEY DRAGONFLY_KEY_SECRET; do
      printf '%s=%s\n' "$key" "$(openssl rand -hex 32)" >> .env.new
    done
    mv .env.new .env

    Result: .env ends with the five secrets. Each one has a value of 64 hexadecimal characters.

Docker Compose does not start the services while one of the five secrets is empty:

VariableMeaning
POSTGRES_PASSWORDPassword of the database owner POSTGRES_USER. PostgreSQL sets it when the volume cch_pg is first created, and migrate connects with it.
CCHP_DATABASE_RUNTIME_PASSWORDPassword of the restricted role that cchp uses. migrate sets it on every run.
CCH_TOKEN_PEPPERSecret that CCHP mixes into the hash of each token and API key.
CCH_MASTER_KEYKey that encrypts the stored provider keys.
DRAGONFLY_KEY_SECRETSecret that CCHP uses to hash the key names of its data in Dragonfly.

You can change these variables when the defaults do not fit:

VariableDefaultMeaning
CCHP_IMAGE_TAGlatestImage tag. Write a version such as 1.0.2 to stay on that version.
CCHP_DASHBOARD_PORT8080Host port of the console.
CCHP_GATEWAY_PORT8081Host port of the gateway.
CCH_PUBLIC_BASE_URLhttp://localhost:8080Address where people open the console. It must be an HTTPS address or a localhost address.
CCH_CONTROL_PLANE_ALLOWED_ORIGINShttp://localhost:8080Browser origins that can call the gateway API. Set it together with CCH_PUBLIC_BASE_URL.
CCH_GATEWAY_PUBLIC_URLhttp://localhost:8081Gateway address that the console shows to API users.
POSTGRES_USER, POSTGRES_DBhub, appDatabase owner and database name. PostgreSQL uses them only when the volume is first created.
CCHP_DATABASE_RUNTIME_ROLEcchp_runtimeName of the restricted role.
CCH_UPSTREAM_HOST_ALLOWLISTemptyHost names of upstreams on a private address, separated by commas. The first start copies them to the console, under System Management → Routing → Outbound Addresses. After that, CCHP uses only the console setting. A public provider needs no entry.
CCH_NOTIFICATION_HOST_ALLOWLISTemptyHost names of notification destinations on a private address. The first start copies them to the same console page, under Notification destinations.
CCH_SIEM_MODEdisabledenabled sends a copy of the audit log to the webhook in CCH_SIEM_WEBHOOK_URL.

Step 3: Start CCHP#

  1. Start the services.

    bash
    docker compose up -d

    Docker downloads the images, starts postgres and dragonfly, runs migrate, and then starts cchp.

  2. Show the state of the services.

    bash
    docker compose ps --format "table {{.Service}}\t{{.State}}\t{{.Status}}"

    Result: three services run, and each one is healthy. The first start of cchp can take one minute.

    text
    SERVICE     STATE     STATUS
    cchp        running   Up 10 seconds (healthy)
    dragonfly   running   Up 39 seconds (healthy)
    postgres    running   Up 38 seconds (healthy)
  3. Ask the console and the gateway if they are ready.

    bash
    curl -s -o /dev/null -w '%{http_code}\n' http://localhost:8080/readyz
    curl -s -o /dev/null -w '%{http_code}\n' http://localhost:8081/readyz

    Result: each command prints 200.

Step 4: Complete the installation wizard#

The first visit to the console opens the installation wizard. The wizard has six steps.

  1. Open http://localhost:8080 in the browser.

  2. Type a site name and select Continue. The name appears on sign-in pages, in emails and on the browser tab.

    Installation wizard, step 1: the site nameInstallation wizard, step 1: the site nameCCHP

  3. Type the email address, the display name and the password of the administrator. Then select Create account. The password must have 8 to 128 characters.

    Installation wizard, step 2: the administrator accountInstallation wizard, step 2: the administrator accountCCHP

    Result: CCHP creates the platform administrator and signs you in.

  4. Add a passkey or an authenticator app for the administrator, and then select Continue. If you want to add them later, select Skip for now.

    Installation wizard, step 3: two-step verificationInstallation wizard, step 3: two-step verificationCCHP

  5. Select Skip — continue without email. Without an email service, registration, sign-in with an email code and password reset do not work. You can add the email service later under System Management → Mail.

    Installation wizard, step 4: the email serviceInstallation wizard, step 4: the email serviceCCHP

  6. Select Continue. The switch Allow registration stays off, because registration needs the email service.

    Installation wizard, step 5: sign-in methodsInstallation wizard, step 5: sign-in methodsCCHP

  7. Type the name of the organization and the name of the first team. Then select Create and continue.

    Installation wizard, step 6: the organizationInstallation wizard, step 6: the organizationCCHP

    Result: the wizard shows the page Pull the model price table.

Step 5: Add the first provider#

A provider is an upstream LLM service. The wizard continues with three pages: the price table, the provider and the result.

  1. Check that the page Pull the model price table shows a model count. Then select Continue. If the page shows no count, select Sync now first.

    Getting started, page 1: the model price tableGetting started, page 1: the model price tableCCHP

  2. Type a provider name.

  3. Open Catalog endpoints and select the request formats that your provider accepts. For an OpenAI-compatible provider, select OpenAI Conversation · Chat Completions.

    The list of catalog endpoints with Chat Completions selectedThe list of catalog endpoints with Chat Completions selectedCCHP

  4. Type the address of your provider in Upstream base URL. Write the scheme and the host, for example https://api.example.com. The Request preview shows the full address that CCHP calls.

  5. Type a name for the provider key in Key name. Paste the API key of your provider in Provider API key. CCHP stores the key in encrypted form.

  6. Select Add next to Model whitelist, type a model name and select the model in the list. The provider key serves only the models in the whitelist.

    The model dialog with the model gpt-4o-miniThe model dialog with the model gpt-4o-miniCCHP

    The button Fetch from /v1/models adds all models that your provider lists. A model without a price in the price table gets the mark No price. The gateway refuses requests for such a model until you set a price under Model Management.

  7. Type the opening balance of the organization in US dollars. The gateway pays each request from this balance and refuses requests when the balance is 0.

  8. Select Create provider & finish.

    Getting started, page 2: the completed provider formGetting started, page 2: the completed provider formCCHP

    Result: the page You’re all set shows the gateway address, the initial API key, the balance and the callable models. The wizard also created the provider group Default provider group and bound the initial API key to it.

    Getting started, page 3: the result with the initial API keyGetting started, page 3: the result with the initial API keyCCHP

  9. Select Enter the console.

The administrator is now signed in. To sign in again later, open http://localhost:8080, type the email address, select Continue and type the password. The page Select organization then opens for the administrator. Select the organization on this page.

The sign-in pageThe sign-in pageCCHP

Step 6: Create a provider group#

A provider group is a set of provider keys with one routing strategy. An API key calls models through the groups that you bind to it.

  1. Select Provider Management in the sidebar, open the tab Provider groups and select New group.

    The provider groups tab with the New group buttonThe provider groups tab with the New group buttonCCHP

  2. Type a group name. Keep the routing strategy Price priority, or select a different strategy.

  3. Select Add provider keys.

    The new provider group formThe new provider group formCCHP

  4. Select the provider key and then select Add to group.

    The dialog that adds provider keys to the groupThe dialog that adds provider keys to the groupCCHP

  5. Select Create group.

    The provider group form with one memberThe provider group form with one memberCCHP

    Result: the list shows the new group with one member.

    The provider group list with the new groupThe provider group list with the new groupCCHP

Step 7: Create a user and an API key#

The administrator creates the account of the user with a temporary password. The user signs in with the temporary password, sets their own password and then creates an API key.

  1. Select User Management in the sidebar and select New user.

    The user list with the New user buttonThe user list with the New user buttonCCHP

  2. Check that the dialog shows Create account at the top. When CCHP has no email service, the dialog selects this option.

  3. Type the name and the email address of the user in Name and Email.

  4. Keep the temporary password that CCHP generated, or type a different one with 8 to 128 characters.

  5. Select Create account.

    The new user dialog with the option Create accountThe new user dialog with the option Create accountCCHP

    If you signed in more than 10 minutes ago, the dialog Verify your identity opens first. Select Sign in, sign in again and select the organization. The console then returns to User Management. Do steps 1–5 again.

    Result: CCHP creates the account and adds it to the organization as a member. The dialog Account created shows the sign-in email and the temporary password.

  6. Select Copy all sign-in details and give the details to the user through a secure channel. Then select I’ve saved it. After the dialog closes, nobody can see the temporary password again.

    The dialog with the sign-in detailsThe dialog with the sign-in detailsCCHP

    Result: the user list shows the new user as Active.

    The user list with the new userThe user list with the new userCCHP

The user does the next steps in their own browser.

  1. Open http://localhost:8080. Type the email address from the sign-in details and select Continue.

  2. Type the temporary password and select Sign in.

    The sign-in page with the temporary passwordThe sign-in page with the temporary passwordCCHP

  3. Type a new password in New password and in Confirm password. Then select Save and continue.

    The page that sets a new passwordThe page that sets a new passwordCCHP

    Result: the console opens in the language of the sign-in page.

  4. Select API Keys in the sidebar and select Create key.

    The key management page of the userThe key management page of the userCCHP

  5. Type a key name. Under Routing strategy, select Pinned groups and add the provider group from step 6. Then select Create key.

    The key form with the pinned provider groupThe key form with the pinned provider groupCCHP

  6. Select Copy and keep the API key in a safe place.

    The dialog with the new API keyThe dialog with the new API keyCCHP

Step 8: Send the first request#

The gateway accepts the API key in the header Authorization: Bearer, x-api-key or x-goog-api-key.

  1. Put the API key into an environment variable. Replace the value with your key.

    bash
    export CCHP_API_KEY='cch_llm_live_...'
  2. Send a Chat Completions request to the gateway. Replace gpt-4o-mini with a model from your whitelist.

    bash
    curl -sS -w '\nHTTP %{http_code}\n' http://localhost:8081/v1/chat/completions \
      -H "Authorization: Bearer $CCHP_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"model": "gpt-4o-mini", "messages": [{"role": "user", "content": "Hello"}]}'

    Result: the gateway returns the answer of the provider and the status 200.

    text
    {"id":"chatcmpl-cchp-fixture","object":"chat.completion","model":"cchp-fixture-1","choices":[{"index":0,"message":{"role":"assistant","content":"fixture ok"},"finish_reason":"stop"}]}
    HTTP 200

    The upstream of this tutorial is a test server. It always reports the model cchp-fixture-1 and the answer fixture ok. Your provider returns its own model name and answer.

  3. As the administrator, select Usage Records in the sidebar.

    The request log with the first requestThe request log with the first requestCCHP

    Result: the page Request Logs shows the request with its model, provider, user, API key, tokens, cost and status.

The page API Keys shows the base URL for each client type: http://localhost:8081 for Claude clients, http://localhost:8081/v1 for OpenAI clients and http://localhost:8081/v1beta for Gemini clients.

Troubleshooting#

Read the logs#

The command docker compose logs prints the log of a service. Each line of cchp is one JSON object, and the field request_id connects the lines of one request.

bash
docker compose logs --tail 100 cchp
docker compose logs -f cchp
docker compose logs migrate

Check the health#

  • docker compose ps shows healthy for cchp when the gateway, the console and the worker are ready.
  • curl http://localhost:8080/readyz tests the console, and curl http://localhost:8081/readyz tests the gateway. A ready service answers with the status 200.
  • If cchp does not start, read the log of migrate. cchp starts only after migrate ends without an error.

Common problems#

SymptomCause and action
docker compose up prints required variable POSTGRES_PASSWORD is missing a valueA secret in .env is empty. The message names the variable. Do step 2 of “Create the settings file”.
migrate ends with password authentication failed for user "hub"The secrets in .env changed after the first start. Put the .env from your copy back and run docker compose up -d again.
The gateway answers 401 with invalid LLM tokenThe API key in the request is wrong. Copy the key again from the page API Keys.
The console refuses the sign-in from a different machineThe console address is not localhost and not HTTPS. Use the SSH port forward, or put a TLS reverse proxy in front of both ports and set CCH_PUBLIC_BASE_URL, CCH_CONTROL_PLANE_ALLOWED_ORIGINS and CCH_GATEWAY_PUBLIC_URL.
The gateway answers 403 with unpriced model deniedThe model has no price. Set a price under Model Management, or select a model from the price table.
The wizard refuses an upstream on a private addressCCHP blocks private addresses. Open System Management → Routing → Outbound Addresses, and add the host name under Providers and other outbound requests → Host names.