IsraelGPT API Docs Get an API key

Architecture

What actually runs where. Useful if you're deciding whether to depend on this API, debugging something unexpected, or just curious.

Domains

Domain / pathWhat it is
www.israelgpt.siteThe main site — web chat, docs, dashboard. A custom domain in front of the Vercel deployment.
www.israelgpt.site/api/v1/chatThe public API described throughout these docs.
www.israelgpt.site/dashboardAPI key management and usage, gated behind sign-in.
www.israelgpt.site/docsThis documentation.

The underlying Vercel-assigned domain is a slightly different spelling (a historical artifact, not a typo you need to worry about) — always use www.israelgpt.site, not any *.vercel.app URL, which can change.

Request flow

your app / bot
│ HTTPS, Authorization: Bearer
POST /api/v1/chat (Vercel serverless function)
├──▶ Supabase — verify API key, fetch lore, log the request
├──▶ Upstash Redis — check & record rate limit
├──▶ OpenRouter — the actual model completion
└──▶ (only if the reply used a media tag) internal image/audio endpoints
one JSON response back to you

Services involved

ServiceRole
VercelHosts the Next.js app — every page and API route, including /api/v1/chat itself, runs as a Vercel serverless function.
SupabasePostgres database + auth. Stores accounts, hashed API keys, per-request usage logs, and the lore content injected into every reply. The web chat also uses it for saved chats and memories — the public API only touches the account/key/log/lore tables.
Upstash RedisBacks rate limiting. A shared, cross-instance store (unlike an in-memory cache, which wouldn't behave consistently across separate serverless invocations) — also caches the lore content for a few minutes so most requests skip the database read entirely.
OpenRouterRoutes model completions to the underlying open-source models (see model_id in a response, or the model table on Personas & Models). Not called directly by you — the API is the only thing that talks to OpenRouter.
DiscordOnly relevant if you use or fork the reference Discord bot (see Discord Bot) — it connects to Discord's own gateway/REST API independently, as a separate always-on process outside this stack entirely.

What this means for you

  • The API is stateless per-request except for rate-limit counters and the lore cache — nothing about a previous call affects a later one beyond that.
  • A slow OpenRouter response is the most likely source of latency; database and cache calls are fast relative to model generation time.
  • If OpenRouter has an outage, the API automatically retries once against a fallback model before returning 502 — see Errors.
  • None of this infrastructure is exposed to you directly — you only ever talk to www.israelgpt.site.

No streaming, on purpose

The endpoint returns one complete JSON response, not a token stream. Two reasons: the reference client (a Discord bot) posts one finished message rather than editing it token-by-token, and a plain JSON contract is what keeps onboarding to a curl command and a 10-line snippet instead of an SSE/streaming parser.

// what you get: one response, once generation finishes
const data = await res.json();
console.log(data.reply);