Architecture Overview
How routing, tenancy, identity, billing, and the application layer fit together in Dispike.
Dispike is organized in three layers — foundation models, the routing & tenancy hub, and the application layer — held together by three shared planes: identity, billing, and inference.
┌──────────────────────────────────────────────────────────────┐
│ Application layer │
│ Studio · Drama · healthcare & vertical-industry agents · │
│ Skills · MCP Gateway · Dispike Claw · Agent Desktop · Chat │
└──────────────┬───────────────────────────────────────────────┘
│ one session, one key envelope
┌──────────────▼───────────────────────────────────────────────┐
│ Dispike web app (Astro BFF, dispike.com) │
│ ├── /api/auth/* identity BFF │
│ ├── /api/billing/* Stripe BFF │
│ └── /api/me/* plan / key resolver │
└──────┬───────────────┬────────────────────┬──────────────────┘
▼ ▼ ▼
Dispike auth Stripe AI token router
service (GoTrue) (billing) (tokenhub.dispike.com/v1)
│ fallback · budgets · virtual keys
▼
Foundation models (many providers)
Foundation models
Dispike does not lock you into one model vendor. The router sits in front of multiple upstream providers plus self-hosted models, and exposes them through one OpenAI-compatible contract. Browse what’s available at /models.
Routing & tenancy hub
Inference plane — AI token intelligent routing
https://tokenhub.dispike.com/v1 runs LiteLLM-based routing in front of every upstream. Each request is matched to a model the key is allowed to use, with automatic fallback when a provider degrades. Every API key is bound to a Dispike account, a plan whitelist, and a budget cap. Requests are logged to the usage ledger that drives /dashboard/usage and overage billing.
Multi-tenant architecture
Each tenant — a team, a customer of yours, or an individual end-user — gets its own keys, budgets, and usage ledger. Keys can be minted per tenant through the Keys API; revoking one never affects another tenant. Application-layer products such as Dispike Claw reuse the same isolation: every call is partitioned by user id.
Identity plane
Authentication is centralized on the Dispike auth service (a self-hosted GoTrue instance with Supabase as a dev fallback). The Dispike web app issues a host-only, SameSite=Lax session cookie. Every browser sub-product on a first-party Dispike subdomain inherits that session by calling the web app’s BFF endpoints with credentials: 'include'.
See Authentication flow and Sub-product Integration.
Billing plane
Stripe is the source of truth for plans, subscriptions, and invoices. The Dispike web app holds the only set of Stripe credentials; sub-products never call Stripe directly. Plan and entitlement state is mirrored onto each user’s GoTrue app_metadata via Stripe webhooks landing at /api/billing/webhook.
See Plans, keys, and budgets and Operations: Stripe webhooks.
Application layer
Everything above the router consumes the same identity, key envelope, and budget:
| Product | What it is | Where |
|---|---|---|
| Studio | Audiovisual generation — images, video, voice | /studio |
| Drama | AI short-drama production | /drama |
| Agents | Healthcare and vertical-industry agents | /agents |
| Skills | Reusable capabilities agents can call | /skills |
| MCP Gateway | One endpoint for Model Context Protocol tools | /mcp-gateway |
| Dispike Claw | Your own hosted agent runtime bound to IM channels | Docs |
Sub-products
Any first-party browser app integrates via three BFF endpoints and never holds its own Stripe or auth credentials:
| Endpoint | Returns |
|---|---|
GET /api/auth/me | Current user |
GET /api/me/litellm-key | Bearer + plan + allowed models |
GET /api/billing/plan | Plan id, entitlements, renewal |
CORS is enforced via a regex allowlist over first-party origins plus localhost for development; see src/lib/cors.ts.
Where data lives
| Domain | Store | Notes |
|---|---|---|
| User identity | GoTrue Postgres | Primary region + encrypted DR mirror |
| Subscriptions | Stripe | Stripe-managed (US) |
| API usage | LiteLLM Postgres | Primary region |
| Audit logs | Object storage | Primary region + DR |
Enterprise contracts can pin a region or require a dedicated deployment — see Enterprise: Data Residency.
Last updated: