Self-Hosted

This guide will walk you through the process of deploying XAI Gateway on your own server. The deployment process relies on Docker and Docker Compose, so please ensure your server environment is ready.

Prerequisites

  • A Linux server with root permissions.
  • A domain name that resolves to your server's IP address (for API access).

Deployment Steps

Step 1: Install Docker

We recommend using Docker's official script for installation, as it supports most major Linux distributions.

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

Step 2: Install Docker Compose

This command downloads the latest stable release of Docker Compose from GitHub.

curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose

Step 3: Grant Execute Permissions

Add execute permissions to the Docker Compose binary you just downloaded.

chmod +x /usr/local/bin/docker-compose

Step 4: Generate the docker-compose.yml File

This is the most critical step. You need to generate a custom docker-compose.yml file through our deployment service.

Execute the following command, but be sure to replace the values for xai_mail and xai_api with your own information:

curl -X POST https://deploy.xaixapi.com/xai \
  -H "Content-Type: application/json" \
  -d '{
    "xai_mail": "[email protected]",
    "xai_api": "api.your-domain.com"
  }' | jq -r '.content' > docker-compose.yml

Parameter Explanation:

  • xai_mail (Required): Your administrator email address. It will be used to receive important notifications and initialize the admin account.
  • xai_api (Required): The API domain you have prepared for the service. Ensure this domain correctly resolves to your server's IP address. After the service starts, all API requests will be sent to this address.

Step 5: Start the Service

Using the generated configuration file, start all services in the background.

docker-compose -f docker-compose.yml up -d

Once the deployment is complete, the service will run continuously in the background. You can verify that the service is running correctly by accessing the API domain you configured (http://api.your-domain.com).