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:

ProductWhat it isWhere
StudioAudiovisual generation — images, video, voice/studio
DramaAI short-drama production/drama
AgentsHealthcare and vertical-industry agents/agents
SkillsReusable capabilities agents can call/skills
MCP GatewayOne endpoint for Model Context Protocol tools/mcp-gateway
Dispike ClawYour own hosted agent runtime bound to IM channelsDocs

Sub-products

Any first-party browser app integrates via three BFF endpoints and never holds its own Stripe or auth credentials:

EndpointReturns
GET /api/auth/meCurrent user
GET /api/me/litellm-keyBearer + plan + allowed models
GET /api/billing/planPlan 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

DomainStoreNotes
User identityGoTrue PostgresPrimary region + encrypted DR mirror
SubscriptionsStripeStripe-managed (US)
API usageLiteLLM PostgresPrimary region
Audit logsObject storagePrimary region + DR

Enterprise contracts can pin a region or require a dedicated deployment — see Enterprise: Data Residency.

Last updated: