This starter replaces Gemini with AIMLAPI (OpenAI‑compatible) using the openai SDK
pointed at https://api.aimlapi.com/v1. It receives Prometheus Alertmanager webhooks,
asks an LLM to propose a strict JSON remediation plan, persists it, and offers a
stub executor with dry‑run + approval gates.
cd aimlapi-remediator
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env .env.local # (optional) keep your edits separate
# or edit .env directly to set AIMLAPI_API_KEY and others
python app.py
curl localhost:8080/healthdocker build -t aimlapi-remediator:local .
docker run --rm -p 8080:8080 --env-file .env aimlapi-remediator:localkubectl apply -f manifests/k8s.yamlcurl -s localhost:8080/alert -H 'Content-Type: application/json' -d @sample_alert.json | jq .PLAN_ID=$(curl -s localhost:8080/alert -H 'Content-Type: application/json' -d @sample_alert.json | jq -r '.plans[0].plan_id')
curl -s localhost:8080/execute -H 'Content-Type: application/json' -d '{"plan_id":"'"$PLAN_ID"'","dry_run":true}' | jq .- Keep
.envout of git; it contains secrets. - Adjust
AIMLAPI_MODELto any supported chat model (e.g.,gpt-4o,deepseek-chat, etc.). - The executor is stubbed—wire real k8s/ECS actions cautiously behind allowlists + approvals.
- Exposes Prometheus metrics at
/metricsfor visibility.