Same proxy as netlify/functions/ai.mjs, rebuilt as a standalone Bun service on
the CVM host so AI calls stop spending Netlify compute/bandwidth credits and
the sats-paid Routstr key lives on our box.
- ai-proxy/server.ts: Bun.serve on 127.0.0.1:8787 — NIP-98 + Pro gate, model
allowlist, per-IP throttle, /api/ai + /api/ai/status. Own tsconfig
(typecheck:ai in npm test); eslint-ignored like cvm-server.
- ai-proxy/{package.json,.env.example,skatespots-ai.service,Caddyfile,DEPLOY.md}.
- scripts/deploy-ai-proxy.sh (npm run deploy:ai): scp + bun install + unit +
restart, mirroring deploy-cvm.sh.
- Client: one place decides the AI base, src/lib/sasquatchAi.ts (also the NIP-98
u tag). Defaults unchanged (/api/ai on Netlify); set VITE_SASQUATCH_AI_BASE to
move it. Fully reversible.
Deployed and verified on the host: /api/ai/status returns the live Routstr
balance. Public TLS (DNS + Caddy) is the remaining step before switching the app
over, so no client behaviour changes yet.
14 lines
621 B
Text
14 lines
621 B
Text
# SkateSpots AI proxy — environment (copy to .env on the CVM host; never commit).
|
|
#
|
|
# The upstream is OpenAI-compatible. For sats-paid inference point it at a Routstr
|
|
# node (NOT the aggregator api.routstr.com, which is down).
|
|
SASQUATCH_AI_BASE=https://routstr.githappens.space/v1
|
|
SASQUATCH_AI_KEY=
|
|
# Comma-separated model allowlist — must be models the node actually serves.
|
|
SASQUATCH_MODELS=
|
|
# 1 = require a NIP-98 identity plus an active Pro pass (platform owners bypass).
|
|
SASQUATCH_REQUIRE_PRO=1
|
|
|
|
# Bind to localhost only; Caddy terminates TLS and reverse-proxies here.
|
|
AI_PROXY_HOST=127.0.0.1
|
|
AI_PROXY_PORT=8787
|