AISBF Logo AISBF

AI Service Broker Framework — AI Should Be Free

AISBF install

Install AISBF in Production, Step by Step

A complete installation tutorial for AISBF: service user, Python environment, MySQL, Redis, systemd, nginx, TLS edge, and first verification calls.

AISBF production network graphClient appsOpenAI SDK / curlTLS edgenginx / ingressAISBF #1FastAPI workerAISBF #2FastAPI workerMySQLusers + configsRediscache + sessionsCoderAIlocal broker / LANRunPodGPU endpointsHosted APIsOpenAI etc.Workersmodels / GPUsApp sends: POST /api/u/{username}/chat/completions → AISBF authenticates token → resolves route → backend → streamed response.

What you are building

This install puts AISBF behind a TLS edge and keeps AISBF itself on localhost or a private network. AISBF becomes the one API your apps call; provider keys, rotations, autoselect rules, dashboard users, and cluster state live behind it.

Step-by-step install

Install dependencies and fetch AISBF

sudo apt update
sudo apt install -y python3 python3-venv python3-pip git redis-server mysql-server nginx
sudo useradd --system --home /opt/aisbf --shell /usr/sbin/nologin aisbf || true
sudo mkdir -p /opt/aisbf /etc/aisbf /var/lib/aisbf
sudo chown -R aisbf:aisbf /opt/aisbf /etc/aisbf /var/lib/aisbf
sudo -u aisbf git clone https://git.nexlab.net/nexlab/aisbf /opt/aisbf/app
sudo -u aisbf python3 -m venv /opt/aisbf/venv
sudo -u aisbf /opt/aisbf/venv/bin/pip install -U pip
sudo -u aisbf /opt/aisbf/venv/bin/pip install -e /opt/aisbf/app
sudo cp /opt/aisbf/app/config/*.json /etc/aisbf/
sudo chown -R aisbf:aisbf /etc/aisbf

Create MySQL database

sudo mysql <<'SQL'
CREATE DATABASE IF NOT EXISTS aisbf CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER IF NOT EXISTS 'aisbf'@'localhost' IDENTIFIED BY 'change-this-password';
GRANT ALL PRIVILEGES ON aisbf.* TO 'aisbf'@'localhost';
FLUSH PRIVILEGES;
SQL

Edit /etc/aisbf/aisbf.json

{"database":{"type":"mysql","mysql_host":"localhost","mysql_port":3306,"mysql_user":"aisbf","mysql_password":"change-this-password","mysql_database":"aisbf"},"cache":{"type":"redis","redis_host":"localhost","redis_port":6379,"redis_db":0,"redis_key_prefix":"aisbf:prod:"},"auth":{"enabled":true,"tokens":["global-admin-token-only-for-admin-scripts"]}}

Create a systemd service

[Unit]
Description=AISBF API Gateway
After=network-online.target mysql.service redis-server.service
Wants=network-online.target

[Service]
User=aisbf
Group=aisbf
WorkingDirectory=/opt/aisbf/app
Environment=AISBF_CONFIG_DIR=/etc/aisbf
ExecStart=/opt/aisbf/venv/bin/uvicorn main:app --host 127.0.0.1 --port 17765
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target

Put nginx in front

location / {
  proxy_pass http://127.0.0.1:17765;
  proxy_set_header Host $host;
  proxy_set_header X-Forwarded-Proto https;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_buffering off;
}

Verify from outside

curl -fsS https://aisbf.example.com/health
curl -fsS https://aisbf.example.com/api/v1/models -H "Authorization: Bearer $AISBF_API_TOKEN"
Production rule: app code should use user-scoped tokens and routes. Avoid putting global admin tokens into applications.

Try AISBF

AISBF is open source and also available as a hosted service. During the current testing period, hosted Pro is temporarily available as unlimited access for €2/month.