Python FastAPI service for the three Gemini agent actions from ai-agent.ts.
sudo cp sloth-api.service /etc/systemd/system/sloth-api.service
sudo systemctl daemon-reload
sudo systemctl enable --now sloth-api.service
sudo systemctl status sloth-api.servicepython3 -m pip install -r requirements.txt
export GEMINI_API_KEY="your-api-key"
python3 main.pyThe service starts on http://localhost:8000.
The API enables CORS for browser and mini app calls by default. Current config
allows any origin and does not enable credentialed cookie requests. If the
frontend needs cookies or login sessions, replace allow_origins=["*"] in
main.py with the exact production domains.
All POST endpoints accept:
{
"contents": "user goals or task text"
}For older callers, the same JSON body can use req instead of contents.
GET /healthreturns{"status": "ok"}POST /suggestreturnsstring[]POST /writreturnsstring[7];/writis kept as a compatibility aliasPOST /todoreturns{ "name": string, "value": number, "todos": string[] }[]