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.
Prerequisites
Section titled “Prerequisites”| Requirement | Detail |
|---|---|
| Operating system | Linux x86_64 or aarch64 |
| Container runtime | Docker Engine with Docker Compose 2.20.0 or later (docker compose version) |
| System tools | openssl, curl |
| Registry access | An account that can pull images from harbor.chequer.io (see Registry login). |
| Load balancer | A 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 application | An OIDC client registered in Google Workspace, Okta, or Keycloak. The redirect URI is https://<hostname>/api/auth/oidc/callback (see IdP app registration). |
| License | Issuing 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 network | The 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.
Download the package
Section titled “Download the package”Each version is published as a tar archive at:
https://dl.querypie.com/releases/ai-gateway/<version>/package.tar.gzVersion 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:
VERSION=2026.11.01
curl -fLO "https://dl.querypie.com/releases/ai-gateway/$VERSION/package.tar.gz"mkdir -p aig/$VERSIONtar -xzf package.tar.gz -C aig/$VERSIONcd aig/$VERSIONAfter extraction, confirm the version:
cat VERSIONThe 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.
Registry login
Section titled “Registry login”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.
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:
docker logout harbor.chequer.ioImage pull failure
Section titled “Image pull failure”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:
- Check that
VERSIONin the package directory is a published version. - Run
docker login harbor.chequer.ioagain. If the login fails, the username or password is wrong, or the account has expired. - If the login succeeds but
docker pull harbor.chequer.io/aig/aig:<version>is refused, the account has no pull permission on theaigproject. Contact QueryPie support (ab@querypie.com). - If the host cannot connect to the registry (timeout, name resolution
failure), check outbound HTTPS (443) from the host to
harbor.chequer.io.
Install
Section titled “Install”Run the installer from the version directory you just extracted:
./install.sh install --hostname aig.example.comThe installer accepts the following flags and environment variables:
| Flag / variable | Default | Purpose |
|---|---|---|
--hostname <hostname> / AIG_HOSTNAME | Required (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_VERSION | Read from VERSION file | Explicit version override; use when running from a repository checkout that has no VERSION file. |
AIG_HTTP_PORT=<port> | 80 | Host 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> | 443 | HTTPS 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> | 300 | How 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:
AIG_PUBLIC_PORT=8443 AIG_HTTP_PORT=8080 ./install.sh install --hostname aig.example.comlocalhost mode
Section titled “localhost mode”To run AI Gateway on a single host without a load balancer (for evaluation):
./install.sh install --hostname localhostWhen 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.
What the installer does
Section titled “What the installer does”- Validates tools (
docker,openssl,curl) and Docker Compose version. - Confirms the script is being run from
aig/current(not from a previous version directory). - Creates
.envfromenv.templateif it does not exist yet, generating secrets (see Secrets and .env). - Verifies datastore connectivity requirements against
COMPOSE_PROFILES. - Pulls images from
harbor.chequer.io. If this fails, see Image pull failure. - Starts the Compose services (
migrateruns first;serverwaits for it). - Waits for
http://127.0.0.1:<AIG_HTTP_PORT>/readyzto respond (up to 300 seconds; override withAIG_READY_TIMEOUT=<seconds>). - Points
aig/currentat this version directory (symlink). - 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.
Directory layout
Section titled “Directory layout”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.15Always run docker compose and ./install.sh from aig/current:
cd aig/currentdocker compose psRunning 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.15Database 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.
Services
Section titled “Services”The gateway runs four Compose services under the project name aig:
| Service | Role |
|---|---|
migrate | Runs database migrations once and exits. server waits for it. |
server | AI Gateway backend, container port 8080. |
web | Reverse proxy serving the web UI and forwarding /api to server. Listens on AIG_HTTP_PORT (default 80). |
postgres | Bundled PostgreSQL 16. Omitted when DATABASE_URL is set. |
redis | Bundled 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 allowbedrock:InvokeModelon 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.
aws ec2 modify-instance-metadata-options --instance-id <instance-id> --http-put-response-hop-limit 2Outside AWS, use the access_key authentication type, which stores an IAM
access key in AI Gateway.