feat(aiui): Routstr as an explicit, session-gated AI provider path

The D-04 Routstr leg was fallback-only — never user-selectable, and its
Nostr discovery parses a docs-shaped event content ({endpoints, models,
pricing}) that live kind-38421 announcements don't actually carry
({name, about}), so it could never match a real provider. This adds the
explicit path AIUI's model picker needs: /aiui/api/routstr/models
passes through the live aggregator catalog (the instance routstr.com's
own frontend queries; the canonical api.routstr.com 404s), and
/aiui/api/routstr/chat/completions makes one paid, non-streaming,
OpenAI-shaped call — session-gated, egress-screened (S3), refused
without an armed operator budget (D-05), paid via auto_pay_token,
change and refused-request tokens redeemed back into the wallet so a
failed attempt nets zero (verified live: quoted=1 reclaimed=1 net=0).
nginx template gains the location in both server blocks (T-13-15).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
archipelago
2026-08-14 13:41:07 -04:00
co-authored by Claude Fable 5
parent ced95a60d1
commit e3bd340725
4 changed files with 582 additions and 6 deletions
@@ -107,6 +107,24 @@ server {
proxy_send_timeout 120s;
}
# AIUI Routstr proxy — the explicit, user-selected Routstr provider in
# AIUI's model picker. Same daemon, same session-gate discipline as the
# Claude block above; the daemon additionally refuses paid requests
# unless the operator has armed a Routstr budget (D-05), so this is
# never an open relay even though completions cost sats.
location /aiui/api/routstr/ {
proxy_pass http://127.0.0.1:5678;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Cookie $http_cookie;
proxy_buffering off;
proxy_cache off;
proxy_connect_timeout 120s;
proxy_read_timeout 300s;
proxy_send_timeout 120s;
}
# AIUI Ollama (local AI) proxy — same daemon, same session gate as above.
# The standalone AIUI OpenRouter relay that used to live here is deleted
# outright: the node holds no key for that backend, it is not in the
@@ -1041,6 +1059,20 @@ server {
proxy_read_timeout 300s;
proxy_send_timeout 120s;
}
# Session-gated Routstr provider path — same rationale and shape as the
# HTTP server block above; both blocks must carry it (T-13-15).
location /aiui/api/routstr/ {
proxy_pass http://127.0.0.1:5678;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Cookie $http_cookie;
proxy_buffering off;
proxy_cache off;
proxy_connect_timeout 120s;
proxy_read_timeout 300s;
proxy_send_timeout 120s;
}
location /aiui/api/ollama/ {
proxy_pass http://127.0.0.1:5678;
proxy_http_version 1.1;