Skip to content
AI GatewayAI Gateway Manual

Getting Started

Download the AI Gateway on-premises package, run the installer, and verify the directory layout and initial service state.

AI Gateway is deployed on a single Linux host using Docker Compose. The installer script manages the directory layout, generates secrets on first install, pulls images from the private registry, and waits until the gateway reports healthy.

RequirementDetail
Operating systemLinux x86_64 or aarch64
Container runtimeDocker Engine with Docker Compose 2.20.0 or later (docker compose version)
System toolsopenssl, curl
Registry accessAn account that can pull images from harbor.chequer.io (see Registry login).
Load balancerA TLS-terminating load balancer (for example AWS ALB) with a DNS hostname and a valid certificate pointing at the host. Required unless you are doing a localhost-only test installation.
IdP applicationAn OIDC client registered in Google Workspace, Okta, or Keycloak. The redirect URI is https://<hostname>/api/auth/oidc/callback (see IdP app registration).
LicenseIssuing a license requires this installation’s Installation ID, which appears at step 2 of the bootstrap after installation. For details, contact QueryPie support (ab@querypie.com). The bootstrap cannot be completed until the license arrives (see Bootstrap).
Outbound networkThe host must reach harbor.chequer.io for image pulls, the IdP for authentication, and the LLM provider APIs for model calls, over HTTPS.

AI Gateway runs exactly one installation per host. The Compose project name aig is fixed; a second package directory on the same host would conflict with the running installation. Use ./install.sh upgrade <version> to move to a newer version.

Each version is published as a tar archive at:

https://dl.querypie.com/releases/ai-gateway/<version>/package.tar.gz

Version identifiers follow the pattern 2026.11.01; hotfixes append a counter (2026.11.01.1).

The archive contains no top-level directory, so create the version directory before extracting:

Terminal window
VERSION=2026.11.01
curl -fLO "https://dl.querypie.com/releases/ai-gateway/$VERSION/package.tar.gz"
mkdir -p aig/$VERSION
tar -xzf package.tar.gz -C aig/$VERSION
cd aig/$VERSION

After extraction, confirm the version:

Terminal window
cat VERSION

The VERSION file contains the version string for that package. The installer reads this file automatically; you do not need to pass --version when running from an extracted package.

On a host without internet access, copy package.tar.gz to the host by another means and extract it the same way. Images are still pulled from harbor.chequer.io, so the host must reach the registry.

The images live in the private registry harbor.chequer.io, so you must log in before they can be pulled. Request a Harbor account from QueryPie support (ab@querypie.com) by email, including your company’s English name.

Log in as the user that will run the installer. Docker stores credentials per user, so if you run the installer with sudo, log in with sudo docker login as well.

Terminal window
docker login harbor.chequer.io -u '<username>'

Enter the password at the prompt. Continue to the installation once Login Succeeded is printed.

The credentials are stored in the ~/.docker/config.json of the user who logged in, and on a Linux host without a credential helper they stay there unencrypted. When the installation or upgrade is done, log out as the same user. If you logged in with sudo docker login, log out with sudo docker logout:

Terminal window
docker logout harbor.chequer.io

When the installer cannot pull the images, it stops before changing any running service and prints:

[aig] ERROR: failed to pull images for <version>; check the version and 'docker login harbor.chequer.io'

Narrow down the cause in this order:

  1. Check that VERSION in the package directory is a published version.
  2. Run docker login harbor.chequer.io again. If the login fails, the username or password is wrong, or the account has expired.
  3. If the login succeeds but docker pull harbor.chequer.io/aig/aig:<version> is refused, the account has no pull permission on the aig project. Contact QueryPie support (ab@querypie.com).
  4. If the host cannot connect to the registry (timeout, name resolution failure), check outbound HTTPS (443) from the host to harbor.chequer.io.

Run the installer from the version directory you just extracted:

Terminal window
./install.sh install --hostname aig.example.com

The installer accepts the following flags and environment variables:

Flag / variableDefaultPurpose
--hostname <hostname> / AIG_HOSTNAMERequired (prompted if omitted on a TTY)The hostname users open at the load balancer. Sets MANAGEMENT_BASE_URL, MANAGEMENT_FRONTEND_URL, and the IdP redirect URI.
--version <version> / AIG_VERSIONRead from VERSION fileExplicit version override; use when running from a repository checkout that has no VERSION file.
AIG_HTTP_PORT=<port>80Host port the web container listens on. The load balancer’s target group must point here. Applied only when .env is created.
AIG_PUBLIC_PORT=<port>443HTTPS port users reach at the load balancer. Used to build the base URL when port is not 443. Applied only when .env is created.
AIG_READY_TIMEOUT=<seconds>300How long the installer waits for /readyz to respond before giving up.
AIG_DATABASE_URL=<url>(empty, use bundled)PostgreSQL connection string for a customer-operated database. Applied only when .env is created; edit .env directly afterward.
AIG_REDIS_URL=<url>(empty, use bundled)Redis connection string for a customer-operated Redis. Applied only when .env is created; edit .env directly afterward.

Example with a non-standard load-balancer port and a non-standard HTTP port:

Terminal window
AIG_PUBLIC_PORT=8443 AIG_HTTP_PORT=8080 ./install.sh install --hostname aig.example.com

To run AI Gateway on a single host without a load balancer (for evaluation):

Terminal window
./install.sh install --hostname localhost

When the hostname is localhost or 127.0.0.1, the installer sets APP_ENV=local and builds the base URL as http://localhost (or http://localhost:<AIG_HTTP_PORT> when the port is not 80). Users access the gateway with a browser on the same host. Register the IdP redirect URI as http://localhost/api/auth/oidc/callback. If AIG_HTTP_PORT is not 80, include the port: http://localhost:<AIG_HTTP_PORT>/api/auth/oidc/callback.

To move a localhost install behind a load balancer later, keep the installation and change its address as described in Change the hostname.

  1. Validates tools (docker, openssl, curl) and Docker Compose version.
  2. Confirms the script is being run from aig/current (not from a previous version directory).
  3. Creates .env from env.template if it does not exist yet, generating secrets (see Secrets and .env).
  4. Verifies datastore connectivity requirements against COMPOSE_PROFILES.
  5. Pulls images from harbor.chequer.io. If this fails, see Image pull failure.
  6. Starts the Compose services (migrate runs first; server waits for it).
  7. Waits for http://127.0.0.1:<AIG_HTTP_PORT>/readyz to respond (up to 300 seconds; override with AIG_READY_TIMEOUT=<seconds>).
  8. Points aig/current at this version directory (symlink).
  9. Prints the bootstrap URL, where the bootstrap token is stored, the IdP redirect URI, and the setup guide URL (/manual/install/bootstrap/).

After installation, open the bootstrap URL in a browser and complete initial setup. See Bootstrap for the full procedure.

The installer creates one directory per version under an installation root and keeps a current symlink pointing at the running version:

aig/
2026.11.01/ package files, .env, backups/
2026.11.15/ package files, .env, backups/
current -> 2026.11.15

Always run docker compose and ./install.sh from aig/current:

Terminal window
cd aig/current
docker compose ps

Running from a previous version directory is rejected by the script:

[aig] ERROR: this is 2026.11.01, but aig/current points to 2026.11.15; run install.sh from aig/2026.11.15

Database and Redis data are stored in Docker volumes (aig_pgdata, aig_redisdata) that are tied to the Compose project name aig, not to a version directory. Volumes persist across upgrades.

The gateway runs four Compose services under the project name aig:

ServiceRole
migrateRuns database migrations once and exits. server waits for it.
serverAI Gateway backend, container port 8080.
webReverse proxy serving the web UI and forwarding /api to server. Listens on AIG_HTTP_PORT (default 80).
postgresBundled PostgreSQL 16. Omitted when DATABASE_URL is set.
redisBundled Redis 7. Omitted when REDIS_URL is set.

All images come from harbor.chequer.io/aig/ (for example harbor.chequer.io/aig/aig). The host does not need access to Docker Hub.

Only one host port is exposed: AIG_HTTP_PORT (web). Users do not connect to this port directly; a TLS-terminating load balancer sits in front.

Amazon Bedrock with the host’s AWS credentials

Section titled “Amazon Bedrock with the host’s AWS credentials”

An Amazon Bedrock Provider can sign its requests with the AWS credentials of the AI Gateway server instead of a key stored in AI Gateway (authentication type default_credentials, optionally assuming a role). The server container receives only the environment variables the package defines, so it finds AWS credentials through the EC2 instance metadata service. To use this:

  • Run the host on EC2 with an instance role that may call Bedrock (bedrock:InvokeModel, bedrock:InvokeModelWithResponseStream, bedrock:ListFoundationModels, bedrock:ListInferenceProfiles), or that may assume the role set on the Provider (sts:AssumeRole). To use GPT models through the Responses API, also allow bedrock:InvokeModel on your account’s default project (arn:aws:bedrock:<region>:<account-id>:project/default); see Connect AWS Bedrock.
  • Set the instance metadata hop limit to 2 or more. The container is one network hop further away than the host, so with a hop limit of 1 the metadata token never reaches it and the Provider fails with an upstream authentication error.
Terminal window
aws ec2 modify-instance-metadata-options --instance-id <instance-id> --http-put-response-hop-limit 2

Outside AWS, use the access_key authentication type, which stores an IAM access key in AI Gateway.