Jaika

AI assistant powered by Google Gemini.
Free. Fast. Self-hosted.

Run this in your terminal to sign in:

Loading...

Jaika API

AI assistant powered by Google Gemini. Use the REST API to integrate Jaika into your apps.

New Chat

Start a conversation

Send a message or upload a file to begin.

Jaika v2 Hosting Guide

Complete setup instructions to deploy Jaika v2 on a fresh Ubuntu/Debian server (or Android chroot).

1. Install system dependencies

sudo apt update
sudo apt install -y python3 python3-pip python3-venv curl git pandoc \
  texlive-latex-base texlive-latex-extra texlive-fonts-recommended

# Install Node.js 20 (required for Gemini CLI)
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
# If old Node conflicts: sudo apt remove -y libnode-dev && sudo apt install -y nodejs

node --version  # Should be v20.x
npm --version

2. Install Gemini CLI

sudo npm install -g @google/gemini-cli
# If first install fails, retry:
# sudo npm install -g @google/gemini-cli
gemini --version  # Should show version

3. Clone/copy Jaika v2

sudo mkdir -p /opt/jaika-v2
sudo git clone https://github.com/goyaljai/jaika.git /opt/jaika-v2
# Or copy: sudo cp -r /path/to/jaika-v2/* /opt/jaika-v2/

4. Python venv + dependencies

cd /opt/jaika-v2
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install flask requests google-auth google-auth-oauthlib \
  gunicorn python-dotenv grpcio grpcio-tools

For Android chroot: unset ANDROID_DATA ANDROID_ROOT before pip commands.

5. Create data directories + config

mkdir -p /opt/jaika-v2/data/{users,skills}
mkdir -p /opt/jaika-v2/static
mkdir -p /var/log/server

# Admin emails (change to your email)
echo '["your-admin@gmail.com"]' > /opt/jaika-v2/data/admins.json
echo '[]' > /opt/jaika-v2/data/pro_users.json

# Generate secret key
SK=$(python3 -c "import secrets; print(secrets.token_hex(32))")

cat > /opt/jaika-v2/.env <<EOF
JAIKA_DATA_DIR=/opt/jaika-v2/data
JAIKA_USE_CLI=true
JAIKA_HOST=0.0.0.0
JAIKA_PORT=5244
SECRET_KEY=$SK
JAIKA_MAX_CLI_CONCURRENCY=5
EOF

6. Set up Supervisor

sudo apt install -y supervisor

# Flask API (port 5244)
cat > /etc/supervisor/conf.d/jaika.conf <<'EOF'
[program:jaika]
command=/opt/jaika-v2/.venv/bin/gunicorn --bind 0.0.0.0:5244 --workers 1 --threads 4 --timeout 120 --access-logfile - app:app
directory=/opt/jaika-v2
environment=HOME="/root",PATH="/opt/jaika-v2/.venv/bin:/usr/local/bin:/usr/bin:/bin"
autostart=true
autorestart=true
stdout_logfile=/var/log/server/jaika-out.log
stderr_logfile=/var/log/server/jaika-err.log
EOF

# gRPC server (port 5245)
cat > /etc/supervisor/conf.d/jaika-grpc.conf <<'EOF'
[program:jaika-grpc]
command=/opt/jaika-v2/.venv/bin/python grpc_server.py
directory=/opt/jaika-v2
environment=HOME="/root",PATH="/opt/jaika-v2/.venv/bin:/usr/local/bin:/usr/bin:/bin"
autostart=true
autorestart=true
stdout_logfile=/var/log/server/jaika-grpc-out.log
stderr_logfile=/var/log/server/jaika-grpc-err.log
EOF

supervisorctl reread && supervisorctl update

7. Set up Tailscale

# Install
curl -fsSL https://tailscale.com/install.sh | sh

# Start with SSH enabled
tailscale up --ssh

# Expose Flask via HTTPS Funnel (public)
tailscale funnel --bg --https 443 http://localhost:5244

# gRPC is admin-only, accessed via Tailscale IP directly (no funnel needed)
# Tailscale IP: check with `tailscale status`

# Verify
tailscale serve status

Your app will be at https://YOUR-HOSTNAME.tail*.ts.net

8. Set up cron jobs

# Auto-update Gemini CLI daily at 3am + cleanup user files
crontab -e
# Add these lines:
0 3 * * * PATH=/usr/local/bin:/usr/bin:/bin HOME=/root npm update -g @google/gemini-cli >> /var/log/server/gemini-update.log 2>&1
@reboot PATH=/usr/local/bin:/usr/bin:/bin HOME=/root npm update -g @google/gemini-cli >> /var/log/server/gemini-update.log 2>&1
0 3 * * * find /opt/jaika-v2/data/users/*/uploads/ /opt/jaika-v2/data/users/*/outputs/ /opt/jaika-v2/data/users/*/sessions/ -type f -delete 2>/dev/null

9. Verify everything

# Check services
supervisorctl status

# Test Flask
curl -s http://localhost:5244/ | head -1

# Test public URL
curl -s https://YOUR-HOSTNAME.tail*.ts.net/

# Test gRPC (from Tailscale network)
# python3 -c "import grpc; ch=grpc.insecure_channel('TAILSCALE_IP:5245'); print('OK')"

10. Quick reference

# Restart all
supervisorctl restart jaika jaika-grpc

# View logs
tail -f /var/log/server/jaika-out.log
tail -f /var/log/server/jaika-grpc-err.log

# Update code
cd /opt/jaika-v2 && git pull
source .venv/bin/activate && pip install -r requirements.txt
supervisorctl restart jaika jaika-grpc

# Check Tailscale
tailscale status
tailscale serve status

# Android chroot note: always export PATH and unset ANDROID_* vars
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
unset ANDROID_DATA ANDROID_ROOT ANDROID_BOOTLOGO ANDROID_ASSETS

Jaika API Reference

Ready-to-use curl commands with your credentials.

Server Vitals

Live server status and resource usage.

Loading...