Overview
API-mode is a lightweight deployment option for customers who want RecordEngine in the cloud without the cost of a GPU instance.| GPU Mode | API Mode | |
|---|---|---|
| AI inference | Local (Ollama on GPU) | Cloud API (customer’s key) |
| Monthly cost | ~$730/month (g5.xlarge) | ~$110/month (t3a.xlarge) |
| Provisioning time | ~20 minutes | ~5 minutes (from AMI) |
| Data sovereignty | Full (on-premise) | API provider’s terms |
| Feature parity | Full | Full |
Prerequisites
- AWS account with EC2 access
- Cloudflare DNS access for
recordengine.ai - SSH key:
xr-platform-key.pem - Customer’s API key (OpenAI, Claude, Gemini, or Qwen)
Deploy a New Customer Instance
Step 1 — Launch EC2 from Golden AMI
In the AWS console:- Go to EC2 → AMIs → find
recordengine-api-v3 - Click Launch instance from AMI
- Instance type:
t3a.xlarge(4 vCPU, 16 GB RAM) - Storage: 100 GiB gp3
- Key pair:
xr-platform-key - Security group: allow ports 22, 80, 443 inbound
- Launch
Step 2 — SSH In
Step 3 — Pull Latest Code
Step 4 — Start Containers
Step 5 — DNS
In Cloudflare, create an A record:- Name:
clientname - Target: new instance IP
- Proxy: DNS only (grey cloud — NOT orange)
Step 6 — SSL
Step 7 — Customer Setup
Share the URL with the customer. On first login they will:- Create their admin account
- Go to Settings → AI Backend → select provider → enter API key → Save
- Go to Settings → General → 🔗 Server URL → enter their URL → Save
Managing the Instance
All management uses thexr CLI. The CLI automatically detects API mode via /opt/xr/.deploy_mode.
xr update on the API instance will never start the Ollama container — it reads .deploy_mode and uses docker-compose.api.yml automatically.
Seed Scripts
After the firstxr update, run the seed scripts to populate extraction profiles and default rules:
Architecture
The API-mode compose file (cloud/docker-compose.api.yml) runs three services:
| Container | Port | Purpose |
|---|---|---|
xr-ui | 8501 | Streamlit web interface |
xr-watcher | — | Background AI processing worker |
xr-api | 8510 | FastAPI REST API |
ai_router.py to the customer’s configured API provider.
Golden AMI
Therecordengine-api-v3 AMI contains:
- Ubuntu 24.04 LTS
- Docker + Docker Compose installed
- RecordEngine repo cloned at
/opt/xr - Pre-built Docker images (no build step required)
- Nginx configured
xrCLI installed at/usr/local/bin/xr.deploy_modeset toapi- Correct file ownership (
ubuntu:ubuntu) git safe.directoryconfigured
xr update, and creating a new AMI snapshot (e.g. recordengine-api-v4).
Troubleshooting
Browser hangs on skeleton screen Theconfig.toml is missing required settings. Verify:
xr update tries to start Ollama
The .deploy_mode file is missing or incorrect: