#!/bin/bash set -e export HOME="/root" export HERMES_HOME="/root/.hermes" echo "=== 🚀 Hermes Serverless Starting ===" # Install Hermes using pip (more reliable than git clone in HF Spaces) if ! command -v hermes &> /dev/null; then echo "📦 Installing Hermes via pip..." pip3 install --quiet git+https://github.com/nousresearch/Hermes.git 2>&1 | tail -3 || \ pip3 install --quiet hermes-agent 2>&1 | tail -3 || \ echo "⚠️ Hermes install may have issues" fi # Configure to use YOUR Vercel Gemini proxy if [ ! -f "/root/.hermes/config.yaml" ]; then echo "⚙️ Configuring Hermes with your Vercel Gemini proxy..." mkdir -p /root/.hermes # Use a dummy key or set via HF Secret API_KEY="${HERMES_KEY:-gemini-proxy-key}" cat > /root/.hermes/config.yaml << EOF provider: openai model: ${HERMES_MODEL:-gemini-3.1-flash-lite} uri: ${HERMES_URI:-https://antigravity-seven-delta.vercel.app/v1} api_key: ${API_KEY} EOF echo "✅ Config created:" cat /root/.hermes/config.yaml fi echo "🌐 Starting API on port 7860..." exec uvicorn server:app --host 0.0.0.0 --port 7860