How Relay Mode Works
When relay mode is enabled, everyblip.ai.text() call inside a generated app sends a request to your server’s relay endpoint (/api/app-ai/chat by default). The server receives the request, forwards it to your configured AI provider using the credentials stored in your environment variables, and streams the response back to the app.
The generated HTML embeds only the public relay URL — not the key itself. This means:
- Users never see or handle a provider credential.
- Exporting an app as HTML is safe; the file contains a URL, not a secret.
- You control which model is used and can change it server-side without regenerating any apps.
Enabling Relay Mode
Set the following variables in your.env file before building or starting the server:
APPBLIPS_APP_LLM_BASE_URL, APPBLIPS_APP_LLM_API_KEY, and APPBLIPS_APP_LLM_MODEL power the relay. They are separate from APPBLIPS_LLM_*, which powers the AppBlips builder itself. Both sets of variables stay on the server and are never exposed to the browser.
CORS and Allowed Origins
By default, only same-origin callers can reach the relay endpoint. If your generated apps are hosted on a different domain than your AppBlips server — for example, you exported an app and are hosting it elsewhere — you need to explicitly allow those origins. SetAPPBLIPS_APP_AI_ALLOWED_ORIGINS to a comma-separated list of exact origins:
null (the origin of file:// pages) if you intentionally want locally-opened HTML files to use your relay.
Rate Limiting
The relay includes a built-in per-IP rate limiter to help prevent runaway usage. Configure it with:429 response, which blip.ai.text() surfaces as a rate_limited error.
